reb: 패킷 ADC 데이터 샘플 수 80~117 정의 및 검증
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define ECHO_ADC_MAX_SAMPLES 100
|
#define ECHO_ADC_MAX_SAMPLES 117
|
||||||
|
|
||||||
int echo_adc_init(void);
|
int echo_adc_init(void);
|
||||||
int echo_adc_wake(void);
|
int echo_adc_wake(void);
|
||||||
|
|||||||
+4
-1
@@ -45,6 +45,8 @@
|
|||||||
#define PIEZO_CFG_AVG_DEFAULT 3
|
#define PIEZO_CFG_AVG_DEFAULT 3
|
||||||
|
|
||||||
#define PIEZO_CFG_AVG_MAX 10
|
#define PIEZO_CFG_AVG_MAX 10
|
||||||
|
#define PIEZO_CFG_SAMPLES_MIN 80
|
||||||
|
#define PIEZO_CFG_SAMPLES_MAX 117
|
||||||
#define PIEZO_CFG_DELAY_MAX_US 50
|
#define PIEZO_CFG_DELAY_MAX_US 50
|
||||||
#define PIEZO_POST_SELECT_SETTLE_US 500
|
#define PIEZO_POST_SELECT_SETTLE_US 500
|
||||||
#define PIEZO_AVG_INTER_BURST_GAP_US 500
|
#define PIEZO_AVG_INTER_BURST_GAP_US 500
|
||||||
@@ -98,7 +100,8 @@ static bool piezo_config_validate(const piezo_config_t *cfg)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cfg->samples == 0U) || (cfg->samples > ECHO_ADC_MAX_SAMPLES))
|
if ((cfg->samples < PIEZO_CFG_SAMPLES_MIN) ||
|
||||||
|
(cfg->samples > PIEZO_CFG_SAMPLES_MAX))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user