프로젝트 정리: 앱 내부 구조 수정 및 레거시 플래시 스크립트 제거
- command/system/measurement - .bat 파일 삭제(nrfprog 세대, nrfutil로 대체됨)
This commit is contained in:
33
pc_firm/.gitignore
vendored
33
pc_firm/.gitignore
vendored
@@ -1,33 +0,0 @@
|
||||
# Compiled binaries
|
||||
*.o
|
||||
*.hex
|
||||
*.bin
|
||||
*.elf
|
||||
*.map
|
||||
*.lst
|
||||
|
||||
# Build directories
|
||||
_build/
|
||||
build/
|
||||
output/
|
||||
|
||||
# IDE/Editor
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Segger/J-Link
|
||||
*.jlink
|
||||
|
||||
# nRF specific
|
||||
*.zip
|
||||
sdk_config.h.bak
|
||||
|
||||
# Windows
|
||||
Thumbs.db
|
||||
desktop.ini
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.bak
|
||||
@@ -1,24 +1,24 @@
|
||||
/* parser.h */
|
||||
#ifndef PARSER_H
|
||||
#define PARSER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Platform-dependent function pointer set */
|
||||
typedef struct {
|
||||
void (*log)(const char *fmt, ...);
|
||||
void (*tx_bin)(const uint8_t *buf, uint16_t len);
|
||||
bool crc_check;
|
||||
} dr_platform_if_t;
|
||||
|
||||
|
||||
/* Global interface & log flag */
|
||||
extern dr_platform_if_t g_plat;
|
||||
extern bool g_log_enable;
|
||||
|
||||
/* Main parser entry point */
|
||||
int dr_cmd_parser(const uint8_t *buf, uint8_t len);
|
||||
|
||||
#endif /* PARSER_H */
|
||||
|
||||
/* parser.h */
|
||||
#ifndef PARSER_H
|
||||
#define PARSER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Platform-dependent function pointer set */
|
||||
typedef struct {
|
||||
void (*log)(const char *fmt, ...);
|
||||
void (*tx_bin)(const uint8_t *buf, uint16_t len);
|
||||
bool crc_check;
|
||||
} dr_platform_if_t;
|
||||
|
||||
|
||||
/* Global interface & log flag */
|
||||
extern dr_platform_if_t g_plat;
|
||||
extern bool g_log_enable;
|
||||
|
||||
/* Main parser entry point */
|
||||
int dr_cmd_parser(const uint8_t *buf, uint8_t len);
|
||||
|
||||
#endif /* PARSER_H */
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
#include "dr_util.h"
|
||||
#include "parser.h"
|
||||
|
||||
extern void single_format_data(uint8_t *buffer, const char *tag, uint16_t value);
|
||||
extern void format_data(uint8_t *buffer, const char *tag, uint16_t *data, uint8_t length);
|
||||
extern uint8_t ble_bin_buffer[];
|
||||
extern void dr_binary_tx_safe(uint8_t const *ble_bin_buff, uint16_t length);
|
||||
|
||||
void dr_ble_return_1(const char *tag, uint16_t value)
|
||||
{
|
||||
single_format_data(ble_bin_buffer, tag, value);
|
||||
dr_binary_tx_safe(ble_bin_buffer, 3); /* Use safe TX with retry */
|
||||
}
|
||||
|
||||
void dr_ble_return_2(const char *tag, uint16_t v1, uint16_t v2)
|
||||
{
|
||||
ble_bin_buffer[0] = tag[0];
|
||||
ble_bin_buffer[1] = tag[1];
|
||||
ble_bin_buffer[2] = tag[2];
|
||||
ble_bin_buffer[3] = tag[3];
|
||||
|
||||
ble_bin_buffer[4] = (uint8_t)(v1 >> 8);
|
||||
ble_bin_buffer[5] = (uint8_t)(v1 & 0xFF);
|
||||
ble_bin_buffer[6] = (uint8_t)(v2 >> 8);
|
||||
ble_bin_buffer[7] = (uint8_t)(v2 & 0xFF);
|
||||
|
||||
dr_binary_tx_safe(ble_bin_buffer, 4); /* Use safe TX with retry */
|
||||
}
|
||||
|
||||
void dr_ble_return_3(const char *tag, uint16_t v1, uint16_t v2, uint16_t v3)
|
||||
{
|
||||
ble_bin_buffer[0] = tag[0];
|
||||
ble_bin_buffer[1] = tag[1];
|
||||
ble_bin_buffer[2] = tag[2];
|
||||
ble_bin_buffer[3] = tag[3];
|
||||
|
||||
ble_bin_buffer[4] = (uint8_t)(v1 >> 8);
|
||||
ble_bin_buffer[5] = (uint8_t)(v1 & 0xFF);
|
||||
ble_bin_buffer[6] = (uint8_t)(v2 >> 8);
|
||||
ble_bin_buffer[7] = (uint8_t)(v2 & 0xFF);
|
||||
ble_bin_buffer[8] = (uint8_t)(v3 >> 8);
|
||||
ble_bin_buffer[9] = (uint8_t)(v3 & 0xFF);
|
||||
|
||||
dr_binary_tx_safe(ble_bin_buffer, 5); /* Use safe TX with retry */
|
||||
}
|
||||
|
||||
void dr_ble_debug(uint16_t point_id, uint16_t value)
|
||||
{
|
||||
/* Use dedicated buffer to avoid conflicts with ble_bin_buffer */
|
||||
static uint8_t dbg_buffer[8];
|
||||
|
||||
dbg_buffer[0] = 'd';
|
||||
dbg_buffer[1] = 'b';
|
||||
dbg_buffer[2] = 'g';
|
||||
dbg_buffer[3] = ':';
|
||||
|
||||
dbg_buffer[4] = (uint8_t)(point_id >> 8);
|
||||
dbg_buffer[5] = (uint8_t)(point_id & 0xFF);
|
||||
dbg_buffer[6] = (uint8_t)(value >> 8);
|
||||
dbg_buffer[7] = (uint8_t)(value & 0xFF);
|
||||
|
||||
dr_binary_tx_safe(dbg_buffer, 4);
|
||||
}
|
||||
|
||||
void dr_ble_return_piezo_1(const char *tag, uint16_t value)
|
||||
{
|
||||
/* Use dedicated buffer for piezo responses to avoid conflicts with ble_bin_buffer */
|
||||
static uint8_t piezo_buffer[8];
|
||||
|
||||
piezo_buffer[0] = tag[0];
|
||||
piezo_buffer[1] = tag[1];
|
||||
piezo_buffer[2] = tag[2];
|
||||
piezo_buffer[3] = tag[3];
|
||||
|
||||
piezo_buffer[4] = (uint8_t)(value >> 8);
|
||||
piezo_buffer[5] = (uint8_t)(value & 0xFF);
|
||||
|
||||
dr_binary_tx_safe(piezo_buffer, 3); /* 6 bytes = 3 words */
|
||||
}
|
||||
#include "dr_util.h"
|
||||
#include "parser.h"
|
||||
|
||||
extern void single_format_data(uint8_t *buffer, const char *tag, uint16_t value);
|
||||
extern void format_data(uint8_t *buffer, const char *tag, uint16_t *data, uint8_t length);
|
||||
extern uint8_t ble_bin_buffer[];
|
||||
extern void dr_binary_tx_safe(uint8_t const *ble_bin_buff, uint16_t length);
|
||||
|
||||
void dr_ble_return_1(const char *tag, uint16_t value)
|
||||
{
|
||||
single_format_data(ble_bin_buffer, tag, value);
|
||||
dr_binary_tx_safe(ble_bin_buffer, 3); /* Use safe TX with retry */
|
||||
}
|
||||
|
||||
void dr_ble_return_2(const char *tag, uint16_t v1, uint16_t v2)
|
||||
{
|
||||
ble_bin_buffer[0] = tag[0];
|
||||
ble_bin_buffer[1] = tag[1];
|
||||
ble_bin_buffer[2] = tag[2];
|
||||
ble_bin_buffer[3] = tag[3];
|
||||
|
||||
ble_bin_buffer[4] = (uint8_t)(v1 >> 8);
|
||||
ble_bin_buffer[5] = (uint8_t)(v1 & 0xFF);
|
||||
ble_bin_buffer[6] = (uint8_t)(v2 >> 8);
|
||||
ble_bin_buffer[7] = (uint8_t)(v2 & 0xFF);
|
||||
|
||||
dr_binary_tx_safe(ble_bin_buffer, 4); /* Use safe TX with retry */
|
||||
}
|
||||
|
||||
void dr_ble_return_3(const char *tag, uint16_t v1, uint16_t v2, uint16_t v3)
|
||||
{
|
||||
ble_bin_buffer[0] = tag[0];
|
||||
ble_bin_buffer[1] = tag[1];
|
||||
ble_bin_buffer[2] = tag[2];
|
||||
ble_bin_buffer[3] = tag[3];
|
||||
|
||||
ble_bin_buffer[4] = (uint8_t)(v1 >> 8);
|
||||
ble_bin_buffer[5] = (uint8_t)(v1 & 0xFF);
|
||||
ble_bin_buffer[6] = (uint8_t)(v2 >> 8);
|
||||
ble_bin_buffer[7] = (uint8_t)(v2 & 0xFF);
|
||||
ble_bin_buffer[8] = (uint8_t)(v3 >> 8);
|
||||
ble_bin_buffer[9] = (uint8_t)(v3 & 0xFF);
|
||||
|
||||
dr_binary_tx_safe(ble_bin_buffer, 5); /* Use safe TX with retry */
|
||||
}
|
||||
|
||||
void dr_ble_debug(uint16_t point_id, uint16_t value)
|
||||
{
|
||||
/* Use dedicated buffer to avoid conflicts with ble_bin_buffer */
|
||||
static uint8_t dbg_buffer[8];
|
||||
|
||||
dbg_buffer[0] = 'd';
|
||||
dbg_buffer[1] = 'b';
|
||||
dbg_buffer[2] = 'g';
|
||||
dbg_buffer[3] = ':';
|
||||
|
||||
dbg_buffer[4] = (uint8_t)(point_id >> 8);
|
||||
dbg_buffer[5] = (uint8_t)(point_id & 0xFF);
|
||||
dbg_buffer[6] = (uint8_t)(value >> 8);
|
||||
dbg_buffer[7] = (uint8_t)(value & 0xFF);
|
||||
|
||||
dr_binary_tx_safe(dbg_buffer, 4);
|
||||
}
|
||||
|
||||
void dr_ble_return_piezo_1(const char *tag, uint16_t value)
|
||||
{
|
||||
/* Use dedicated buffer for piezo responses to avoid conflicts with ble_bin_buffer */
|
||||
static uint8_t piezo_buffer[8];
|
||||
|
||||
piezo_buffer[0] = tag[0];
|
||||
piezo_buffer[1] = tag[1];
|
||||
piezo_buffer[2] = tag[2];
|
||||
piezo_buffer[3] = tag[3];
|
||||
|
||||
piezo_buffer[4] = (uint8_t)(value >> 8);
|
||||
piezo_buffer[5] = (uint8_t)(value & 0xFF);
|
||||
|
||||
dr_binary_tx_safe(piezo_buffer, 3); /* 6 bytes = 3 words */
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
#ifndef DR_UTIL_H
|
||||
#define DR_UTIL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void dr_ble_return_1(const char *tag, uint16_t value);
|
||||
void dr_ble_return_2(const char *tag, uint16_t v1, uint16_t v2);
|
||||
void dr_ble_return_3(const char *tag, uint16_t v1, uint16_t v2, uint16_t v3);
|
||||
void dr_ble_return_3_be(const char *tag, uint16_t v1, uint16_t v2, uint16_t v3);
|
||||
|
||||
/* Piezo dedicated BLE return - uses separate buffer to avoid conflicts */
|
||||
void dr_ble_return_piezo_1(const char *tag, uint16_t value);
|
||||
|
||||
/* BLE debug output - sends "dbg:" + point_id + value */
|
||||
void dr_ble_debug(uint16_t point_id, uint16_t value);
|
||||
|
||||
#endif /* DR_UTIL_H */
|
||||
|
||||
#ifndef DR_UTIL_H
|
||||
#define DR_UTIL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void dr_ble_return_1(const char *tag, uint16_t value);
|
||||
void dr_ble_return_2(const char *tag, uint16_t v1, uint16_t v2);
|
||||
void dr_ble_return_3(const char *tag, uint16_t v1, uint16_t v2, uint16_t v3);
|
||||
void dr_ble_return_3_be(const char *tag, uint16_t v1, uint16_t v2, uint16_t v3);
|
||||
|
||||
/* Piezo dedicated BLE return - uses separate buffer to avoid conflicts */
|
||||
void dr_ble_return_piezo_1(const char *tag, uint16_t value);
|
||||
|
||||
/* BLE debug output - sends "dbg:" + point_id + value */
|
||||
void dr_ble_debug(uint16_t point_id, uint16_t value);
|
||||
|
||||
#endif /* DR_UTIL_H */
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
set CURDIR=%cd%
|
||||
|
||||
|
||||
|
||||
copy ..\pca10056\s140\arm5_no_packs\_build\nrf52840_xxaa.hex medithings_bladder_patch_0001.hex
|
||||
copy ..\..\..\dfu\secure_bootloader\pca10056_s140_ble\arm5_no_packs\_build\nrf52840_xxaa_s140.hex medithings_bladder_patch_bootloader.hex
|
||||
|
||||
nrfutil settings generate --family NRF52840 --application medithings_bladder_patch_0001.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 medithings_bladder_patch_bootloader_setting.hex
|
||||
|
||||
mergehex.exe --merge s140_nrf52_7.2.0_softdevice.hex medithings_bladder_patch_0001.hex --output medithings_bladder_patch_merged_1.hex
|
||||
mergehex.exe --merge medithings_bladder_patch_bootloader.hex medithings_bladder_patch_bootloader_setting.hex --output medithings_bladder_patch_merged_2.hex
|
||||
mergehex.exe --merge medithings_bladder_patch_merged_1.hex medithings_bladder_patch_merged_2.hex --output medithings_bladder_patch_dfu_merged_all.hex
|
||||
|
||||
nrfjprog --family NRF52 --recover
|
||||
nrfjprog --family NRF52 --eraseall
|
||||
nrfjprog --family NRF52 --program medithings_bladder_patch_dfu_merged_all.hex
|
||||
nrfjprog --family NRF52 --reset
|
||||
nrfjprog --family NRF52 --rbp ALL
|
||||
|
||||
|
||||
pause
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
set CURDIR=%cd%
|
||||
|
||||
|
||||
|
||||
copy ..\pca10056\s140\arm5_no_packs\_build\nrf52840_xxaa.hex medithings_bladder_patch_0001.hex
|
||||
copy ..\..\..\dfu\secure_bootloader\pca10056_s140_ble\arm5_no_packs\_build\nrf52840_xxaa_s140.hex medithings_bladder_patch_bootloader.hex
|
||||
|
||||
nrfutil settings generate --family NRF52840 --application medithings_bladder_patch_0001.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 medithings_bladder_patch_bootloader_setting.hex
|
||||
|
||||
mergehex.exe --merge s140_nrf52_7.2.0_softdevice.hex medithings_bladder_patch_0001.hex --output medithings_bladder_patch_merged_1.hex
|
||||
mergehex.exe --merge medithings_bladder_patch_bootloader.hex medithings_bladder_patch_bootloader_setting.hex --output medithings_bladder_patch_merged_2.hex
|
||||
mergehex.exe --merge medithings_bladder_patch_merged_1.hex medithings_bladder_patch_merged_2.hex --output medithings_bladder_patch_dfu_merged_all.hex
|
||||
|
||||
nrfjprog --family NRF52 --recover
|
||||
nrfjprog --family NRF52 --eraseall
|
||||
nrfjprog --family NRF52 --program medithings_bladder_patch_dfu_merged_all.hex
|
||||
|
||||
|
||||
|
||||
pause
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
set CURDIR=%cd%
|
||||
|
||||
|
||||
|
||||
copy ..\pca10056\s140\arm5_no_packs\_build\nrf52840_xxaa.hex medithings_bladder_patch_0001.hex
|
||||
copy ..\..\..\dfu\secure_bootloader\pca10056_s140_ble\arm5_no_packs\_build\nrf52840_xxaa_s140.hex medithings_bladder_patch_bootloader.hex
|
||||
|
||||
nrfutil settings generate --family NRF52840 --application medithings_bladder_patch_0001.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 medithings_bladder_patch_bootloader_setting.hex
|
||||
|
||||
mergehex.exe --merge s140_nrf52_7.2.0_softdevice.hex medithings_bladder_patch_0001.hex --output medithings_bladder_patch_merged_1.hex
|
||||
mergehex.exe --merge medithings_bladder_patch_bootloader.hex medithings_bladder_patch_bootloader_setting.hex --output medithings_bladder_patch_merged_2.hex
|
||||
mergehex.exe --merge medithings_bladder_patch_merged_1.hex medithings_bladder_patch_merged_2.hex --output medithings_bladder_patch_dfu_merged_all.hex
|
||||
|
||||
|
||||
nrfjprog --family NRF52 --eraseall
|
||||
nrfjprog --family NRF52 --program medithings_bladder_patch_dfu_merged_all.hex
|
||||
nrfjprog --family NRF52 --reset
|
||||
nrfjprog --family NRF52 --rbp ALL
|
||||
|
||||
|
||||
pause
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
set CURDIR=%cd%
|
||||
|
||||
|
||||
|
||||
copy ..\pca10056\s140\arm5_no_packs\_build\nrf52840_xxaa.hex medithings_bladder_patch_0001.hex
|
||||
copy ..\..\..\dfu\secure_bootloader\pca10056_s140_ble\arm5_no_packs\_build\nrf52840_xxaa_s140.hex medithings_bladder_patch_bootloader.hex
|
||||
|
||||
nrfutil settings generate --family NRF52840 --application medithings_bladder_patch_0001.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 medithings_bladder_patch_bootloader_setting.hex
|
||||
|
||||
mergehex.exe --merge s140_nrf52_7.2.0_softdevice.hex medithings_bladder_patch_0001.hex --output medithings_bladder_patch_merged_1.hex
|
||||
mergehex.exe --merge medithings_bladder_patch_bootloader.hex medithings_bladder_patch_bootloader_setting.hex --output medithings_bladder_patch_merged_2.hex
|
||||
mergehex.exe --merge medithings_bladder_patch_merged_1.hex medithings_bladder_patch_merged_2.hex --output medithings_bladder_patch_dfu_merged_all.hex
|
||||
|
||||
nrfjprog --family NRF52 --program medithings_bladder_patch_0001.hex
|
||||
nrfjprog --family NRF52 --reset
|
||||
|
||||
|
||||
|
||||
pause
|
||||
@@ -1,3 +0,0 @@
|
||||
set path=d:\nrfutil\bin;%path%
|
||||
d:
|
||||
cd D:\mt_project\vesiscan\project\ble_peripheral\ble_app_bladder_patch\hex
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,276 +1,276 @@
|
||||
/*******************************************************************************
|
||||
* @file dr_piezo.h
|
||||
* @brief Piezo Transducer Driver (2MHz Signal Generator)
|
||||
* @author Charles KWON
|
||||
* @date 2025-12-09
|
||||
*
|
||||
* @note Hardware: nRF52840 + MD1822K6-G MOSFET Driver + TC7920K6-G MOSFET
|
||||
* Output: +/-20V at 2MHz, 3~5 cycles
|
||||
*
|
||||
* @details Timing Sequence:
|
||||
* 1. PE = HIGH (enable)
|
||||
* 2. P_OUT/N_OUT = 2MHz pulses (3~5 cycles)
|
||||
* 3. DMP = HIGH (dump)
|
||||
* 4. DMP = LOW
|
||||
* 5. PE = LOW (disable)
|
||||
*
|
||||
* All signals (P_OUT, N_OUT, DMP) operate within PE HIGH period.
|
||||
******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* [한국어 설명] 피에조 초음파 트랜스듀서 드라이버 헤더
|
||||
*
|
||||
* === 개요 ===
|
||||
* 방광 측정용 초음파 송신기의 핀 할당, 설정값, 함수 선언을 정의.
|
||||
* nRF52840 + MD1822K6-G(MOSFET 드라이버) + TC7920K6-G(MOSFET) 하드웨어 구성.
|
||||
* 출력: +/-20V, 2MHz, 3~7 사이클 버스트.
|
||||
*
|
||||
* === 핀 할당 ===
|
||||
* 전원 제어:
|
||||
* - DR_PIEZO_PWR_EN (P1.9): DC/DC 컨버터 활성화 -> +/-20V 고전압 생성
|
||||
*
|
||||
* TX 신호 핀 (MOSFET 드라이버 제어):
|
||||
* - PE (P0.25): Pulse Enable - 전체 시퀀스 활성화/비활성화
|
||||
* - DMP (P1.0): Dump - 펄스 후 피에조 잔류 에너지 방전
|
||||
* - P_OUT (P1.7): Positive Output - 피에조 양극 구동
|
||||
* - N_OUT (P1.6): Negative Output - 피에조 음극 구동 (P_OUT과 역상)
|
||||
*
|
||||
* MUX 제어 핀 (8채널 에코 신호 경로 선택):
|
||||
* - EN_MUXA (P0.21): MUXA 활성화 (CH0~CH3 담당)
|
||||
* - EN_MUXB (P0.23): MUXB 활성화 (CH4~CH7 담당)
|
||||
* - SEL0 (P1.10): MUX 내부 채널 주소 비트 0
|
||||
* - SEL1 (P0.28): MUX 내부 채널 주소 비트 1
|
||||
*
|
||||
* === MUX 채널 매핑 (8채널) ===
|
||||
* CH0 = MUXA 입력0: EN_A=1, EN_B=0, SEL0=0, SEL1=0
|
||||
* CH1 = MUXA 입력2: EN_A=1, EN_B=0, SEL0=1, SEL1=0
|
||||
* CH2 = MUXA 입력1: EN_A=1, EN_B=0, SEL0=0, SEL1=1
|
||||
* CH3 = MUXA 입력3: EN_A=1, EN_B=0, SEL0=1, SEL1=1
|
||||
* CH4 = MUXB 입력0: EN_A=0, EN_B=1, SEL0=1, SEL1=1
|
||||
* CH5 = MUXB 입력1: EN_A=0, EN_B=1, SEL0=0, SEL1=1
|
||||
* CH6 = MUXB 입력2: EN_A=0, EN_B=1, SEL0=1, SEL1=0
|
||||
* CH7 = MUXB 입력3: EN_A=0, EN_B=1, SEL0=0, SEL1=0
|
||||
*
|
||||
* === 두 가지 버스트 모드 ===
|
||||
* 1) 하드웨어 버스트 (dr_piezo_burst): Timer2 + PPI + GPIOTE 사용, CPU 비의존적
|
||||
* 2) 소프트웨어 버스트 (dr_piezo_burst_sw_XXmhz): CPU NOP 기반 정밀 타이밍
|
||||
* - 주파수별 전용 함수: 1.7/1.8/1.9/2.0/2.1/2.2 MHz
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef DR_PIEZO_H
|
||||
#define DR_PIEZO_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "nrf_gpio.h"
|
||||
|
||||
/*==============================================================================
|
||||
* 전원 제어 핀 (DC/DC 컨버터 +/-20V)
|
||||
* DR_PIEZO_PWR_EN: HIGH로 설정 시 DC/DC 컨버터가 +/-20V 고전압 생성
|
||||
*============================================================================*/
|
||||
#define DR_PIEZO_PWR_EN NRF_GPIO_PIN_MAP(1, 9) /** Power Enable jhChun 0128 */
|
||||
|
||||
/*==============================================================================
|
||||
* TX 신호 핀 (MOSFET 드라이버 제어)
|
||||
* PE: Pulse Enable - 전체 TX 시퀀스 활성화/비활성화
|
||||
* DMP: Dump - 펄스 후 피에조 잔류 에너지 방전용
|
||||
* P_OUT: Positive Output - 피에조 양극 구동 (N_OUT과 역상)
|
||||
* N_OUT: Negative Output - 피에조 음극 구동 (P_OUT과 역상)
|
||||
* 주의: 이전 핀 할당(주석 처리)에서 새 보드 레이아웃으로 변경됨 (jhChun 0128)
|
||||
*============================================================================*/
|
||||
#define DR_PIEZO_PIN_PE NRF_GPIO_PIN_MAP(0, 25) /**< Pulse Enable */ // P1.05 -> P0.25
|
||||
#define DR_PIEZO_PIN_DMP NRF_GPIO_PIN_MAP(1, 0) /**< Dump control */ // P1.9 -> P1.0
|
||||
#define DR_PIEZO_PIN_P_OUT NRF_GPIO_PIN_MAP(1, 7) /**< Positive output */ // P1.3 -> P1.7
|
||||
#define DR_PIEZO_PIN_N_OUT NRF_GPIO_PIN_MAP(1, 6) /**< Negative output */ // P1.2 -> P1.6 jhChun 0128
|
||||
|
||||
/*==============================================================================
|
||||
* MUX 제어 핀 (에코 신호 경로 선택)
|
||||
* 8채널 아날로그 MUX로 피에조 센서 채널을 선택한다.
|
||||
* MUXA(CH0~CH3)와 MUXB(CH4~CH7) 두 개의 4채널 MUX 사용.
|
||||
* EN_MUXA/EN_MUXB: 각 MUX 활성화 (동시에 하나만 HIGH)
|
||||
* SEL0/SEL1: MUX 내부 4채널 중 하나를 선택하는 주소 비트
|
||||
*============================================================================*/
|
||||
/* Piezo MUX pins (8ch) jhChun 0129 */
|
||||
#define DR_PIEZO_EN_MUXA NRF_GPIO_PIN_MAP(0, 21) /**< MUXA Enable */
|
||||
#define DR_PIEZO_EN_MUXB NRF_GPIO_PIN_MAP(0, 23) /**< MUXB Enable */
|
||||
#define DR_PIEZO_MUX_SEL0 NRF_GPIO_PIN_MAP(1, 10) /**< MUX Select 0 */
|
||||
#define DR_PIEZO_MUX_SEL1 NRF_GPIO_PIN_MAP(0, 28) /**< MUX Select 1 */
|
||||
|
||||
/*==============================================================================
|
||||
* 설정값
|
||||
* DR_PIEZO_FREQ_HZ: 목표 주파수 (실제 동작 주파수는 dr_piezo.c에서 결정)
|
||||
* DR_PIEZO_DEFAULT_CYCLES: 기본 버스트 사이클 수 (5)
|
||||
* DR_PIEZO_MIN/MAX_CYCLES: 허용 사이클 범위 (3~7)
|
||||
* DR_PIEZO_MUX_SETTLING_US: MUX 채널 전환 후 아날로그 경로 안정화 대기 시간
|
||||
*============================================================================*/
|
||||
/**
|
||||
* @note Actual operating frequency is defined in dr_piezo.c as PIEZO_FREQ_MHZ.
|
||||
* Change PIEZO_FREQ_MHZ in dr_piezo.c to adjust the burst frequency.
|
||||
* Current setting: 2.1 MHz
|
||||
*/
|
||||
#define DR_PIEZO_FREQ_HZ 2100000 /**< Target frequency (set PIEZO_FREQ_MHZ in .c) */
|
||||
#define DR_PIEZO_DEFAULT_CYCLES 5 /**< Default burst cycles (3~5) */
|
||||
#define DR_PIEZO_MIN_CYCLES 3
|
||||
#define DR_PIEZO_MAX_CYCLES 7
|
||||
#define DR_PIEZO_MUX_SETTLING_US 1300 /**< MUX settling delay (us) */
|
||||
|
||||
/*==============================================================================
|
||||
* 전원 제어 함수
|
||||
* DC/DC 컨버터(+/-20V)를 ON/OFF하여 피에조 구동 고전압을 제어한다.
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Power ON piezo system (+/-20V DC/DC converter)
|
||||
*/
|
||||
void dr_piezo_power_on(void);
|
||||
|
||||
/**
|
||||
* @brief Power OFF piezo system
|
||||
*/
|
||||
void dr_piezo_power_off(void);
|
||||
|
||||
/**
|
||||
* @brief 피에조 전원 상태 확인
|
||||
* @return true: 전원 ON, false: 전원 OFF
|
||||
*/
|
||||
bool dr_piezo_is_power_on(void);
|
||||
|
||||
/*==============================================================================
|
||||
* TX 드라이버 함수
|
||||
* 초음파 송신 관련: 초기화, 버스트 송신, 활성화/비활성화, 주파수 설정
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Initialize piezo TX driver (Timer + PPI + GPIOTE)
|
||||
*/
|
||||
void dr_piezo_init(void);
|
||||
|
||||
/**
|
||||
* @brief Uninitialize piezo TX driver
|
||||
*/
|
||||
void dr_piezo_uninit(void);
|
||||
|
||||
/**
|
||||
* @brief Transmit a burst of 2MHz pulses
|
||||
* @param cycles Number of cycles to transmit (3~10)
|
||||
*/
|
||||
void dr_piezo_burst(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Transmit default burst (5 cycles)
|
||||
*/
|
||||
void dr_piezo_pulse(void);
|
||||
|
||||
/**
|
||||
* @brief Enable TX output (prepare for transmission)
|
||||
*/
|
||||
void dr_piezo_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Disable TX output (return to idle state)
|
||||
*/
|
||||
void dr_piezo_disable(void);
|
||||
|
||||
/**
|
||||
* @brief Check if TX is currently active
|
||||
* @return true if transmitting
|
||||
*/
|
||||
bool dr_piezo_is_busy(void);
|
||||
|
||||
/**
|
||||
* @brief Set TX frequency (for testing)
|
||||
* @param freq_hz Frequency in Hz (100kHz ~ 4MHz)
|
||||
*/
|
||||
void dr_piezo_set_frequency(uint32_t freq_hz);
|
||||
|
||||
/**
|
||||
* @brief Test all pins manually (for debugging with oscilloscope)
|
||||
*/
|
||||
void dr_piezo_test_pins(void);
|
||||
|
||||
/**
|
||||
* @brief Initialize MUX control pins for echo signal path
|
||||
*/
|
||||
void dr_piezo_mux_init(void);
|
||||
|
||||
/**
|
||||
* @brief Select piezo channel (0~7) via 8ch MUX
|
||||
* @param channel Piezo channel number (0~7)
|
||||
*
|
||||
* Channel mapping (EN_MUXA, EN_MUXB, SEL0, SEL1):
|
||||
* CH0=A0(1,0,0,0) CH1=A2(1,0,1,0) CH2=A1(1,0,0,1) CH3=A3(1,0,1,1)
|
||||
* CH4=B0(0,1,1,1) CH5=B1(0,1,0,1) CH6=B2(0,1,1,0) CH7=B3(0,1,0,0)
|
||||
*
|
||||
* @note MUX settling time: 1.3ms delay after switching
|
||||
*/
|
||||
void dr_piezo_select_channel(uint8_t channel);
|
||||
|
||||
/*==============================================================================
|
||||
* 시스템 함수 (전원 + TX 통합 제어)
|
||||
* 전원 ON/OFF와 TX 드라이버 초기화/해제를 한 번에 수행하는 편의 함수.
|
||||
* 소프트웨어 버스트(burst_sw) 계열: CPU NOP 기반 정밀 타이밍.
|
||||
* - Timer/PPI 없이 CPU에서 직접 GPIO를 제어
|
||||
* - 인터럽트 비활성화 상태에서 동작하여 타이밍 정확도 보장
|
||||
* - 주파수별 전용 함수 제공 (NOP 개수가 다름)
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Full system initialization (power + TX driver)
|
||||
*/
|
||||
void dr_piezo_system_init(void);
|
||||
|
||||
/**
|
||||
* @brief Full system shutdown
|
||||
*/
|
||||
void dr_piezo_system_uninit(void);
|
||||
|
||||
/**
|
||||
* @brief Transmit with power check
|
||||
* @param cycles Number of cycles
|
||||
*/
|
||||
void dr_piezo_transmit(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst (CPU-controlled, no Timer/PPI)
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Default frequency: 2.1 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 1.8 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 1.8 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_18mhz(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 2.0 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 2.0 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_20mhz(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 2.2 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 2.2 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_22mhz(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 1.7 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 1.7 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_17mhz(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 1.9 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 1.9 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_19mhz(uint8_t cycles);
|
||||
|
||||
#endif /* DR_PIEZO_H */
|
||||
|
||||
/*******************************************************************************
|
||||
* @file dr_piezo.h
|
||||
* @brief Piezo Transducer Driver (2MHz Signal Generator)
|
||||
* @author Charles KWON
|
||||
* @date 2025-12-09
|
||||
*
|
||||
* @note Hardware: nRF52840 + MD1822K6-G MOSFET Driver + TC7920K6-G MOSFET
|
||||
* Output: +/-20V at 2MHz, 3~5 cycles
|
||||
*
|
||||
* @details Timing Sequence:
|
||||
* 1. PE = HIGH (enable)
|
||||
* 2. P_OUT/N_OUT = 2MHz pulses (3~5 cycles)
|
||||
* 3. DMP = HIGH (dump)
|
||||
* 4. DMP = LOW
|
||||
* 5. PE = LOW (disable)
|
||||
*
|
||||
* All signals (P_OUT, N_OUT, DMP) operate within PE HIGH period.
|
||||
******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* [한국어 설명] 피에조 초음파 트랜스듀서 드라이버 헤더
|
||||
*
|
||||
* === 개요 ===
|
||||
* 방광 측정용 초음파 송신기의 핀 할당, 설정값, 함수 선언을 정의.
|
||||
* nRF52840 + MD1822K6-G(MOSFET 드라이버) + TC7920K6-G(MOSFET) 하드웨어 구성.
|
||||
* 출력: +/-20V, 2MHz, 3~7 사이클 버스트.
|
||||
*
|
||||
* === 핀 할당 ===
|
||||
* 전원 제어:
|
||||
* - DR_PIEZO_PWR_EN (P1.9): DC/DC 컨버터 활성화 -> +/-20V 고전압 생성
|
||||
*
|
||||
* TX 신호 핀 (MOSFET 드라이버 제어):
|
||||
* - PE (P0.25): Pulse Enable - 전체 시퀀스 활성화/비활성화
|
||||
* - DMP (P1.0): Dump - 펄스 후 피에조 잔류 에너지 방전
|
||||
* - P_OUT (P1.7): Positive Output - 피에조 양극 구동
|
||||
* - N_OUT (P1.6): Negative Output - 피에조 음극 구동 (P_OUT과 역상)
|
||||
*
|
||||
* MUX 제어 핀 (8채널 에코 신호 경로 선택):
|
||||
* - EN_MUXA (P0.21): MUXA 활성화 (CH0~CH3 담당)
|
||||
* - EN_MUXB (P0.23): MUXB 활성화 (CH4~CH7 담당)
|
||||
* - SEL0 (P1.10): MUX 내부 채널 주소 비트 0
|
||||
* - SEL1 (P0.28): MUX 내부 채널 주소 비트 1
|
||||
*
|
||||
* === MUX 채널 매핑 (8채널) ===
|
||||
* CH0 = MUXA 입력0: EN_A=1, EN_B=0, SEL0=0, SEL1=0
|
||||
* CH1 = MUXA 입력2: EN_A=1, EN_B=0, SEL0=1, SEL1=0
|
||||
* CH2 = MUXA 입력1: EN_A=1, EN_B=0, SEL0=0, SEL1=1
|
||||
* CH3 = MUXA 입력3: EN_A=1, EN_B=0, SEL0=1, SEL1=1
|
||||
* CH4 = MUXB 입력0: EN_A=0, EN_B=1, SEL0=1, SEL1=1
|
||||
* CH5 = MUXB 입력1: EN_A=0, EN_B=1, SEL0=0, SEL1=1
|
||||
* CH6 = MUXB 입력2: EN_A=0, EN_B=1, SEL0=1, SEL1=0
|
||||
* CH7 = MUXB 입력3: EN_A=0, EN_B=1, SEL0=0, SEL1=0
|
||||
*
|
||||
* === 두 가지 버스트 모드 ===
|
||||
* 1) 하드웨어 버스트 (dr_piezo_burst): Timer2 + PPI + GPIOTE 사용, CPU 비의존적
|
||||
* 2) 소프트웨어 버스트 (dr_piezo_burst_sw_XXmhz): CPU NOP 기반 정밀 타이밍
|
||||
* - 주파수별 전용 함수: 1.7/1.8/1.9/2.0/2.1/2.2 MHz
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef DR_PIEZO_H
|
||||
#define DR_PIEZO_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "nrf_gpio.h"
|
||||
|
||||
/*==============================================================================
|
||||
* 전원 제어 핀 (DC/DC 컨버터 +/-20V)
|
||||
* DR_PIEZO_PWR_EN: HIGH로 설정 시 DC/DC 컨버터가 +/-20V 고전압 생성
|
||||
*============================================================================*/
|
||||
#define DR_PIEZO_PWR_EN NRF_GPIO_PIN_MAP(1, 9) /** Power Enable jhChun 0128 */
|
||||
|
||||
/*==============================================================================
|
||||
* TX 신호 핀 (MOSFET 드라이버 제어)
|
||||
* PE: Pulse Enable - 전체 TX 시퀀스 활성화/비활성화
|
||||
* DMP: Dump - 펄스 후 피에조 잔류 에너지 방전용
|
||||
* P_OUT: Positive Output - 피에조 양극 구동 (N_OUT과 역상)
|
||||
* N_OUT: Negative Output - 피에조 음극 구동 (P_OUT과 역상)
|
||||
* 주의: 이전 핀 할당(주석 처리)에서 새 보드 레이아웃으로 변경됨 (jhChun 0128)
|
||||
*============================================================================*/
|
||||
#define DR_PIEZO_PIN_PE NRF_GPIO_PIN_MAP(0, 25) /**< Pulse Enable */ // P1.05 -> P0.25
|
||||
#define DR_PIEZO_PIN_DMP NRF_GPIO_PIN_MAP(1, 0) /**< Dump control */ // P1.9 -> P1.0
|
||||
#define DR_PIEZO_PIN_P_OUT NRF_GPIO_PIN_MAP(1, 7) /**< Positive output */ // P1.3 -> P1.7
|
||||
#define DR_PIEZO_PIN_N_OUT NRF_GPIO_PIN_MAP(1, 6) /**< Negative output */ // P1.2 -> P1.6 jhChun 0128
|
||||
|
||||
/*==============================================================================
|
||||
* MUX 제어 핀 (에코 신호 경로 선택)
|
||||
* 8채널 아날로그 MUX로 피에조 센서 채널을 선택한다.
|
||||
* MUXA(CH0~CH3)와 MUXB(CH4~CH7) 두 개의 4채널 MUX 사용.
|
||||
* EN_MUXA/EN_MUXB: 각 MUX 활성화 (동시에 하나만 HIGH)
|
||||
* SEL0/SEL1: MUX 내부 4채널 중 하나를 선택하는 주소 비트
|
||||
*============================================================================*/
|
||||
/* Piezo MUX pins (8ch) jhChun 0129 */
|
||||
#define DR_PIEZO_EN_MUXA NRF_GPIO_PIN_MAP(0, 21) /**< MUXA Enable */
|
||||
#define DR_PIEZO_EN_MUXB NRF_GPIO_PIN_MAP(0, 23) /**< MUXB Enable */
|
||||
#define DR_PIEZO_MUX_SEL0 NRF_GPIO_PIN_MAP(1, 10) /**< MUX Select 0 */
|
||||
#define DR_PIEZO_MUX_SEL1 NRF_GPIO_PIN_MAP(0, 28) /**< MUX Select 1 */
|
||||
|
||||
/*==============================================================================
|
||||
* 설정값
|
||||
* DR_PIEZO_FREQ_HZ: 목표 주파수 (실제 동작 주파수는 dr_piezo.c에서 결정)
|
||||
* DR_PIEZO_DEFAULT_CYCLES: 기본 버스트 사이클 수 (5)
|
||||
* DR_PIEZO_MIN/MAX_CYCLES: 허용 사이클 범위 (3~7)
|
||||
* DR_PIEZO_MUX_SETTLING_US: MUX 채널 전환 후 아날로그 경로 안정화 대기 시간
|
||||
*============================================================================*/
|
||||
/**
|
||||
* @note Actual operating frequency is defined in dr_piezo.c as PIEZO_FREQ_MHZ.
|
||||
* Change PIEZO_FREQ_MHZ in dr_piezo.c to adjust the burst frequency.
|
||||
* Current setting: 2.1 MHz
|
||||
*/
|
||||
#define DR_PIEZO_FREQ_HZ 2100000 /**< Target frequency (set PIEZO_FREQ_MHZ in .c) */
|
||||
#define DR_PIEZO_DEFAULT_CYCLES 5 /**< Default burst cycles (3~5) */
|
||||
#define DR_PIEZO_MIN_CYCLES 3
|
||||
#define DR_PIEZO_MAX_CYCLES 7
|
||||
#define DR_PIEZO_MUX_SETTLING_US 1300 /**< MUX settling delay (us) */
|
||||
|
||||
/*==============================================================================
|
||||
* 전원 제어 함수
|
||||
* DC/DC 컨버터(+/-20V)를 ON/OFF하여 피에조 구동 고전압을 제어한다.
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Power ON piezo system (+/-20V DC/DC converter)
|
||||
*/
|
||||
void dr_piezo_power_on(void);
|
||||
|
||||
/**
|
||||
* @brief Power OFF piezo system
|
||||
*/
|
||||
void dr_piezo_power_off(void);
|
||||
|
||||
/**
|
||||
* @brief 피에조 전원 상태 확인
|
||||
* @return true: 전원 ON, false: 전원 OFF
|
||||
*/
|
||||
bool dr_piezo_is_power_on(void);
|
||||
|
||||
/*==============================================================================
|
||||
* TX 드라이버 함수
|
||||
* 초음파 송신 관련: 초기화, 버스트 송신, 활성화/비활성화, 주파수 설정
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Initialize piezo TX driver (Timer + PPI + GPIOTE)
|
||||
*/
|
||||
void dr_piezo_init(void);
|
||||
|
||||
/**
|
||||
* @brief Uninitialize piezo TX driver
|
||||
*/
|
||||
void dr_piezo_uninit(void);
|
||||
|
||||
/**
|
||||
* @brief Transmit a burst of 2MHz pulses
|
||||
* @param cycles Number of cycles to transmit (3~10)
|
||||
*/
|
||||
void dr_piezo_burst(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Transmit default burst (5 cycles)
|
||||
*/
|
||||
void dr_piezo_pulse(void);
|
||||
|
||||
/**
|
||||
* @brief Enable TX output (prepare for transmission)
|
||||
*/
|
||||
void dr_piezo_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Disable TX output (return to idle state)
|
||||
*/
|
||||
void dr_piezo_disable(void);
|
||||
|
||||
/**
|
||||
* @brief Check if TX is currently active
|
||||
* @return true if transmitting
|
||||
*/
|
||||
bool dr_piezo_is_busy(void);
|
||||
|
||||
/**
|
||||
* @brief Set TX frequency (for testing)
|
||||
* @param freq_hz Frequency in Hz (100kHz ~ 4MHz)
|
||||
*/
|
||||
void dr_piezo_set_frequency(uint32_t freq_hz);
|
||||
|
||||
/**
|
||||
* @brief Test all pins manually (for debugging with oscilloscope)
|
||||
*/
|
||||
void dr_piezo_test_pins(void);
|
||||
|
||||
/**
|
||||
* @brief Initialize MUX control pins for echo signal path
|
||||
*/
|
||||
void dr_piezo_mux_init(void);
|
||||
|
||||
/**
|
||||
* @brief Select piezo channel (0~7) via 8ch MUX
|
||||
* @param channel Piezo channel number (0~7)
|
||||
*
|
||||
* Channel mapping (EN_MUXA, EN_MUXB, SEL0, SEL1):
|
||||
* CH0=A0(1,0,0,0) CH1=A2(1,0,1,0) CH2=A1(1,0,0,1) CH3=A3(1,0,1,1)
|
||||
* CH4=B0(0,1,1,1) CH5=B1(0,1,0,1) CH6=B2(0,1,1,0) CH7=B3(0,1,0,0)
|
||||
*
|
||||
* @note MUX settling time: 1.3ms delay after switching
|
||||
*/
|
||||
void dr_piezo_select_channel(uint8_t channel);
|
||||
|
||||
/*==============================================================================
|
||||
* 시스템 함수 (전원 + TX 통합 제어)
|
||||
* 전원 ON/OFF와 TX 드라이버 초기화/해제를 한 번에 수행하는 편의 함수.
|
||||
* 소프트웨어 버스트(burst_sw) 계열: CPU NOP 기반 정밀 타이밍.
|
||||
* - Timer/PPI 없이 CPU에서 직접 GPIO를 제어
|
||||
* - 인터럽트 비활성화 상태에서 동작하여 타이밍 정확도 보장
|
||||
* - 주파수별 전용 함수 제공 (NOP 개수가 다름)
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Full system initialization (power + TX driver)
|
||||
*/
|
||||
void dr_piezo_system_init(void);
|
||||
|
||||
/**
|
||||
* @brief Full system shutdown
|
||||
*/
|
||||
void dr_piezo_system_uninit(void);
|
||||
|
||||
/**
|
||||
* @brief Transmit with power check
|
||||
* @param cycles Number of cycles
|
||||
*/
|
||||
void dr_piezo_transmit(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst (CPU-controlled, no Timer/PPI)
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Default frequency: 2.1 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 1.8 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 1.8 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_18mhz(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 2.0 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 2.0 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_20mhz(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 2.2 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 2.2 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_22mhz(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 1.7 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 1.7 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_17mhz(uint8_t cycles);
|
||||
|
||||
/**
|
||||
* @brief Software-based burst at 1.9 MHz
|
||||
* @param cycles Number of cycles (1~20)
|
||||
* @note Fixed frequency: 1.9 MHz
|
||||
*/
|
||||
void dr_piezo_burst_sw_19mhz(uint8_t cycles);
|
||||
|
||||
#endif /* DR_PIEZO_H */
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\dr_adc121s051\dr_adc121s051.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\dr_adc121s051\dr_adc121s051.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -177,7 +177,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -193,7 +193,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -625,7 +625,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -641,7 +641,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -657,7 +657,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -673,7 +673,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -689,7 +689,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -705,7 +705,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -801,7 +801,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -817,7 +817,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -833,7 +833,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -849,7 +849,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -865,7 +865,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -881,7 +881,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\parser.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\parser.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -897,7 +897,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\dr_adc121s051\dr_adc121s051.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\dr_adc121s051\dr_adc121s051.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -913,7 +913,7 @@
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\..\..\..\..\..\pc_firm\dr_adc121s051\dr_adc121s051.c</Filename>
|
||||
<Filename>C:\jhChun\VesiScan-Basic\pc_firm\dr_adc121s051\dr_adc121s051.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
@@ -1195,7 +1195,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\battery\battery_saadc.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\battery\battery_saadc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>battery_saadc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1207,7 +1207,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\io\power\power_control.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\system\power\power_control.c</PathWithFileName>
|
||||
<FilenameWithoutPath>power_control.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1219,7 +1219,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\temperature\tmp235_q1.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\temperature\tmp235_q1.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tmp235_q1.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1267,7 +1267,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\pc_firm\parser.h</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\command\parser.h</PathWithFileName>
|
||||
<FilenameWithoutPath>parser.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1279,7 +1279,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\pc_firm\parser.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\command\parser.c</PathWithFileName>
|
||||
<FilenameWithoutPath>parser.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1291,7 +1291,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\pc_firm\ble_security\ble_quick_security.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\system\security\ble_quick_security.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ble_quick_security.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1303,7 +1303,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\pc_firm\ble_security\ble_quick_security.h</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\system\security\ble_quick_security.h</PathWithFileName>
|
||||
<FilenameWithoutPath>ble_quick_security.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1315,7 +1315,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\dr_piezo\dr_piezo.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\piezo\dr_piezo.c</PathWithFileName>
|
||||
<FilenameWithoutPath>dr_piezo.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1327,7 +1327,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\dr_piezo\dr_piezo.h</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\piezo\dr_piezo.h</PathWithFileName>
|
||||
<FilenameWithoutPath>dr_piezo.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1339,7 +1339,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\pc_firm\dr_util\dr_util.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\command\util\dr_util.c</PathWithFileName>
|
||||
<FilenameWithoutPath>dr_util.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1351,7 +1351,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\pc_firm\dr_util\dr_util.h</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\command\util\dr_util.h</PathWithFileName>
|
||||
<FilenameWithoutPath>dr_util.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1363,7 +1363,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\pc_firm\dr_adc121s051\dr_adc121s051.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\adc121s051\dr_adc121s051.c</PathWithFileName>
|
||||
<FilenameWithoutPath>dr_adc121s051.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -1375,7 +1375,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\io\led\led_control.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\system\led\led_control.c</PathWithFileName>
|
||||
<FilenameWithoutPath>led_control.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3111,7 +3111,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\system_interface.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\system_interface.c</PathWithFileName>
|
||||
<FilenameWithoutPath>system_interface.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3123,7 +3123,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\Invn\EmbUtils\DataConverter.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\Invn\EmbUtils\DataConverter.c</PathWithFileName>
|
||||
<FilenameWithoutPath>DataConverter.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3135,7 +3135,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\Invn\EmbUtils\ErrorHelper.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\Invn\EmbUtils\ErrorHelper.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ErrorHelper.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3147,7 +3147,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\Invn\EmbUtils\InvBasicMath.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\Invn\EmbUtils\InvBasicMath.c</PathWithFileName>
|
||||
<FilenameWithoutPath>InvBasicMath.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3159,7 +3159,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\Invn\imu\inv_imu_apex.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\Invn\imu\inv_imu_apex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>inv_imu_apex.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3171,7 +3171,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\Invn\imu\inv_imu_driver.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\Invn\imu\inv_imu_driver.c</PathWithFileName>
|
||||
<FilenameWithoutPath>inv_imu_driver.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3183,7 +3183,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\Invn\imu\inv_imu_selftest.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\Invn\imu\inv_imu_selftest.c</PathWithFileName>
|
||||
<FilenameWithoutPath>inv_imu_selftest.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3195,7 +3195,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\Invn\imu\inv_imu_transport.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\Invn\imu\inv_imu_transport.c</PathWithFileName>
|
||||
<FilenameWithoutPath>inv_imu_transport.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3207,7 +3207,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\app_raw\app_raw.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\app_raw\app_raw.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_raw.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@@ -3219,7 +3219,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\sensors\imu\app_raw\app_raw_main.c</PathWithFileName>
|
||||
<PathWithFileName>..\..\..\measurement\imu\app_raw\app_raw_main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_raw_main.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,175 +1,175 @@
|
||||
/**
|
||||
* @file ble_quick_security.c
|
||||
* @brief Ultra-simple BLE Security Configuration Implementation
|
||||
*
|
||||
* Compatible with existing debug_print.h system.
|
||||
*/
|
||||
|
||||
#include "ble_quick_security.h"
|
||||
#include "peer_manager_handler.h"
|
||||
#include "app_error.h"
|
||||
#include <string.h>
|
||||
|
||||
// Use existing debug system
|
||||
#include "debug_print.h"
|
||||
|
||||
// Module state
|
||||
static struct {
|
||||
bool dev_mode;
|
||||
bool bonds_delete_pending;
|
||||
} m_state = {0};
|
||||
|
||||
/**
|
||||
* @brief Initialize BLE security
|
||||
*/
|
||||
void ble_security_quick_init(bool development_mode)
|
||||
{
|
||||
ret_code_t err_code;
|
||||
ble_gap_sec_params_t sec_params;
|
||||
|
||||
// Save mode
|
||||
m_state.dev_mode = development_mode;
|
||||
m_state.bonds_delete_pending = false;
|
||||
|
||||
// Initialize Peer Manager FIRST
|
||||
err_code = pm_init();
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
// Configure security parameters
|
||||
memset(&sec_params, 0, sizeof(ble_gap_sec_params_t));
|
||||
|
||||
if (development_mode) {
|
||||
// ===== DEVELOPMENT MODE: No security =====
|
||||
sec_params.bond = 0; // No bonding
|
||||
sec_params.mitm = 0; // No MITM
|
||||
sec_params.lesc = 0; // No LESC
|
||||
sec_params.keypress = 0;
|
||||
sec_params.io_caps = BLE_GAP_IO_CAPS_NONE; // No passkey
|
||||
sec_params.oob = 0;
|
||||
sec_params.min_key_size = 7;
|
||||
sec_params.max_key_size = 16;
|
||||
|
||||
DBG_PRINTF("DEV MODE: Security DISABLED - Fast connection\r\n");
|
||||
|
||||
// Delete all bonds (async)
|
||||
err_code = pm_peers_delete();
|
||||
if (err_code == NRF_SUCCESS) {
|
||||
m_state.bonds_delete_pending = true;
|
||||
DBG_PRINTF("DEV MODE: Deleting all bonds...\r\n");
|
||||
}
|
||||
} else {
|
||||
// ===== PRODUCTION MODE: Full security =====
|
||||
sec_params.bond = 1; // Enable bonding
|
||||
sec_params.mitm = 1; // Enable MITM
|
||||
sec_params.lesc = 0; // Standard pairing
|
||||
sec_params.keypress = 0;
|
||||
sec_params.io_caps = BLE_GAP_IO_CAPS_DISPLAY_ONLY; // Show passkey
|
||||
sec_params.oob = 0;
|
||||
sec_params.min_key_size = 7;
|
||||
sec_params.max_key_size = 16;
|
||||
sec_params.kdist_own.enc = 1;
|
||||
sec_params.kdist_own.id = 1;
|
||||
sec_params.kdist_peer.enc = 1;
|
||||
sec_params.kdist_peer.id = 1;
|
||||
|
||||
DBG_PRINTF("PROD MODE: Security ENABLED - Full protection\r\n");
|
||||
}
|
||||
|
||||
// Apply security parameters
|
||||
err_code = pm_sec_params_set(&sec_params);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get current mode
|
||||
*/
|
||||
bool ble_security_is_dev_mode(void)
|
||||
{
|
||||
return m_state.dev_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PM event handler
|
||||
*/
|
||||
void ble_security_quick_pm_handler(pm_evt_t const *p_evt)
|
||||
{
|
||||
ret_code_t err_code;
|
||||
|
||||
// DEV 모드: 보안 실패 이벤트는 SDK 핸들러에 전달하지 않음 (disconnect 방지)
|
||||
if (m_state.dev_mode && p_evt->evt_id == PM_EVT_CONN_SEC_FAILED) {
|
||||
DBG_PRINTF("Security failed: error=%d\r\n",
|
||||
p_evt->params.conn_sec_failed.error);
|
||||
DBG_PRINTF("DEV: Ignoring sec failure, keeping connection\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Call standard handlers (required)
|
||||
pm_handler_on_pm_evt(p_evt);
|
||||
pm_handler_flash_clean(p_evt);
|
||||
|
||||
// Handle events
|
||||
switch (p_evt->evt_id) {
|
||||
case PM_EVT_CONN_SEC_SUCCEEDED:
|
||||
if (m_state.dev_mode) {
|
||||
DBG_PRINTF("DEV: Connected (no security)\r\n");
|
||||
} else {
|
||||
DBG_PRINTF("PROD: Link secured (bonded)\r\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_EVT_CONN_SEC_FAILED:
|
||||
DBG_PRINTF("Security failed: error=%d\r\n",
|
||||
p_evt->params.conn_sec_failed.error);
|
||||
|
||||
if (m_state.dev_mode) {
|
||||
// DEV 모드: 보안 실패 무시 — 연결 유지
|
||||
DBG_PRINTF("DEV: Ignoring sec failure, keeping connection\r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (p_evt->params.conn_sec_failed.error == PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING) {
|
||||
// Key missing: 재페어링 시도, 실패 시 disconnect로 폴백
|
||||
err_code = pm_conn_secure(p_evt->conn_handle, true);
|
||||
if (err_code != NRF_ERROR_INVALID_STATE &&
|
||||
err_code != NRF_ERROR_BUSY &&
|
||||
err_code != BLE_ERROR_INVALID_CONN_HANDLE) {
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
// 재페어링 불가 → disconnect
|
||||
pm_handler_disconnect_on_sec_failure(p_evt);
|
||||
}
|
||||
} else {
|
||||
// 기타 보안 실패 → bond 삭제 후 재페어링 시도
|
||||
pm_peer_id_t peer_id;
|
||||
if (pm_peer_id_get(p_evt->conn_handle, &peer_id) == NRF_SUCCESS
|
||||
&& peer_id != PM_PEER_ID_INVALID) {
|
||||
pm_peer_delete(peer_id);
|
||||
}
|
||||
err_code = pm_conn_secure(p_evt->conn_handle, true);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
pm_handler_disconnect_on_sec_failure(p_evt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_EVT_CONN_SEC_CONFIG_REQ:
|
||||
{
|
||||
pm_conn_sec_config_t config = {
|
||||
.allow_repairing = true
|
||||
};
|
||||
pm_conn_sec_config_reply(p_evt->conn_handle, &config);
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_EVT_PEERS_DELETE_SUCCEEDED:
|
||||
if (m_state.bonds_delete_pending) {
|
||||
m_state.bonds_delete_pending = false;
|
||||
DBG_PRINTF("DEV MODE: Bonds cleared!\r\n");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @file ble_quick_security.c
|
||||
* @brief Ultra-simple BLE Security Configuration Implementation
|
||||
*
|
||||
* Compatible with existing debug_print.h system.
|
||||
*/
|
||||
|
||||
#include "ble_quick_security.h"
|
||||
#include "peer_manager_handler.h"
|
||||
#include "app_error.h"
|
||||
#include <string.h>
|
||||
|
||||
// Use existing debug system
|
||||
#include "debug_print.h"
|
||||
|
||||
// Module state
|
||||
static struct {
|
||||
bool dev_mode;
|
||||
bool bonds_delete_pending;
|
||||
} m_state = {0};
|
||||
|
||||
/**
|
||||
* @brief Initialize BLE security
|
||||
*/
|
||||
void ble_security_quick_init(bool development_mode)
|
||||
{
|
||||
ret_code_t err_code;
|
||||
ble_gap_sec_params_t sec_params;
|
||||
|
||||
// Save mode
|
||||
m_state.dev_mode = development_mode;
|
||||
m_state.bonds_delete_pending = false;
|
||||
|
||||
// Initialize Peer Manager FIRST
|
||||
err_code = pm_init();
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
// Configure security parameters
|
||||
memset(&sec_params, 0, sizeof(ble_gap_sec_params_t));
|
||||
|
||||
if (development_mode) {
|
||||
// ===== DEVELOPMENT MODE: No security =====
|
||||
sec_params.bond = 0; // No bonding
|
||||
sec_params.mitm = 0; // No MITM
|
||||
sec_params.lesc = 0; // No LESC
|
||||
sec_params.keypress = 0;
|
||||
sec_params.io_caps = BLE_GAP_IO_CAPS_NONE; // No passkey
|
||||
sec_params.oob = 0;
|
||||
sec_params.min_key_size = 7;
|
||||
sec_params.max_key_size = 16;
|
||||
|
||||
DBG_PRINTF("DEV MODE: Security DISABLED - Fast connection\r\n");
|
||||
|
||||
// Delete all bonds (async)
|
||||
err_code = pm_peers_delete();
|
||||
if (err_code == NRF_SUCCESS) {
|
||||
m_state.bonds_delete_pending = true;
|
||||
DBG_PRINTF("DEV MODE: Deleting all bonds...\r\n");
|
||||
}
|
||||
} else {
|
||||
// ===== PRODUCTION MODE: Full security =====
|
||||
sec_params.bond = 1; // Enable bonding
|
||||
sec_params.mitm = 1; // Enable MITM
|
||||
sec_params.lesc = 0; // Standard pairing
|
||||
sec_params.keypress = 0;
|
||||
sec_params.io_caps = BLE_GAP_IO_CAPS_DISPLAY_ONLY; // Show passkey
|
||||
sec_params.oob = 0;
|
||||
sec_params.min_key_size = 7;
|
||||
sec_params.max_key_size = 16;
|
||||
sec_params.kdist_own.enc = 1;
|
||||
sec_params.kdist_own.id = 1;
|
||||
sec_params.kdist_peer.enc = 1;
|
||||
sec_params.kdist_peer.id = 1;
|
||||
|
||||
DBG_PRINTF("PROD MODE: Security ENABLED - Full protection\r\n");
|
||||
}
|
||||
|
||||
// Apply security parameters
|
||||
err_code = pm_sec_params_set(&sec_params);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get current mode
|
||||
*/
|
||||
bool ble_security_is_dev_mode(void)
|
||||
{
|
||||
return m_state.dev_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PM event handler
|
||||
*/
|
||||
void ble_security_quick_pm_handler(pm_evt_t const *p_evt)
|
||||
{
|
||||
ret_code_t err_code;
|
||||
|
||||
// DEV 모드: 보안 실패 이벤트는 SDK 핸들러에 전달하지 않음 (disconnect 방지)
|
||||
if (m_state.dev_mode && p_evt->evt_id == PM_EVT_CONN_SEC_FAILED) {
|
||||
DBG_PRINTF("Security failed: error=%d\r\n",
|
||||
p_evt->params.conn_sec_failed.error);
|
||||
DBG_PRINTF("DEV: Ignoring sec failure, keeping connection\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Call standard handlers (required)
|
||||
pm_handler_on_pm_evt(p_evt);
|
||||
pm_handler_flash_clean(p_evt);
|
||||
|
||||
// Handle events
|
||||
switch (p_evt->evt_id) {
|
||||
case PM_EVT_CONN_SEC_SUCCEEDED:
|
||||
if (m_state.dev_mode) {
|
||||
DBG_PRINTF("DEV: Connected (no security)\r\n");
|
||||
} else {
|
||||
DBG_PRINTF("PROD: Link secured (bonded)\r\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_EVT_CONN_SEC_FAILED:
|
||||
DBG_PRINTF("Security failed: error=%d\r\n",
|
||||
p_evt->params.conn_sec_failed.error);
|
||||
|
||||
if (m_state.dev_mode) {
|
||||
// DEV 모드: 보안 실패 무시 — 연결 유지
|
||||
DBG_PRINTF("DEV: Ignoring sec failure, keeping connection\r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (p_evt->params.conn_sec_failed.error == PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING) {
|
||||
// Key missing: 재페어링 시도, 실패 시 disconnect로 폴백
|
||||
err_code = pm_conn_secure(p_evt->conn_handle, true);
|
||||
if (err_code != NRF_ERROR_INVALID_STATE &&
|
||||
err_code != NRF_ERROR_BUSY &&
|
||||
err_code != BLE_ERROR_INVALID_CONN_HANDLE) {
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
// 재페어링 불가 → disconnect
|
||||
pm_handler_disconnect_on_sec_failure(p_evt);
|
||||
}
|
||||
} else {
|
||||
// 기타 보안 실패 → bond 삭제 후 재페어링 시도
|
||||
pm_peer_id_t peer_id;
|
||||
if (pm_peer_id_get(p_evt->conn_handle, &peer_id) == NRF_SUCCESS
|
||||
&& peer_id != PM_PEER_ID_INVALID) {
|
||||
pm_peer_delete(peer_id);
|
||||
}
|
||||
err_code = pm_conn_secure(p_evt->conn_handle, true);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
pm_handler_disconnect_on_sec_failure(p_evt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_EVT_CONN_SEC_CONFIG_REQ:
|
||||
{
|
||||
pm_conn_sec_config_t config = {
|
||||
.allow_repairing = true
|
||||
};
|
||||
pm_conn_sec_config_reply(p_evt->conn_handle, &config);
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_EVT_PEERS_DELETE_SUCCEEDED:
|
||||
if (m_state.bonds_delete_pending) {
|
||||
m_state.bonds_delete_pending = false;
|
||||
DBG_PRINTF("DEV MODE: Bonds cleared!\r\n");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,56 @@
|
||||
/**
|
||||
* @file ble_quick_security.h
|
||||
* @brief Ultra-simple BLE Security Configuration
|
||||
*
|
||||
* ONE function call to control entire security behavior.
|
||||
* Works with existing debug_print.h system.
|
||||
*/
|
||||
|
||||
#ifndef BLE_QUICK_SECURITY_H
|
||||
#define BLE_QUICK_SECURITY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "peer_manager.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize BLE security with ONE simple parameter
|
||||
*
|
||||
* @param[in] development_mode true (1) = Fast development (no security)
|
||||
* false (0) = Production (full security)
|
||||
*
|
||||
* Development mode (1):
|
||||
* - No pairing/bonding required
|
||||
* - Auto-deletes all bonds on startup
|
||||
* - Instant connection
|
||||
* - Fast iteration
|
||||
*
|
||||
* Production mode (0):
|
||||
* - Full security with passkey
|
||||
* - Bonding preserved
|
||||
* - MITM protection
|
||||
* - Secure deployment
|
||||
*
|
||||
* Usage in main.c:
|
||||
* #define BLE_DEV_MODE 1 // or 0
|
||||
* ble_security_quick_init(BLE_DEV_MODE);
|
||||
*/
|
||||
void ble_security_quick_init(bool development_mode);
|
||||
|
||||
/**
|
||||
* @brief Get current mode
|
||||
* @return true if in development mode, false if production
|
||||
*/
|
||||
bool ble_security_is_dev_mode(void);
|
||||
|
||||
/**
|
||||
* @brief Peer Manager event handler
|
||||
*
|
||||
* Call this from your pm_evt_handler() function.
|
||||
* It handles all security events automatically.
|
||||
*
|
||||
* @param[in] p_evt Peer Manager event
|
||||
*/
|
||||
void ble_security_quick_pm_handler(pm_evt_t const *p_evt);
|
||||
|
||||
#endif // BLE_QUICK_SECURITY_H
|
||||
/**
|
||||
* @file ble_quick_security.h
|
||||
* @brief Ultra-simple BLE Security Configuration
|
||||
*
|
||||
* ONE function call to control entire security behavior.
|
||||
* Works with existing debug_print.h system.
|
||||
*/
|
||||
|
||||
#ifndef BLE_QUICK_SECURITY_H
|
||||
#define BLE_QUICK_SECURITY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "peer_manager.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize BLE security with ONE simple parameter
|
||||
*
|
||||
* @param[in] development_mode true (1) = Fast development (no security)
|
||||
* false (0) = Production (full security)
|
||||
*
|
||||
* Development mode (1):
|
||||
* - No pairing/bonding required
|
||||
* - Auto-deletes all bonds on startup
|
||||
* - Instant connection
|
||||
* - Fast iteration
|
||||
*
|
||||
* Production mode (0):
|
||||
* - Full security with passkey
|
||||
* - Bonding preserved
|
||||
* - MITM protection
|
||||
* - Secure deployment
|
||||
*
|
||||
* Usage in main.c:
|
||||
* #define BLE_DEV_MODE 1 // or 0
|
||||
* ble_security_quick_init(BLE_DEV_MODE);
|
||||
*/
|
||||
void ble_security_quick_init(bool development_mode);
|
||||
|
||||
/**
|
||||
* @brief Get current mode
|
||||
* @return true if in development mode, false if production
|
||||
*/
|
||||
bool ble_security_is_dev_mode(void);
|
||||
|
||||
/**
|
||||
* @brief Peer Manager event handler
|
||||
*
|
||||
* Call this from your pm_evt_handler() function.
|
||||
* It handles all security events automatically.
|
||||
*
|
||||
* @param[in] p_evt Peer Manager event
|
||||
*/
|
||||
void ble_security_quick_pm_handler(pm_evt_t const *p_evt);
|
||||
|
||||
#endif // BLE_QUICK_SECURITY_H
|
||||
@@ -133,7 +133,7 @@
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<Capability>0</Capability>
|
||||
<DriverSelection>4099</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
|
||||
Reference in New Issue
Block a user