Lines Matching +full:channel +full:- +full:count
4 * SPDX-License-Identifier: Apache-2.0
70 /* Remove channel ID. */ in adxl367_temp_convert_q31()
83 /* Remove channel ID. */ in adxl367_temp_convert_q31()
98 *out = ((data_in - ADXL367_TEMP_25C) / ADXL367_TEMP_SENSITIVITY in adxl367_temp_convert_q31()
131 /* Remove channel ID. */ in adxl367_accel_convert_q31()
144 /* Remove channel ID. */ in adxl367_accel_convert_q31()
164 struct sensor_three_axis_data *data, const uint8_t *buffer, int count, in adxl367_get_accel() argument
172 if (enc_data->has_x) { in adxl367_get_accel()
173 data->readings[count].timestamp_delta = in adxl367_get_accel()
175 adxl367_accel_convert_q31(&data->readings[count].x, in adxl367_get_accel()
176 buffer, enc_data->fifo_read_mode, in adxl367_get_accel()
181 if (enc_data->has_y) { in adxl367_get_accel()
184 /* If packet has X channel, then Y channel has offset. */ in adxl367_get_accel()
185 if (enc_data->has_x) { in adxl367_get_accel()
188 data->readings[count].timestamp_delta = sample_num * period_ns; in adxl367_get_accel()
189 adxl367_accel_convert_q31(&data->readings[count].y, in adxl367_get_accel()
190 (buffer + buff_offset), enc_data->fifo_read_mode, in adxl367_get_accel()
195 if (enc_data->has_z) { in adxl367_get_accel()
198 /* If packet has X channel and/or Y channel, in adxl367_get_accel()
199 * then Z channel has offset. in adxl367_get_accel()
202 if (enc_data->has_x) { in adxl367_get_accel()
206 if (enc_data->has_y) { in adxl367_get_accel()
209 data->readings[count].timestamp_delta = in adxl367_get_accel()
211 adxl367_accel_convert_q31(&data->readings[count].z, in adxl367_get_accel()
212 (buffer + buff_offset), enc_data->fifo_read_mode, in adxl367_get_accel()
217 data->readings[count].timestamp_delta = in adxl367_get_accel()
221 if (enc_data->has_x) { in adxl367_get_accel()
222 adxl367_accel_convert_q31(&data->readings[count].x, in adxl367_get_accel()
223 buffer, enc_data->fifo_read_mode, in adxl367_get_accel()
228 if (enc_data->has_y) { in adxl367_get_accel()
229 adxl367_accel_convert_q31(&data->readings[count].y, in adxl367_get_accel()
230 (buffer + buff_offset), enc_data->fifo_read_mode, in adxl367_get_accel()
236 if (enc_data->has_z) { in adxl367_get_accel()
237 adxl367_accel_convert_q31(&data->readings[count].z, in adxl367_get_accel()
238 (buffer + buff_offset), enc_data->fifo_read_mode, in adxl367_get_accel()
244 ret = -ENOTSUP; in adxl367_get_accel()
252 struct sensor_three_axis_data *data, const uint8_t *buffer, int count, in adxl367_get_12b_accel() argument
263 if (enc_data->has_x) { in adxl367_get_12b_accel()
268 data->readings[count].timestamp_delta = sample_num * period_ns; in adxl367_get_12b_accel()
269 adxl367_accel_convert_q31(&data->readings[count].x, in adxl367_get_12b_accel()
270 buffer, enc_data->fifo_read_mode, in adxl367_get_12b_accel()
275 if (enc_data->has_y) { in adxl367_get_12b_accel()
278 /* If packet has X channel, in adxl367_get_12b_accel()
279 * then Y channel has offset. in adxl367_get_12b_accel()
281 if (enc_data->has_x) { in adxl367_get_12b_accel()
288 data->readings[count].timestamp_delta = sample_num * period_ns; in adxl367_get_12b_accel()
289 adxl367_accel_convert_q31(&data->readings[count].y, in adxl367_get_12b_accel()
290 (buffer + buff_offset), enc_data->fifo_read_mode, in adxl367_get_12b_accel()
295 if (enc_data->has_z) { in adxl367_get_12b_accel()
299 /* If packet has X channel and/or Y channel, in adxl367_get_12b_accel()
300 * then Z channel has offset. in adxl367_get_12b_accel()
302 if (enc_data->has_x) { in adxl367_get_12b_accel()
306 if (enc_data->has_y) { in adxl367_get_12b_accel()
328 data->readings[count].timestamp_delta = sample_num * period_ns; in adxl367_get_12b_accel()
329 adxl367_accel_convert_q31(&data->readings[count].z, in adxl367_get_12b_accel()
330 (buffer + buff_offset), enc_data->fifo_read_mode, in adxl367_get_12b_accel()
335 data->readings[count].timestamp_delta = sample_num * period_ns; in adxl367_get_12b_accel()
339 if (enc_data->has_x) { in adxl367_get_12b_accel()
345 adxl367_accel_convert_q31(&data->readings[count].x, in adxl367_get_12b_accel()
346 buffer, enc_data->fifo_read_mode, ADXL367_X_AXIS, in adxl367_get_12b_accel()
350 if (enc_data->has_y) { in adxl367_get_12b_accel()
367 adxl367_accel_convert_q31(&data->readings[count].y, in adxl367_get_12b_accel()
368 (buffer + buff_offset), enc_data->fifo_read_mode, in adxl367_get_12b_accel()
372 if (enc_data->has_z) { in adxl367_get_12b_accel()
388 adxl367_accel_convert_q31(&data->readings[count].z, in adxl367_get_12b_accel()
389 (buffer + buff_offset), enc_data->fifo_read_mode, in adxl367_get_12b_accel()
395 ret = -ENOTSUP; in adxl367_get_12b_accel()
403 struct sensor_q31_data *data, const uint8_t *buffer, int count, uint8_t packet_size) in adxl367_get_12b_temp() argument
405 if (enc_data->has_tmp) { in adxl367_get_12b_temp()
406 uint8_t offset = ((packet_size - 1) * 12) / 8; in adxl367_get_12b_temp()
407 uint8_t start_offset = ((packet_size - 1) * 12) % 8; in adxl367_get_12b_temp()
414 adxl367_temp_convert_q31(&data->readings[count].temperature, in adxl367_get_12b_temp()
415 (buffer + offset), enc_data->fifo_read_mode, in adxl367_get_12b_temp()
425 buffer + sizeof(struct adxl367_fifo_data) + enc_data->fifo_byte_count; in adxl367_decode_12b_stream()
426 uint8_t packet_size = enc_data->packet_size; in adxl367_decode_12b_stream()
427 uint64_t period_ns = accel_period_ns[enc_data->accel_odr]; in adxl367_decode_12b_stream()
429 int count = 0; in adxl367_decode_12b_stream() local
432 while (count < max_count && buffer < buffer_end) { in adxl367_decode_12b_stream()
452 if (enc_data->packet_size % 2) { in adxl367_decode_12b_stream()
470 data->header.base_timestamp_ns = enc_data->timestamp; in adxl367_decode_12b_stream()
471 data->header.reading_count = 1; in adxl367_decode_12b_stream()
472 data->shift = 8; in adxl367_decode_12b_stream()
474 data->readings[count].timestamp_delta = in adxl367_decode_12b_stream()
477 adxl367_get_12b_temp(enc_data, data, buffer, count, packet_size); in adxl367_decode_12b_stream()
483 data->header.base_timestamp_ns = enc_data->timestamp; in adxl367_decode_12b_stream()
484 data->header.reading_count = 1; in adxl367_decode_12b_stream()
485 data->shift = range_to_shift[enc_data->range]; in adxl367_decode_12b_stream()
487 int ret = adxl367_get_12b_accel(enc_data, data, buffer, count, packet_size, in adxl367_decode_12b_stream()
497 count++; in adxl367_decode_12b_stream()
500 return count; in adxl367_decode_12b_stream()
508 buffer + sizeof(struct adxl367_fifo_data) + enc_data->fifo_byte_count; in adxl367_decode_stream()
509 int count = 0; in adxl367_decode_stream() local
518 uint8_t packet_size = enc_data->packet_size; in adxl367_decode_stream()
519 uint64_t period_ns = accel_period_ns[enc_data->accel_odr]; in adxl367_decode_stream()
522 if (enc_data->fifo_read_mode == ADXL367_8B) { in adxl367_decode_stream()
526 if (enc_data->fifo_read_mode == ADXL367_12B) { in adxl367_decode_stream()
527 count = adxl367_decode_12b_stream(buffer, chan_spec, fit, max_count, in adxl367_decode_stream()
532 sample_num = ((uint8_t *)*fit - buffer) / packet_size; in adxl367_decode_stream()
535 while (count < max_count && buffer < buffer_end) { in adxl367_decode_stream()
550 data->header.base_timestamp_ns = enc_data->timestamp; in adxl367_decode_stream()
551 data->header.reading_count = 1; in adxl367_decode_stream()
552 data->shift = 8; in adxl367_decode_stream()
554 data->readings[count].timestamp_delta = in adxl367_decode_stream()
557 if (enc_data->has_tmp) { in adxl367_decode_stream()
558 uint8_t offset = (packet_size - 1) * sample_size; in adxl367_decode_stream()
560 adxl367_temp_convert_q31(&data->readings[count].temperature, in adxl367_decode_stream()
561 (buffer + offset), enc_data->fifo_read_mode, 1); in adxl367_decode_stream()
568 data->header.base_timestamp_ns = enc_data->timestamp; in adxl367_decode_stream()
569 data->header.reading_count = 1; in adxl367_decode_stream()
570 data->shift = range_to_shift[enc_data->range]; in adxl367_decode_stream()
572 int ret = adxl367_get_accel(enc_data, data, buffer, count, in adxl367_decode_stream()
583 count++; in adxl367_decode_stream()
587 return count; in adxl367_decode_stream()
594 if (data->fifo_read_mode == ADXL367_12B) { in adxl367_get_frame_count()
595 frame_count = data->fifo_byte_count * 8 / (data->packet_size * 12); in adxl367_get_frame_count()
597 frame_count = data->fifo_byte_count / data->packet_size; in adxl367_get_frame_count()
609 int32_t ret = -ENOTSUP; in adxl367_decoder_get_frame_count()
618 if (!data->is_fifo) { in adxl367_decoder_get_frame_count()
634 if (data->fifo_byte_count == 0) { in adxl367_decoder_get_frame_count()
640 if (data->has_x) { in adxl367_decoder_get_frame_count()
647 if (data->has_y) { in adxl367_decoder_get_frame_count()
654 if (data->has_z) { in adxl367_decoder_get_frame_count()
661 if (data->has_x || data->has_y || data->has_z) { in adxl367_decoder_get_frame_count()
668 if (data->has_tmp) { in adxl367_decoder_get_frame_count()
691 return -ENOTSUP; in adxl367_decode_sample()
696 adxl367_accel_convert(out, data->xyz.x, data->xyz.range); in adxl367_decode_sample()
699 adxl367_accel_convert(out, data->xyz.y, data->xyz.range); in adxl367_decode_sample()
702 adxl367_accel_convert(out, data->xyz.z, data->xyz.range); in adxl367_decode_sample()
705 adxl367_accel_convert(out++, data->xyz.x, data->xyz.range); in adxl367_decode_sample()
706 adxl367_accel_convert(out++, data->xyz.y, data->xyz.range); in adxl367_decode_sample()
707 adxl367_accel_convert(out, data->xyz.z, data->xyz.range); in adxl367_decode_sample()
710 adxl367_temp_convert(out, data->raw_temp); in adxl367_decode_sample()
713 return -ENOTSUP; in adxl367_decode_sample()
727 if (data->is_fifo) { in adxl367_decoder_decode()
739 if (!data->is_fifo) { in adxl367_decoder_has_trigger()
745 return (ADXL367_STATUS_DATA_RDY & data->int_status); in adxl367_decoder_has_trigger()
747 return (ADXL367_STATUS_FIFO_WATERMARK & data->int_status); in adxl367_decoder_has_trigger()
749 return (ADXL367_STATUS_FIFO_WATERMARK & data->int_status); in adxl367_decoder_has_trigger()