Merge pull request #1858 from BartSX/f103

[NUCLEO_F103RB] Revert and update path for 16-bit timer
pull/1860/head
Martin Kojtal 2016-06-06 17:39:18 +01:00
commit fc9bd4c27a
2 changed files with 5 additions and 5 deletions

View File

@ -43,10 +43,9 @@ 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;
void timer_irq_handler(void) { void timer_irq_handler(void) {
cnt_val= TIM_MST->CNT; uint16_t cval = TIM_MST->CNT;
TimMasterHandle.Instance = TIM_MST; TimMasterHandle.Instance = TIM_MST;
@ -65,7 +64,7 @@ void timer_irq_handler(void) {
} else { } else {
if (oc_int_part > 0) { if (oc_int_part > 0) {
set_compare(0xFFFF); set_compare(0xFFFF);
oc_rem_part = cnt_val; // To finish the counter loop the next time oc_rem_part = cval; // To finish the counter loop the next time
oc_int_part--; oc_int_part--;
} else { } else {
us_ticker_irq_handler(); us_ticker_irq_handler();

View File

@ -43,9 +43,10 @@ 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;
void timer_irq_handler(void) { void timer_irq_handler(void) {
uint16_t cval = TIM_MST->CNT; cnt_val = TIM_MST->CNT;
TimMasterHandle.Instance = TIM_MST; TimMasterHandle.Instance = TIM_MST;
@ -64,7 +65,7 @@ void timer_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();