ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_lsm6dso.c
Go to the documentation of this file.
1
28
29#include "ra8_lsm6dso.h"
30
31#include <stdint.h>
32
33#include "ra8_attributes.h"
34#include "ra8_check.h"
35#include "ra8_err.h"
36#include "ra8_log.h"
37
38/* =============================================================================
39 * File-local constants and helpers
40 * =============================================================================
41 */
42
44static const char* const s_lsm6dso_tag = "lsm6dso";
45
52
58
68
76
86
93
101
102/* =============================================================================
103 * Internal: build the byte that programs CTRL2_G's FS field
104 * =============================================================================
105 */
106
139{
140 /* DS12140 Table 47: FS_125 takes priority over FS_G[1:0]. */
141 if (fs == k_lsm6dso_g_fs_125dps) {
142 return (uint8_t)((uint8_t)1U << (uint8_t)k_lsm6dso_shift_fs_125);
143 }
144 /* Numerically, _250dps == 1, _500dps == 2, _1000dps == 3, _2000dps == 4.
145 * Map back to the FS_G[1:0] bit field by subtracting one. */
146 const uint8_t fs_g_field = (uint8_t)((uint8_t)fs - (uint8_t)k_lsm6dso_g_fs_250dps);
147 return (uint8_t)((uint8_t)(fs_g_field & 0x03U) << (uint8_t)k_lsm6dso_shift_fs_g);
148}
149
176static ra8_err_t internal_lsm6dso_write_byte(ra8_lsm6dso_t* dev, uint8_t reg, uint8_t val)
177{
178 return dev->bus.write_regs(dev->bus.ctx, reg, &val, 1U);
179}
180
206static ra8_err_t internal_lsm6dso_read_byte(ra8_lsm6dso_t* dev, uint8_t reg, uint8_t* out)
207{
208 return dev->bus.read_regs(dev->bus.ctx, reg, out, 1U);
209}
210
240static ra8_err_t internal_lsm6dso_rmw_odr(ra8_lsm6dso_t* dev, uint8_t reg, uint8_t odr_bits)
241{
242 uint8_t now = 0U;
243 const ra8_err_t r = internal_lsm6dso_read_byte(dev, reg, &now);
244 if (r != k_ra8_ok) {
245 return r;
246 }
247 const uint8_t merged = (uint8_t)((now & (uint8_t)~k_lsm6dso_mask_odr) | odr_bits);
248 return internal_lsm6dso_write_byte(dev, reg, merged);
249}
250
251/* =============================================================================
252 * Lifecycle
253 * =============================================================================
254 */
255
257{
258 RA8_CHECK_NULL_PTR(out_dev, s_lsm6dso_tag, "init: out_dev");
259 RA8_CHECK_NULL_PTR(bus, s_lsm6dso_tag, "init: bus");
260 RA8_CHECK_NULL_PTR(bus->read_regs, s_lsm6dso_tag, "init: bus.read_regs");
261 RA8_CHECK_NULL_PTR(bus->write_regs, s_lsm6dso_tag, "init: bus.write_regs");
262
263 out_dev->bus = *bus;
264 out_dev->accel_fs_code = k_lsm6dso_xl_fs_2g; /* DS12140 sec 9.12 reset default. */
265 out_dev->gyro_fs_code = k_lsm6dso_g_fs_250dps; /* DS12140 sec 9.13 reset default. */
266 out_dev->odr_code = k_lsm6dso_odr_off; /* DS12140 sec 9.12 reset default. */
267 out_dev->initialized = true;
268 return k_ra8_ok;
269}
270
271/* =============================================================================
272 * Identification
273 * =============================================================================
274 */
275
277{
278 RA8_CHECK_NULL_PTR(dev, s_lsm6dso_tag, "who_am_i: dev");
279 RA8_CHECK_NULL_PTR(out_id, s_lsm6dso_tag, "who_am_i: out_id");
280 RA8_VALIDATE_INIT(dev->initialized, s_lsm6dso_tag, "who_am_i: not initialized");
281
282 /* DS12140 sec 9.11 WHO_AM_I (0Fh). */
283 return internal_lsm6dso_read_byte(dev, (uint8_t)k_lsm6dso_reg_who_am_i, out_id);
284}
285
286/* =============================================================================
287 * Configuration
288 * =============================================================================
289 */
290
292{
293 RA8_CHECK_NULL_PTR(dev, s_lsm6dso_tag, "set_accel_range: dev");
294 RA8_VALIDATE_INIT(dev->initialized, s_lsm6dso_tag, "set_accel_range: not initialized");
295 RA8_CHECK_RANGE_TAG((uint8_t)fs,
296 0U,
297 (uint8_t)k_lsm6dso_xl_fs_cap,
300
301 /* DS12140 sec 9.12 CTRL1_XL: read-modify-write FS_XL[3:2]. */
302 uint8_t current = 0U;
303 const ra8_err_t r = internal_lsm6dso_read_byte(dev, (uint8_t)k_lsm6dso_reg_ctrl1_xl, &current);
304 if (r != k_ra8_ok) {
305 return r;
306 }
307 const uint8_t merged =
308 (uint8_t)((current & (uint8_t)~k_lsm6dso_mask_fs_xl) |
309 (uint8_t)(((uint8_t)fs & 0x03U) << (uint8_t)k_lsm6dso_shift_fs_xl));
310 const ra8_err_t w = internal_lsm6dso_write_byte(dev, (uint8_t)k_lsm6dso_reg_ctrl1_xl, merged);
311 if (w != k_ra8_ok) {
312 return w;
313 }
314 dev->accel_fs_code = fs;
315 return k_ra8_ok;
316}
317
319{
320 RA8_CHECK_NULL_PTR(dev, s_lsm6dso_tag, "set_gyro_range: dev");
321 RA8_VALIDATE_INIT(dev->initialized, s_lsm6dso_tag, "set_gyro_range: not initialized");
322 RA8_CHECK_RANGE_TAG((uint8_t)fs,
323 0U,
324 (uint8_t)k_lsm6dso_g_fs_cap,
327
328 /* DS12140 sec 9.13 CTRL2_G: read-modify-write FS_G[3:2] + FS_125[1]. */
329 uint8_t current = 0U;
330 const ra8_err_t r = internal_lsm6dso_read_byte(dev, (uint8_t)k_lsm6dso_reg_ctrl2_g, &current);
331 if (r != k_ra8_ok) {
332 return r;
333 }
334 const uint8_t fs_bits = internal_lsm6dso_g_fs_bits(fs);
335 const uint8_t merged = (uint8_t)((current & (uint8_t)~k_lsm6dso_mask_fs_g_full) | fs_bits);
336 const ra8_err_t w = internal_lsm6dso_write_byte(dev, (uint8_t)k_lsm6dso_reg_ctrl2_g, merged);
337 if (w != k_ra8_ok) {
338 return w;
339 }
340 dev->gyro_fs_code = fs;
341 return k_ra8_ok;
342}
343
345{
346 RA8_CHECK_NULL_PTR(dev, s_lsm6dso_tag, "set_odr: dev");
347 RA8_VALIDATE_INIT(dev->initialized, s_lsm6dso_tag, "set_odr: not initialized");
348 RA8_CHECK_RANGE_TAG((uint8_t)odr,
349 0U,
350 (uint8_t)k_lsm6dso_odr_cap,
353
354 /* DS12140 sec 9.12 / 9.13: ODR field is bits [7:4] of CTRL1_XL and CTRL2_G. */
355 const uint8_t odr_bits =
356 (uint8_t)(((uint8_t)odr & (uint8_t)k_lsm6dso_mask_nibble) << (uint8_t)k_lsm6dso_shift_odr);
357
358 const ra8_err_t rxl = internal_lsm6dso_rmw_odr(dev, (uint8_t)k_lsm6dso_reg_ctrl1_xl, odr_bits);
359 if (rxl != k_ra8_ok) {
360 return rxl;
361 }
362 const ra8_err_t rg = internal_lsm6dso_rmw_odr(dev, (uint8_t)k_lsm6dso_reg_ctrl2_g, odr_bits);
363 if (rg != k_ra8_ok) {
364 return rg;
365 }
366
367 dev->odr_code = odr;
368 return k_ra8_ok;
369}
370
371/* =============================================================================
372 * Sample-read helpers
373 * =============================================================================
374 */
375
404{
405 uint8_t bytes[6] = {};
406 const ra8_err_t r =
407 dev->bus.read_regs(dev->bus.ctx, reg, bytes, (uint32_t)k_lsm6dso_xyz_burst_bytes);
408 if (r != k_ra8_ok) {
409 return r;
410 }
411 /* LSM6DSO XYZ samples are little-endian two's complement
412 * (DS12140 sec 9.29 .. 9.40). */
413 out->x = (int16_t)(((uint16_t)bytes[k_lsm6dso_xyz_off_x_h] << 8) |
414 (uint16_t)bytes[k_lsm6dso_xyz_off_x_l]);
415 out->y = (int16_t)(((uint16_t)bytes[k_lsm6dso_xyz_off_y_h] << 8) |
416 (uint16_t)bytes[k_lsm6dso_xyz_off_y_l]);
417 out->z = (int16_t)(((uint16_t)bytes[k_lsm6dso_xyz_off_z_h] << 8) |
418 (uint16_t)bytes[k_lsm6dso_xyz_off_z_l]);
419 return k_ra8_ok;
420}
421
423{
424 RA8_CHECK_NULL_PTR(dev, s_lsm6dso_tag, "read_accel: dev");
425 RA8_CHECK_NULL_PTR(out, s_lsm6dso_tag, "read_accel: out");
426 RA8_VALIDATE_INIT(dev->initialized, s_lsm6dso_tag, "read_accel: not initialized");
427 /* DS12140 sec 9.35 OUTX_L_A (28h) -- auto-increment burst over 6 bytes. */
428 return internal_lsm6dso_read_xyz(dev, (uint8_t)k_lsm6dso_reg_outx_l_a, out);
429}
430
432{
433 RA8_CHECK_NULL_PTR(dev, s_lsm6dso_tag, "read_gyro: dev");
434 RA8_CHECK_NULL_PTR(out, s_lsm6dso_tag, "read_gyro: out");
435 RA8_VALIDATE_INIT(dev->initialized, s_lsm6dso_tag, "read_gyro: not initialized");
436 /* DS12140 sec 9.29 OUTX_L_G (22h) -- auto-increment burst over 6 bytes. */
437 return internal_lsm6dso_read_xyz(dev, (uint8_t)k_lsm6dso_reg_outx_l_g, out);
438}
439
441{
442 RA8_CHECK_NULL_PTR(dev, s_lsm6dso_tag, "read_temp: dev");
443 RA8_CHECK_NULL_PTR(out_centi_c, s_lsm6dso_tag, "read_temp: out_centi_c");
444 RA8_VALIDATE_INIT(dev->initialized, s_lsm6dso_tag, "read_temp: not initialized");
445
446 /* DS12140 sec 9.27 OUT_TEMP_L (20h) + sec 9.28 OUT_TEMP_H (21h). */
447 uint8_t bytes[2] = {};
448 const ra8_err_t r = dev->bus.read_regs(dev->bus.ctx,
450 bytes,
452 if (r != k_ra8_ok) {
453 return r;
454 }
455 const int16_t raw =
456 (int16_t)(((uint16_t)bytes[k_lsm6dso_idx_high] << 8) | (uint16_t)bytes[k_lsm6dso_idx_low]);
457 /* DS12140 sec 4.3 "Temperature sensor characteristics":
458 * T[degC] = raw / 256 + 25
459 * Scale into centi-deg C to keep integer arithmetic: */
460 *out_centi_c = (int32_t)((int32_t)raw * (int32_t)k_lsm6dso_temp_scale_num /
461 (int32_t)k_lsm6dso_temp_scale_den) +
463 return k_ra8_ok;
464}
465
492{
493 uint8_t status[2] = {};
494 const ra8_err_t rs = dev->bus.read_regs(dev->bus.ctx,
496 status,
498 if (rs != k_ra8_ok) {
499 return rs;
500 }
501 *out_n = (uint32_t)status[k_lsm6dso_idx_low] |
502 ((uint32_t)(status[k_lsm6dso_idx_high] & (uint8_t)k_lsm6dso_mask_nibble) << 8U);
503 return k_ra8_ok;
504}
505
532static ra8_err_t internal_lsm6dso_burst_fifo(ra8_lsm6dso_t* dev, uint8_t* out_buf, uint32_t n_words)
533{
534 const uint32_t total_bytes = n_words * (uint32_t)k_lsm6dso_fifo_bytes_word;
535 return dev->bus.read_regs(dev->bus.ctx,
537 out_buf,
538 total_bytes);
539}
540
575 const uint8_t* out_buf,
576 uint32_t max_words,
577 const uint32_t* out_words)
578{
579 RA8_CHECK_NULL_PTR(dev, s_lsm6dso_tag, "read_fifo: dev");
580 RA8_CHECK_NULL_PTR(out_buf, s_lsm6dso_tag, "read_fifo: out_buf");
581 RA8_CHECK_NULL_PTR(out_words, s_lsm6dso_tag, "read_fifo: out_words");
582 RA8_VALIDATE_INIT(dev->initialized, s_lsm6dso_tag, "read_fifo: not initialized");
583 if (max_words == 0U) {
584 ra8_log_error(s_lsm6dso_tag, "read_fifo: max_words is zero");
586 }
587 return k_ra8_ok;
588}
589
591 uint8_t* out_buf,
592 uint32_t max_words,
593 uint32_t* out_words)
594{
595 /* Set the output count early so callers can rely on it on failure. */
596 if (out_words != nullptr) {
597 *out_words = 0U;
598 }
599 const ra8_err_t chk = internal_lsm6dso_fifo_check_args(dev, out_buf, max_words, out_words);
600 if (chk != k_ra8_ok) {
601 return chk;
602 }
603
604 uint32_t live = 0U;
605 const ra8_err_t rs = internal_lsm6dso_read_fifo_depth(dev, &live);
606 if (rs != k_ra8_ok) {
607 return rs;
608 }
609 const uint32_t to_read = (live > max_words) ? max_words : live;
610 if (to_read == 0U) {
611 return k_ra8_ok;
612 }
613 const ra8_err_t rd = internal_lsm6dso_burst_fifo(dev, out_buf, to_read);
614 if (rd != k_ra8_ok) {
615 return rd;
616 }
617 *out_words = to_read;
618 return k_ra8_ok;
619}
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_VALIDATE_INIT(initialized, tag, message)
Precondition: module must be initialized.
Definition ra8_check.h:334
#define RA8_CHECK_RANGE_TAG(value, min, max, errcode, tag)
Tagged range check (adds a component tag to the log line).
Definition ra8_check.h:311
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Definition ra8_check.h:243
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
Definition ra8_err.h:152
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error(tag, message)
RA8 log error.
Definition ra8_log.h:335
ra8_err_t ra8_lsm6dso_set_odr(ra8_lsm6dso_t *dev, ra8_lsm6dso_odr_t odr)
Program the Output Data Rate for both the accelerometer and the gyroscope.
static ra8_err_t internal_lsm6dso_read_xyz(ra8_lsm6dso_t *dev, uint8_t reg, ra8_lsm6dso_xyz_t *out)
Common XYZ burst-read used by both read_accel and read_gyro.
ra8_lsm6dso_burst_bytes_t
Layout constants used by burst-read helpers.
Definition ra8_lsm6dso.c:47
@ k_lsm6dso_fifo_status_bytes
FIFO_STATUS1 + FIFO_STATUS2 (DS12140 sec 9.44).
Definition ra8_lsm6dso.c:50
@ k_lsm6dso_xyz_burst_bytes
3 axes * 2 bytes (DS12140 sec 9.29 / 9.35).
Definition ra8_lsm6dso.c:48
@ k_lsm6dso_temp_burst_bytes
OUT_TEMP_L + OUT_TEMP_H (DS12140 sec 9.27).
Definition ra8_lsm6dso.c:49
ra8_lsm6dso_cap_t
Enum upper bounds used by RA8_CHECK_RANGE_TAG.
Definition ra8_lsm6dso.c:95
@ k_lsm6dso_odr_cap
Highest ODR code.
Definition ra8_lsm6dso.c:99
@ k_lsm6dso_g_fs_cap
Highest G FS code.
Definition ra8_lsm6dso.c:98
@ k_lsm6dso_xl_fs_cap
Highest XL FS code.
Definition ra8_lsm6dso.c:97
@ k_lsm6dso_xl_fs_max
shared cap value 0x04.
Definition ra8_lsm6dso.c:96
ra8_err_t ra8_lsm6dso_read_temp(ra8_lsm6dso_t *dev, int32_t *out_centi_c)
Read the on-die temperature in centi-degrees Celsius.
ra8_err_t ra8_lsm6dso_read_xl_gyro_fifo(ra8_lsm6dso_t *dev, uint8_t *out_buf, uint32_t max_words, uint32_t *out_words)
Drain up to max_samples paired XL+G samples from the embedded FIFO.
ra8_err_t ra8_lsm6dso_read_gyro(ra8_lsm6dso_t *dev, ra8_lsm6dso_xyz_t *out)
Read one gyroscope sample (raw 16-bit two's-complement).
ra8_err_t ra8_lsm6dso_init(ra8_lsm6dso_t *out_dev, const ra8_lsm6dso_bus_t *bus)
Bind a transport to a driver instance.
static ra8_err_t internal_lsm6dso_fifo_check_args(const ra8_lsm6dso_t *dev, const uint8_t *out_buf, uint32_t max_words, const uint32_t *out_words)
Validate the inputs to ra8_lsm6dso_read_xl_gyro_fifo.
ra8_lsm6dso_shift_t
CTRL1_XL / CTRL2_G field positions (DS12140 sec 9.12 / 9.13).
Definition ra8_lsm6dso.c:70
@ k_lsm6dso_shift_fs_xl
FS_XL[1:0] occupies bits [3:2].
Definition ra8_lsm6dso.c:72
@ k_lsm6dso_shift_fs_125
FS_125 select bit occupies bit [1].
Definition ra8_lsm6dso.c:74
@ k_lsm6dso_shift_odr
ODR_xL[3:0] / ODR_G[3:0] occupy bits [7:4].
Definition ra8_lsm6dso.c:71
@ k_lsm6dso_shift_fs_g
FS_G[1:0] occupies bits [3:2].
Definition ra8_lsm6dso.c:73
ra8_err_t ra8_lsm6dso_set_gyro_range(ra8_lsm6dso_t *dev, ra8_lsm6dso_g_fs_t fs)
Program the gyroscope full-scale range.
static ra8_err_t internal_lsm6dso_write_byte(ra8_lsm6dso_t *dev, uint8_t reg, uint8_t val)
Write a single byte to reg via the bound transport.
ra8_lsm6dso_mask_t
Definition ra8_lsm6dso.c:77
@ k_lsm6dso_mask_fs_g_full
FS_G + FS_125 combined.
Definition ra8_lsm6dso.c:82
@ k_lsm6dso_mask_byte
Full byte mask.
Definition ra8_lsm6dso.c:84
@ k_lsm6dso_mask_fs_g
Bits [3:2]: FS_G field.
Definition ra8_lsm6dso.c:80
@ k_lsm6dso_mask_nibble
Low nibble (used for FIFO len high).
Definition ra8_lsm6dso.c:83
@ k_lsm6dso_mask_odr
Bits [7:4]: ODR field.
Definition ra8_lsm6dso.c:78
@ k_lsm6dso_mask_fs_xl
Bits [3:2]: FS_XL field.
Definition ra8_lsm6dso.c:79
@ k_lsm6dso_mask_fs_125
Bit [1]: FS_125 select.
Definition ra8_lsm6dso.c:81
ra8_lsm6dso_xyz_off_t
XYZ sample byte offsets within the 6-byte burst.
Definition ra8_lsm6dso.c:60
@ k_lsm6dso_xyz_off_x_h
Lsm6dso xyz off x h.
Definition ra8_lsm6dso.c:62
@ k_lsm6dso_xyz_off_y_l
Lsm6dso xyz off y l.
Definition ra8_lsm6dso.c:63
@ k_lsm6dso_xyz_off_z_h
Lsm6dso xyz off z h.
Definition ra8_lsm6dso.c:66
@ k_lsm6dso_xyz_off_x_l
Lsm6dso xyz off x l.
Definition ra8_lsm6dso.c:61
@ k_lsm6dso_xyz_off_y_h
Lsm6dso xyz off y h.
Definition ra8_lsm6dso.c:64
@ k_lsm6dso_xyz_off_z_l
Lsm6dso xyz off z l.
Definition ra8_lsm6dso.c:65
static ra8_err_t internal_lsm6dso_rmw_odr(ra8_lsm6dso_t *dev, uint8_t reg, uint8_t odr_bits)
Read-modify-write the ODR nibble [7:4] of a CTRL register.
static ra8_err_t internal_lsm6dso_burst_fifo(ra8_lsm6dso_t *dev, uint8_t *out_buf, uint32_t n_words)
Burst-read n_words 7-byte FIFO records from FIFO_DATA_OUT_TAG.
ra8_err_t ra8_lsm6dso_read_accel(ra8_lsm6dso_t *dev, ra8_lsm6dso_xyz_t *out)
Read one accelerometer sample (raw 16-bit two's-complement).
static uint8_t internal_lsm6dso_g_fs_bits(ra8_lsm6dso_g_fs_t fs)
Compose the FS_G + FS_125 sub-field of CTRL2_G for the requested gyro full-scale code.
static ra8_err_t internal_lsm6dso_read_byte(ra8_lsm6dso_t *dev, uint8_t reg, uint8_t *out)
Read a single byte from reg via the bound transport.
static ra8_err_t internal_lsm6dso_read_fifo_depth(ra8_lsm6dso_t *dev, uint32_t *out_n)
Read the live FIFO word count (DIFF_FIFO[9:0]).
ra8_err_t ra8_lsm6dso_who_am_i(ra8_lsm6dso_t *dev, uint8_t *out_id)
Read the WHO_AM_I register.
static const char *const s_lsm6dso_tag
Tag for ra8_log_error / ra8_log_info lines from this TU.
Definition ra8_lsm6dso.c:44
ra8_lsm6dso_temp_const_t
Temperature conversion constants per DS12140 sec 9.27.
Definition ra8_lsm6dso.c:88
@ k_lsm6dso_temp_scale_den
Denominator for centi-C convert.
Definition ra8_lsm6dso.c:91
@ k_lsm6dso_temp_scale_num
Numerator for centi-C convert.
Definition ra8_lsm6dso.c:90
@ k_lsm6dso_temp_offset_centi_c
+25 C zero offset, scaled x100.
Definition ra8_lsm6dso.c:89
ra8_lsm6dso_endian_idx_t
Two's-complement byte combination – 0..1 indices.
Definition ra8_lsm6dso.c:54
@ k_lsm6dso_idx_low
Little-endian low byte.
Definition ra8_lsm6dso.c:55
@ k_lsm6dso_idx_high
Little-endian high byte.
Definition ra8_lsm6dso.c:56
ra8_err_t ra8_lsm6dso_set_accel_range(ra8_lsm6dso_t *dev, ra8_lsm6dso_xl_fs_t fs)
Program the accelerometer full-scale range.
ST LSM6DSO 6-DoF IMU driver (accel + gyro + temperature).
@ k_lsm6dso_fifo_bytes_word
Bytes per FIFO word (TAG + 6 data, sec 9.7).
Definition ra8_lsm6dso.h:81
ra8_lsm6dso_odr_t
Output Data Rate codes (shared between XL and G).
@ k_lsm6dso_odr_6660hz
6.66 kHz.
@ k_lsm6dso_odr_off
Power-down (default).
@ k_lsm6dso_reg_fifo_status1
FIFO_STATUS1 (DS12140 sec 9.44).
@ k_lsm6dso_reg_ctrl2_g
CTRL2_G (DS12140 sec 9.13).
@ k_lsm6dso_reg_out_temp_l
OUT_TEMP_L (DS12140 sec 9.27).
@ k_lsm6dso_reg_outx_l_a
OUTX_L_A (DS12140 sec 9.35).
@ k_lsm6dso_reg_outx_l_g
OUTX_L_G (DS12140 sec 9.29).
@ k_lsm6dso_reg_fifo_data_out
FIFO_DATA_OUT_TAG (DS12140 sec 9.60).
@ k_lsm6dso_reg_who_am_i
WHO_AM_I (DS12140 sec 9.11).
@ k_lsm6dso_reg_ctrl1_xl
CTRL1_XL (DS12140 sec 9.12).
ra8_lsm6dso_g_fs_t
Gyroscope full-scale (FS_G) range codes.
@ k_lsm6dso_g_fs_125dps
+-125 dps narrow scale (FS_125 = 1).
@ k_lsm6dso_g_fs_2000dps
+-2000 dps.
@ k_lsm6dso_g_fs_250dps
+-250 dps (default).
ra8_lsm6dso_xl_fs_t
Accelerometer full-scale (FS_XL) range codes.
@ k_lsm6dso_xl_fs_8g
+-8 g, sens 0.244 mg/LSB.
@ k_lsm6dso_xl_fs_2g
+-2 g, sens 0.061 mg/LSB (default).
Transport interface bound at ra8_lsm6dso_init time.
void * ctx
Caller-supplied context.
ra8_lsm6dso_write_fn_t write_regs
Write callback.
ra8_lsm6dso_read_fn_t read_regs
Read callback.
Per-instance driver state.
ra8_lsm6dso_g_fs_t gyro_fs_code
Last gyro full-scale code written.
bool initialized
True after a successful _init.
ra8_lsm6dso_xl_fs_t accel_fs_code
Last accel full-scale code written.
ra8_lsm6dso_odr_t odr_code
Last ODR code written to both blocks.
ra8_lsm6dso_bus_t bus
Transport interface.
3-axis raw sample (X, Y, Z as 16-bit two's-complement counts).
int16_t y
Y-axis raw count.
int16_t z
Z-axis raw count.
int16_t x
X-axis raw count.