코드 정리
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* @file battery_adc.c
|
||||
* @brief Battery voltage ADC measurement (Zephyr devicetree 기반)
|
||||
* @brief Battery voltage ADC measurement
|
||||
*
|
||||
* ADC 채널 설정은 디바이스트리 overlay에서 관리:
|
||||
* - AIN2 (P0.04), Single-ended
|
||||
@@ -11,8 +11,9 @@
|
||||
*
|
||||
* 동작 모드:
|
||||
* - 단독 측정 (msn? 커맨드) → battery_read_mv() 호출
|
||||
* - 주기 모니터링 (60초) → 저전압 10회 연속 시 자동 전원 OFF
|
||||
* - info4 모드 (mbb?) → info_batt에 저장
|
||||
* - 주기 모니터링 (60초) → 저전압 또는 고온 5회 연속 시 자동 전원 OFF
|
||||
* - 측정 중(processing) 또는 IMU FIFO 동작 중에는 주기 모니터링 스킵
|
||||
* - mbb? 측정 응답 -> parser에서 battery_read_mv() 호출 후 패킷에 포함
|
||||
******************************************************************************/
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/drivers/adc.h>
|
||||
@@ -51,13 +52,10 @@ static uint8_t high_temperature_cnt = 0;
|
||||
#define BATTERY_MONITOR_INTERVAL_MS 60000 /* 60초 주기 */
|
||||
|
||||
/*==============================================================================
|
||||
* 전압 변환
|
||||
*============================================================================*/
|
||||
|
||||
/** @brief ADC raw → mV 변환
|
||||
* 전압 변환 (ADC raw → mV 변환)
|
||||
* 공식: (raw × 600 / 4095) × 6 × 1.42
|
||||
* 정수 연산: raw × 600 × 6 × 142 / (4095 × 100) */
|
||||
|
||||
* 정수 연산: raw × 600 × 6 × 142 / (4095 × 100)
|
||||
*============================================================================*/
|
||||
static int adc_raw_to_mv(int16_t raw)
|
||||
{
|
||||
if (raw < 0)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* @brief Battery voltage ADC measurement (Zephyr port)
|
||||
*
|
||||
* AIN2 채널, 12-bit, 1/6 gain, 4X oversample
|
||||
* 저전압(3500mV) 10회 연속 감지 시 자동 전원 OFF
|
||||
* 저전압(3500mV) 5회 연속 감지 시 자동 전원 OFF
|
||||
******************************************************************************/
|
||||
#ifndef BATTERY_ADC_H__
|
||||
#define BATTERY_ADC_H__
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* @file imu_i2c.c
|
||||
* @brief ICM42670P IMU 드라이버 (Zephyr I2C API)
|
||||
*
|
||||
* 기존 VesiScan-Basic(nRF5 SDK)의 imu_read_direct()를 Zephyr로 포팅.
|
||||
* @brief ICM42670P IMU Driver (Zephyr I2C API)
|
||||
*
|
||||
* 동작 방식 (매 측정 시):
|
||||
* 1) GYRO_CONFIG0 = 0x09 → ±2000dps, 100Hz ODR
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
* @file imu_i2c.h
|
||||
* @brief ICM42670P IMU 드라이버 (Zephyr I2C API)
|
||||
*
|
||||
* 기존 VesiScan-Basic(nRF5 SDK)의 imu_read_direct() 방식을 Zephyr로 포팅.
|
||||
* 드라이버 API 없이 직접 I2C 레지스터 읽기/쓰기 방식 사용.
|
||||
*
|
||||
* 핀 배치:
|
||||
* SCL: P1.14
|
||||
* SDA: P1.15
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* @file led_control.c
|
||||
* @brief LED direct control driver (Zephyr port)
|
||||
* @brief LED direct control driver
|
||||
*
|
||||
* k_timer based 2-color LED (green/orange) pattern control
|
||||
* Simple on/off states use immediate GPIO, complex patterns use state machine
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* @file led_control.h
|
||||
* @brief LED direct control driver (Zephyr port)
|
||||
* @brief LED direct control driver
|
||||
*
|
||||
* Green (P0.12) + Orange (P0.29) 2-color LED with k_timer based patterns
|
||||
******************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user