IMU 측정, 커맨드 및 응답 추가

This commit is contained in:
geniushyun
2026-04-12 18:42:54 +09:00
parent 8dcf4adf31
commit 6ac0490263
7 changed files with 250 additions and 1 deletions
+26 -1
View File
@@ -5,13 +5,17 @@
* Pin mapping:
* POWER_HOLD: P0.08 (output, active high - latches power)
* POWER_BTN: P1.08 (input, active low - pressed = LOW)
* LED_BLE: P0.12 (output, active low)
* LED_BLE: P0.12 (output, active low)
* LED_ORANGE: P0.29 (output, active low)
* BATT_ADC: P0.04 (AIN2, battery voltage measurement)
* IMU_SCL: P1.14 (I2C0 clock)
* IMU_SDA: P1.15 (I2C0 data)
*/
#include <zephyr/dt-bindings/adc/adc.h>
#include <zephyr/dt-bindings/adc/nrf-saadc.h>
/* nRF 핀 컨트롤 매크로 (NRF_PSEL - I2C/SPI 등 핀 재배치에 필요) */
#include <zephyr/dt-bindings/pinctrl/nrf-pinctrl.h>
/* P0.08이 DK 기본 UART0 RX로 잡혀있어서 GPIO 출력 충돌 → 비활성화 */
&uart0
@@ -19,6 +23,27 @@
status = "disabled";
};
/* I2C0 핀 재설정: ICM42670P IMU (SCL=P1.14, SDA=P1.15) */
&i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 1, 14)>,
<NRF_PSEL(TWIM_SDA, 1, 15)>;
};
};
&i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 1, 14)>,
<NRF_PSEL(TWIM_SDA, 1, 15)>;
low-power-enable;
};
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
};
/* 배터리 ADC 채널 설정 (AIN2 = P0.04) */
&adc
{