diff options
author | Erich Eckner <git@eckner.net> | 2018-11-05 20:54:38 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-11-05 20:54:38 +0100 |
commit | ca7a705aea219313e9b8b64330aa4c27d3ab3f1d (patch) | |
tree | a04117806061743b694c8f74e109c3dfec1bf86a /multiplexer.c | |
parent | c6454367c84a99a4b17b69117f6eb803da610e72 (diff) | |
download | anzeige-ca7a705aea219313e9b8b64330aa4c27d3ab3f1d.tar.xz |
multiplexer: tpic_settle_time now adaptively controlled
Diffstat (limited to 'multiplexer.c')
-rw-r--r-- | multiplexer.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/multiplexer.c b/multiplexer.c index 50da183..ab39e08 100644 --- a/multiplexer.c +++ b/multiplexer.c @@ -93,6 +93,7 @@ void *put_on_display(void *param) } for (column=0; column<8; column++) { GPIO_ALTER(column + line == 7) = 1<<SER_DAT_PIN; + wait_tpic_settle_time GPIO_CLR = 1<<SER_CLK_PIN; wait_tpic_settle_time GPIO_SET = 1<<SER_CLK_PIN; @@ -100,6 +101,7 @@ void *put_on_display(void *param) } for (column=39; column>=0; column--) { GPIO_ALTER(display_data -> buf[display_data -> is_buf][column] & (0x01 << line)) = 1<<SER_DAT_PIN; + wait_tpic_settle_time GPIO_CLR = 1<<SER_CLK_PIN; wait_tpic_settle_time GPIO_SET = 1<<SER_CLK_PIN; @@ -116,6 +118,18 @@ void *put_on_display(void *param) perror("clock_gettime failed"); break; } + // adjust tpic_settle_time_iterator + if ((tpic_settle_time_iterator > 0) && (stop_time.tv_sec - start_time.tv_sec + (stop_time.tv_nsec - start_time.tv_nsec) / 1000000000. > 0.0003)) { +// fprintf(stderr, "%d -> ", tpic_settle_time_iterator); + tpic_settle_time_iterator--; +// fprintf(stderr, "%d\n", tpic_settle_time_iterator); + } + else if ((tpic_settle_time_iterator < 200000) && (stop_time.tv_sec - start_time.tv_sec + (stop_time.tv_nsec - start_time.tv_nsec) / 1000000000. < 0.0001)) { +// fprintf(stderr, "%d -> ", tpic_settle_time_iterator); + tpic_settle_time_iterator++; + tpic_settle_time_iterator *= 2; +// fprintf(stderr, "%d\n", tpic_settle_time_iterator); + } // wait until start_time + 1ms int wait = (start_time.tv_sec - stop_time.tv_sec) * 1000000 + (start_time.tv_nsec - stop_time.tv_nsec) / 1000 + 1000; if (wait > 0) |