diff options
author | jaseg <git@jaseg.net> | 2019-01-15 15:01:23 +0900 |
---|---|---|
committer | jaseg <git@jaseg.net> | 2019-01-15 15:01:23 +0900 |
commit | 57dcea3ededb8dfa4a1594e6eb8f67193ca285e5 (patch) | |
tree | e27c42dbf69f5df6c676fc56a146132b8f9f5925 | |
parent | f564294fd238eb1505c2de644bd23cc867b22a5b (diff) | |
download | 8seg-57dcea3ededb8dfa4a1594e6eb8f67193ca285e5.tar.gz 8seg-57dcea3ededb8dfa4a1594e6eb8f67193ca285e5.tar.bz2 8seg-57dcea3ededb8dfa4a1594e6eb8f67193ca285e5.zip |
Fix double edge issue with driver
-rw-r--r-- | fw/main.c | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -79,11 +79,6 @@ void unblank_low(void) { set_drv_gpios(out_state >> 4); } -void unblank(int new_bit) { - bit = new_bit; - unblank_low(); -} - void TIM3_IRQHandler(void) { GPIOA->BSRR = 1<<10; if (TIM3->SR & TIM_SR_UIF) @@ -166,13 +161,12 @@ int main(void) { adc_configure_monitor_mode(&cmd_if.cmd_if, 20 /*us*/); - int old = 0; while (42) { int new = GPIOA->IDR & (1<<0); - if (new != old) { - unblank(new); + if (new != bit) { + bit = new; TIM3->EGR |= TIM_EGR_UG; - old = new; + unblank_low(); } /* idle */ } |