summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--multiplexer.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/multiplexer.c b/multiplexer.c
index 7fe0d3d..431c6d6 100644
--- a/multiplexer.c
+++ b/multiplexer.c
@@ -91,16 +91,12 @@ void *put_on_display(void *param)
for (column=0; column<8; column++) {
GPIO_CLR = 1<<SER_CLK_PIN;
GPIO_ALTER(column + line == 7) = 1<<SER_DAT_PIN;
- usleep(5);
GPIO_SET = 1<<SER_CLK_PIN;
- usleep(5);
}
for (column=39; column>=0; column--) {
GPIO_CLR = 1<<SER_CLK_PIN;
GPIO_ALTER(display_data -> buf[display_data -> is_buf][column] & (0x01 << line)) = 1<<SER_DAT_PIN;
- usleep(5);
GPIO_SET = 1<<SER_CLK_PIN;
- usleep(5);
#endif
}
#ifdef SKIP_GPIO
@@ -112,11 +108,11 @@ void *put_on_display(void *param)
break;
}
// wait until start_time + 1ms
- usleep((start_time.tv_sec - stop_time.tv_sec) * 1000000 + (start_time.tv_nsec - stop_time.tv_nsec) / 1000 + 1000);
+ int wait = (start_time.tv_sec - stop_time.tv_sec) * 1000000 + (start_time.tv_nsec - stop_time.tv_nsec) / 1000 + 1000;
+ if (wait > 0)
+ usleep((start_time.tv_sec - stop_time.tv_sec) * 1000000 + (start_time.tv_nsec - stop_time.tv_nsec) / 1000 + 1000);
GPIO_SET = 1<<GATE_PIN; // Licht aus
- usleep(5);
GPIO_CLR = 1<<PAR_CLK_PIN;
- usleep(5);
GPIO_SET = 1<<PAR_CLK_PIN;
#endif
}
@@ -176,7 +172,9 @@ void *scroll_it(void *param)
break;
}
// wait until start_time + 50ms
- usleep((start_time.tv_sec - stop_time.tv_sec) * 1000000 + (start_time.tv_nsec - stop_time.tv_nsec) / 1000 + 50000);
+ int wait = (start_time.tv_sec - stop_time.tv_sec) * 1000000 + (start_time.tv_nsec - stop_time.tv_nsec) / 1000 + 50000;
+ if (wait > 0)
+ usleep((start_time.tv_sec - stop_time.tv_sec) * 1000000 + (start_time.tv_nsec - stop_time.tv_nsec) / 1000 + 50000);
display_data . should_buf = (display_data . should_buf + 1) % 3;
}
display_data . keep_running = 0;