mirror of https://github.com/ARMmbed/mbed-os.git
[NUCLEO_F030R8] 16-bit timer register update
This path fixes issue #816. Current value of TIM_MST->CNT is read in interrupt context only. This avoids master timer overflow without SlaveCounter update. Change-Id: I8e2ec02ce7539a4c044c7e3dfe6bedc9fcdf7736pull/1763/head
parent
82d82d0b2a
commit
01ff0b9ab7
|
@ -43,6 +43,7 @@ void set_compare(uint16_t count);
|
||||||
extern volatile uint32_t SlaveCounter;
|
extern volatile uint32_t SlaveCounter;
|
||||||
extern volatile uint32_t oc_int_part;
|
extern volatile uint32_t oc_int_part;
|
||||||
extern volatile uint16_t oc_rem_part;
|
extern volatile uint16_t oc_rem_part;
|
||||||
|
extern volatile uint16_t cnt_val;
|
||||||
|
|
||||||
// Used to increment the slave counter
|
// Used to increment the slave counter
|
||||||
void timer_update_irq_handler(void)
|
void timer_update_irq_handler(void)
|
||||||
|
@ -59,7 +60,7 @@ void timer_update_irq_handler(void)
|
||||||
// Used for mbed timeout (channel 1) and HAL tick (channel 2)
|
// Used for mbed timeout (channel 1) and HAL tick (channel 2)
|
||||||
void timer_oc_irq_handler(void)
|
void timer_oc_irq_handler(void)
|
||||||
{
|
{
|
||||||
uint16_t cval = TIM_MST->CNT;
|
cnt_val = TIM_MST->CNT;
|
||||||
TimMasterHandle.Instance = TIM_MST;
|
TimMasterHandle.Instance = TIM_MST;
|
||||||
|
|
||||||
// Channel 1 for mbed timeout
|
// Channel 1 for mbed timeout
|
||||||
|
@ -71,7 +72,7 @@ void timer_oc_irq_handler(void)
|
||||||
} else {
|
} else {
|
||||||
if (oc_int_part > 0) {
|
if (oc_int_part > 0) {
|
||||||
set_compare(0xFFFF);
|
set_compare(0xFFFF);
|
||||||
oc_rem_part = cval; // To finish the counter loop the next time
|
oc_rem_part = cnt_val; // To finish the counter loop the next time
|
||||||
oc_int_part--;
|
oc_int_part--;
|
||||||
} else {
|
} else {
|
||||||
us_ticker_irq_handler();
|
us_ticker_irq_handler();
|
||||||
|
|
Loading…
Reference in New Issue