X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fstm%2Fao_arch.h;h=dd9579f1093252b303cfff84506ebb68d5734b6b;hp=188b89962b3532b5aa6634a8d47004f50d382495;hb=51aef5d4fc29986353ad887f4a67ed2fe35f8c8e;hpb=f2c110fb4531144f18f62200e4127738c84e87f1 diff --git a/src/stm/ao_arch.h b/src/stm/ao_arch.h index 188b8996..dd9579f1 100644 --- a/src/stm/ao_arch.h +++ b/src/stm/ao_arch.h @@ -145,17 +145,33 @@ extern const uint16_t ao_serial_number; #define ao_arch_critical(b) do { cli(); do { b } while (0); sei(); } while (0) -#define AO_ARM_NUM_ADC 12 - -struct ao_adc { - uint16_t tick; /* tick when the sample was read */ - uint16_t adc[AO_ARM_NUM_ADC]; /* samples */ -}; - /* * For now, we're running at a weird frequency */ -#define STM_APB1 (16000000 * 6 / 4) + +#if AO_HSE +#define AO_PLLSRC AO_HSE +#else +#define AO_PLLSRC STM_HSI_FREQ +#endif + +#define AO_PLLVCO (AO_PLLSRC * AO_PLLMUL) +#define AO_SYSCLK (AO_PLLVCO / AO_PLLDIV) +#define AO_HCLK (AO_SYSCLK / AO_AHB_PRESCALER) +#define AO_PCLK1 (AO_HCLK / AO_APB1_PRESCALER) +#define AO_PCLK2 (AO_HCLK / AO_APB2_PRESCALER) + +#if AO_APB1_PRESCALER == 1 +#define AO_TIM23467_CLK AO_PCLK1 +#else +#define AO_TIM23467_CLK (2 * AO_PCLK1) +#endif + +#if AO_APB2_PRESCALER == 1 +#define AO_TIM91011_CLK AO_PCLK2 +#else +#define AO_TIM91011_CLK (2 * AO_PCLK2) +#endif void ao_lcd_stm_init(void); @@ -203,5 +219,8 @@ ao_serial3_set_speed(uint8_t speed); extern uint32_t ao_radio_cal; +void +ao_adc_init(); + #endif /* _AO_ARCH_H_ */