Piezo 측정 파라미터 공용 헤더 추가 및 최대 샘플 수 118개로 변경

- reb: 패킷에 채널 정보 2바이트가 추가되어 단일 패킷 최대 샘플 수를 119개에서 118개로 조정
This commit is contained in:
2026-06-26 17:40:05 +09:00
parent 80d7086d09
commit 763abb0fcc
5 changed files with 61 additions and 28 deletions
@@ -30,6 +30,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "nrf_gpio.h"
#include "../piezo/piezo_config.h"
/*==============================================================================
* PIN CONFIGURATION
@@ -73,8 +74,8 @@
*============================================================================*/
#define DR_ADC_SCLK_MHZ 8.6f /**< SPI bit-bang SCLK frequency */
#define DR_ADC_CLOCKS_PER_SAMPLE 16 /**< ADC121S051: 16 SCLK per sample */
#define DR_ADC_ECHO_SAMPLES_MAX 119 /**< Maximum samples */
#define DR_ADC_ECHO_SAMPLES_DEFAULT 100 /**< Default samples */
#define DR_ADC_ECHO_SAMPLES_MAX PIEZO_CONFIG_NUM_SAMPLES_MAX /**< Maximum samples */
#define DR_ADC_ECHO_SAMPLES_DEFAULT PIEZO_CONFIG_NUM_SAMPLES_DEFAULT /**< Default samples */
#define DR_ADC_SAMPLE_INTERVAL_US 1.86f /**< 16 / 8.6MHz = 1.86us per sample */
#define DR_ADC_SOUND_SPEED_MM_US 1.54f /**< Sound speed in tissue (mm/us) */
@@ -32,6 +32,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "nrf_gpio.h"
#include "piezo_config.h"
/*==============================================================================
* Power control pin (+/-20V DC/DC converter)
@@ -64,9 +65,9 @@
* Configuration
*============================================================================*/
#define DR_PIEZO_FREQ_HZ 2100000 /**< Target frequency (set PIEZO_FREQ_MHZ in .c) */
#define DR_PIEZO_DEFAULT_CYCLES 5 /**< Default burst cycles */
#define DR_PIEZO_MIN_CYCLES 3
#define DR_PIEZO_MAX_CYCLES 7
#define DR_PIEZO_DEFAULT_CYCLES PIEZO_CONFIG_CYCLES_DEFAULT /**< Default burst cycles */
#define DR_PIEZO_MIN_CYCLES PIEZO_CONFIG_CYCLES_MIN
#define DR_PIEZO_MAX_CYCLES PIEZO_CONFIG_CYCLES_MAX
#define DR_PIEZO_MUX_SETTLING_US 1300 /**< MUX settling delay (us) */
/*==============================================================================
@@ -0,0 +1,29 @@
/*==============================================================================
* piezo_config.h - Shared piezo measurement parameter limits/defaults
*============================================================================*/
#ifndef PIEZO_CONFIG_H
#define PIEZO_CONFIG_H
/* Frequency option protocol:
* 0=1.8MHz, 1=2.1MHz, 2=2.0MHz, 3=1.7MHz, 4=2.2MHz, 9=1.9MHz
*/
#define PIEZO_CONFIG_FREQ_OPTION_DEFAULT 1U
#define PIEZO_CONFIG_CYCLES_MIN 3U
#define PIEZO_CONFIG_CYCLES_MAX 7U
#define PIEZO_CONFIG_CYCLES_DEFAULT 7U
#define PIEZO_CONFIG_AVERAGING_MIN 1U
#define PIEZO_CONFIG_AVERAGING_MAX 10U
#define PIEZO_CONFIG_AVERAGING_DEFAULT 10U
#define PIEZO_CONFIG_DELAY_US_MIN 0U
#define PIEZO_CONFIG_DELAY_US_MAX 50U
#define PIEZO_CONFIG_DELAY_US_DEFAULT 10U
#define PIEZO_CONFIG_NUM_SAMPLES_MIN 80U
#define PIEZO_CONFIG_NUM_SAMPLES_MAX 118U
#define PIEZO_CONFIG_NUM_SAMPLES_DEFAULT 100U
#endif /* PIEZO_CONFIG_H */