shit-202408082000

This commit is contained in:
hulk
2024-08-08 19:59:43 +08:00
parent f526aa2b8f
commit ea9e742e72
6 changed files with 48 additions and 66 deletions

View File

@@ -70,12 +70,10 @@ typedef struct {
uint16_t amplitude; // from ch_get_amplitude()
uint16_t num_samples; // from ch_get_num_samples()
#ifdef READ_AMPLITUDE_DATA
uint16_t amp_data[DATA_MAX_NUM_SAMPLES];
// from ch_get_amplitude_data()
uint16_t amp_data[DATA_MAX_NUM_SAMPLES]; // from ch_get_amplitude_data()
#endif
#ifdef READ_IQ_DATA
ch_iq_sample_t iq_data[DATA_MAX_NUM_SAMPLES];
// from ch_get_iq_data()
ch_iq_sample_t iq_data[DATA_MAX_NUM_SAMPLES]; // from ch_get_iq_data()
#endif
} chirp_data_t;
@@ -148,12 +146,18 @@ int main(void)
printf(" SonicLib version: %u.%u.%u\n", SONICLIB_VER_MAJOR, SONICLIB_VER_MINOR, SONICLIB_VER_REV);
printf("\n");
#ifdef DEBUG_VERBOES
/* print out the clock frequency of system, AHB, APB1 and APB2 */
printf("[DebugVerboes] System CLK Info!!!");
printf("\r\nCK_SYS is %d", rcu_clock_freq_get(CK_SYS));
printf("\r\nCK_AHB is %d", rcu_clock_freq_get(CK_AHB));
printf("\r\nCK_APB1 is %d", rcu_clock_freq_get(CK_APB1));
printf("\r\nCK_APB2 is %d", rcu_clock_freq_get(CK_APB2));
printf("[DebugVerboes] System CLK Info Done!!!");
printf("\r\n");
printf("\r\n");
printf("\r\n");
#endif
/* Get the number of sensor devices on the board*/
num_ports = ch_get_num_ports(grp_ptr);
@@ -178,7 +182,6 @@ int main(void)
printf("\n");
printf("Sensor\tType \t Freq\t\t RTC Cal \tFirmware\n");
for (dev_num = 0; dev_num < num_ports; dev_num++) {
ch_dev_t *dev_ptr = ch_get_dev_ptr(grp_ptr, dev_num);
@@ -263,30 +266,26 @@ int main(void)
// * handler when the interrupt occurs. The callback function will be
// * used to trigger a measurement cycle on the group of sensors.
// */
// if (num_triggered_devices > 0) {
// printf("Initializing sample timer for %dms interval... ", MEASUREMENT_INTERVAL_MS);
if (num_triggered_devices > 0) {
printf("Initializing sample timer for %dms interval... ", MEASUREMENT_INTERVAL_MS);
// chbsp_periodic_timer_init(MEASUREMENT_INTERVAL_MS, periodic_timer_callback);
// /* Enable interrupt and start timer to trigger sensor sampling */
/* Enable interrupt and start timer to trigger sensor sampling */
// chbsp_periodic_timer_irq_enable();
// chbsp_periodic_timer_start();
// printf("OK\n");
// }
printf("OK\n");
}
printf("Starting measurements\n");
while (1)
{
handle_data_ready(grp_ptr);
gpio_bit_toggle(CHIRP_PIN_LED_PORT, CHIRP_PIN_LED_PIN);
delay_ms(TestDelayTime);
chbsp_led_toggle(dev_num);
delay_ms(MEASUREMENT_INTERVAL_MS);
}
}
/*
* periodic_timer_callback() - periodic timer callback routine
*
@@ -425,7 +424,6 @@ static uint8_t handle_data_ready(ch_group_t *grp_ptr) {
} else {
/* Target object was successfully detected (range available) */
/* Get the new amplitude value - it's only updated if range
* was successfully measured. */
chirp_data[dev_num].amplitude = ch_get_amplitude(dev_ptr);