- Zephyr 기반 제어 방식
This commit is contained in:
2026-06-12 16:33:22 +09:00
parent c6f05fa802
commit 1bc73fa2b8
2 changed files with 415 additions and 0 deletions
+36
View File
@@ -16,6 +16,9 @@
#include <stdint.h>
#define IMU_FIFO_SAMPLE_BYTES 12U
#define IMU_FIFO_RIM_TARGET_SAMPLES 15U
/**
* @brief IMU 초기화 — I2C 버스 준비 및 WHOAMI 확인
* @return 0 성공, 음수 에러
@@ -33,4 +36,37 @@ int imu_init(void);
*/
int imu_read(int16_t accel[3], int16_t gyro[3]);
/**
* @brief IMU FIFO 캡처 시작
*
* Accel/Gyro 50Hz, Low Noise, FIFO stream 모드로 설정하고 FIFO를 비운다.
*
* @return 0 성공, 음수 에러
*/
int imu_fifo_start(void);
/**
* @brief 실행 중인 FIFO에서 최신 샘플 읽기
*
* 각 샘플은 accel XYZ 6B + gyro XYZ 6B, 총 12B이다.
* 함수 종료 후에도 FIFO와 accel/gyro는 계속 동작한다.
*
* @param sample_bytes 12B 샘플이 연속 저장될 버퍼
* @param max_samples 버퍼에 담을 최대 샘플 수
* @param out_count 실제 저장한 샘플 수
* @return 0 성공, 음수 에러
*/
int imu_fifo_read_latest(uint8_t *sample_bytes,
uint16_t max_samples,
uint16_t *out_count);
/**
* @brief FIFO와 accel/gyro 전원 끄기
*
* 켜져 있지 않으면 아무 작업 없이 성공 처리한다.
*
* @return 0 성공, 음수 에러
*/
int imu_fifo_stop(void);
#endif /* IMU_I2C_H__ */