mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Simple start analog wathdog
Add 900kHz i2c setting
This commit is contained in:
parent
068faa8879
commit
7f34a93067
4
adc.c
4
adc.c
|
|
@ -108,14 +108,14 @@ int16_t adc_vbat_read(void)
|
||||||
return vbat_raw + config.vbat_offset;
|
return vbat_raw + config.vbat_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void adc_start_analog_watchdogd(uint32_t chsel)
|
void adc_start_analog_watchdogd(void)
|
||||||
{
|
{
|
||||||
// ADC setup, if it is defined a callback for the analog watch dog then it is enabled.
|
// ADC setup, if it is defined a callback for the analog watch dog then it is enabled.
|
||||||
VNA_ADC->ISR = VNA_ADC->ISR;
|
VNA_ADC->ISR = VNA_ADC->ISR;
|
||||||
VNA_ADC->IER = ADC_IER_AWDIE;
|
VNA_ADC->IER = ADC_IER_AWDIE;
|
||||||
VNA_ADC->TR = ADC_TR(0, TOUCH_THRESHOLD);
|
VNA_ADC->TR = ADC_TR(0, TOUCH_THRESHOLD);
|
||||||
VNA_ADC->SMPR = ADC_SMPR_SMP_1P5;
|
VNA_ADC->SMPR = ADC_SMPR_SMP_1P5;
|
||||||
VNA_ADC->CHSELR = chsel;
|
VNA_ADC->CHSELR = ADC_TOUCH_Y;
|
||||||
|
|
||||||
/* ADC configuration and start.*/
|
/* ADC configuration and start.*/
|
||||||
VNA_ADC->CFGR1 = ADC_CFGR1_RES_12BIT | ADC_CFGR1_AWDEN
|
VNA_ADC->CFGR1 = ADC_CFGR1_RES_12BIT | ADC_CFGR1_AWDEN
|
||||||
|
|
|
||||||
4
main.c
4
main.c
|
|
@ -2549,6 +2549,10 @@ static const I2CConfig i2ccfg = {
|
||||||
STM32_TIMINGR_PRESC(0U) |
|
STM32_TIMINGR_PRESC(0U) |
|
||||||
STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(10U) |
|
STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(10U) |
|
||||||
STM32_TIMINGR_SCLH(30U) | STM32_TIMINGR_SCLL(50U),
|
STM32_TIMINGR_SCLH(30U) | STM32_TIMINGR_SCLL(50U),
|
||||||
|
// 900kHz @ SYSCLK 48MHz, manually get values, x2 I2C speed
|
||||||
|
// STM32_TIMINGR_PRESC(0U) |
|
||||||
|
// STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(10U) |
|
||||||
|
// STM32_TIMINGR_SCLH(23U) | STM32_TIMINGR_SCLL(30U),
|
||||||
#else
|
#else
|
||||||
#error "Need Define STM32_I2C1SW and set correct TIMINGR settings"
|
#error "Need Define STM32_I2C1SW and set correct TIMINGR settings"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -646,7 +646,7 @@ void enter_dfu(void);
|
||||||
|
|
||||||
void adc_init(void);
|
void adc_init(void);
|
||||||
uint16_t adc_single_read(uint32_t chsel);
|
uint16_t adc_single_read(uint32_t chsel);
|
||||||
void adc_start_analog_watchdogd(uint32_t chsel);
|
void adc_start_analog_watchdogd(void);
|
||||||
void adc_stop(void);
|
void adc_stop(void);
|
||||||
int16_t adc_vbat_read(void);
|
int16_t adc_vbat_read(void);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue