aboutsummaryrefslogtreecommitdiff
path: root/fw/main.c
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2019-01-15 15:01:23 +0900
committerjaseg <git@jaseg.net>2019-01-15 15:01:23 +0900
commit57dcea3ededb8dfa4a1594e6eb8f67193ca285e5 (patch)
treee27c42dbf69f5df6c676fc56a146132b8f9f5925 /fw/main.c
parentf564294fd238eb1505c2de644bd23cc867b22a5b (diff)
download8seg-57dcea3ededb8dfa4a1594e6eb8f67193ca285e5.tar.gz
8seg-57dcea3ededb8dfa4a1594e6eb8f67193ca285e5.tar.bz2
8seg-57dcea3ededb8dfa4a1594e6eb8f67193ca285e5.zip
Fix double edge issue with driver
Diffstat (limited to 'fw/main.c')
-rw-r--r--fw/main.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/fw/main.c b/fw/main.c
index 8a89157..2340ecb 100644
--- a/fw/main.c
+++ b/fw/main.c
@@ -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 */
}