projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Add state comparisons to pyro channel conditions
[fw/altos]
/
src
/
stm
/
ao_timer.c
diff --git
a/src/stm/ao_timer.c
b/src/stm/ao_timer.c
index adec7aad950f617fc3effe7055db3749167ebaa5..f3011d3f0e159097c71ce8c3e3f49443c98d070b 100644
(file)
--- a/
src/stm/ao_timer.c
+++ b/
src/stm/ao_timer.c
@@
-28,18
+28,9
@@
uint16_t ao_time(void)
return v;
}
return v;
}
-static __xdata uint8_t ao_forever;
-
-void
-ao_delay(uint16_t ticks)
-{
- ao_alarm(ticks);
- ao_sleep(&ao_forever);
-}
-
-#if HAS_ADC
-volatile __data uint8_t ao_adc_interval = 1;
-volatile __data uint8_t ao_adc_count;
+#if AO_DATA_ALL
+volatile __data uint8_t ao_data_interval = 1;
+volatile __data uint8_t ao_data_count;
#endif
void
#endif
void
@@
-51,10
+42,13
@@
void stm_tim6_isr(void)
if (stm_tim6.sr & (1 << STM_TIM67_SR_UIF)) {
stm_tim6.sr = 0;
++ao_tick_count;
if (stm_tim6.sr & (1 << STM_TIM67_SR_UIF)) {
stm_tim6.sr = 0;
++ao_tick_count;
-#if
HAS_ADC
- if (++ao_
adc_count == ao_adc
_interval) {
- ao_
adc
_count = 0;
+#if
AO_DATA_ALL
+ if (++ao_
data_count == ao_data
_interval) {
+ ao_
data
_count = 0;
ao_adc_poll();
ao_adc_poll();
+#if (AO_DATA_ALL & ~(AO_DATA_ADC))
+ ao_wakeup((void *) &ao_data_count);
+#endif
}
#endif
}
}
#endif
}
@@
-64,8
+58,8
@@
void stm_tim6_isr(void)
void
ao_timer_set_adc_interval(uint8_t interval) __critical
{
void
ao_timer_set_adc_interval(uint8_t interval) __critical
{
- ao_
adc
_interval = interval;
- ao_
adc
_count = 0;
+ ao_
data
_interval = interval;
+ ao_
data
_count = 0;
}
#endif
}
#endif
@@
-93,7
+87,7
@@
ao_timer_init(void)
stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_TIM6EN);
stm_tim6.psc = TIMER_10kHz;
stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_TIM6EN);
stm_tim6.psc = TIMER_10kHz;
- stm_tim6.arr =
100
;
+ stm_tim6.arr =
99
;
stm_tim6.cnt = 0;
/* Enable update interrupt */
stm_tim6.cnt = 0;
/* Enable update interrupt */
@@
-272,6
+266,7
@@
ao_clock_init(void)
stm_rcc.csr |= (1 << STM_RCC_CSR_RMVF);
stm_rcc.csr |= (1 << STM_RCC_CSR_RMVF);
+#if DEBUG_THE_CLOCK
/* Output SYSCLK on PA8 for measurments */
stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOAEN);
/* Output SYSCLK on PA8 for measurments */
stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOAEN);
@@
-282,4
+277,5
@@
ao_clock_init(void)
stm_rcc.cfgr |= (STM_RCC_CFGR_MCOPRE_DIV_1 << STM_RCC_CFGR_MCOPRE);
stm_rcc.cfgr |= (STM_RCC_CFGR_MCOSEL_HSE << STM_RCC_CFGR_MCOSEL);
stm_rcc.cfgr |= (STM_RCC_CFGR_MCOPRE_DIV_1 << STM_RCC_CFGR_MCOPRE);
stm_rcc.cfgr |= (STM_RCC_CFGR_MCOSEL_HSE << STM_RCC_CFGR_MCOSEL);
+#endif
}
}