1 /* 2 * Copyright (c) 2024 Cienet 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_DRIVERS_SENSOR_BMA4XX_DECODER_H_ 8 #define ZEPHYR_DRIVERS_SENSOR_BMA4XX_DECODER_H_ 9 10 #include <stdint.h> 11 #include <zephyr/drivers/sensor.h> 12 13 /* 14 * RTIO types 15 */ 16 17 struct bma4xx_decoder_header { 18 uint64_t timestamp; 19 uint8_t is_fifo: 1; 20 uint8_t accel_fs: 2; 21 uint8_t reserved: 5; 22 } __attribute__((__packed__)); 23 24 struct bma4xx_fifo_data { 25 struct bma4xx_decoder_header header; 26 uint8_t int_status; 27 uint16_t accel_odr: 4; 28 uint16_t fifo_count: 10; 29 uint16_t reserved: 1; 30 } __attribute__((__packed__)); 31 32 struct bma4xx_encoded_data { 33 struct bma4xx_decoder_header header; 34 uint8_t accel_xyz_raw_data[6]; 35 #ifdef CONFIG_BMA4XX_TEMPERATURE 36 int8_t temp; 37 #endif /* CONFIG_BMA4XX_TEMPERATURE */ 38 }; 39 40 int bma4xx_get_decoder(const struct device *dev, const struct sensor_decoder_api **decoder); 41 42 #endif /* ZEPHYR_DRIVERS_SENSOR_BMA4XX_DECODER_H_ */ 43