diff options
author | Erich Eckner <git@eckner.net> | 2018-11-02 12:05:34 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-11-02 12:05:34 +0100 |
commit | 56fda64a831adf6418f55bd46a3c81c20684da60 (patch) | |
tree | d2ce3ed6a55405712074ed00b4ccb94fa3a08eae /multiplexer.c | |
parent | fba464161ac1b21c5d7e82692ec090627badbb77 (diff) | |
download | anzeige-56fda64a831adf6418f55bd46a3c81c20684da60.tar.xz |
comment #else and #endifs
Diffstat (limited to 'multiplexer.c')
-rw-r--r-- | multiplexer.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/multiplexer.c b/multiplexer.c index 48e218c..b06b5a0 100644 --- a/multiplexer.c +++ b/multiplexer.c @@ -2,7 +2,7 @@ #include <stdlib.h> #include <fcntl.h> #include <sys/mman.h> -#endif +#endif // SKIP_GPIO #include <stdio.h> #include <unistd.h> #include <string.h> @@ -42,7 +42,7 @@ int multiplexer_setup_root() // Always use volatile pointer! gpio = (volatile unsigned *)gpio_map; -#endif +#endif // !SKIP_GPIO } // multiplexer_setup_root // @@ -54,13 +54,13 @@ void *put_on_display(void *param) int line, column; #ifndef SKIP_GPIO struct timespec start_time, stop_time; -#endif +#endif // !SKIP_GPIO while (display_data -> keep_running) { #ifdef SKIP_GPIO usleep(10000); -#endif +#endif // SKIP_GPIO display_data -> is_buf = display_data -> should_buf; if (!display_data -> should_be_on) { if (!display_data -> is_on) @@ -71,14 +71,18 @@ void *put_on_display(void *param) } display_data -> is_on = display_data -> should_be_on; #ifdef SKIP_GPIO +#ifndef SILENT printf("=\n"); +#endif // !SILENT for (line=0; line<7; line++) { for (column=0; column<40; column++) { +#ifndef SILENT if (display_data -> buf[display_data -> is_buf][column] & (0x01 << line)) printf("X"); else printf(" "); -#else +#endif // !SILENT +#else // SKIP_GPIO for (line=7; line>=0; line--) { GPIO_CLR = 1<<GATE_PIN; // Licht an if (clock_gettime(CLOCK_MONOTONIC_RAW, &start_time) != 0) { @@ -95,11 +99,13 @@ void *put_on_display(void *param) GPIO_CLR = 1<<SER_CLK_PIN; GPIO_ALTER(display_data -> buf[display_data -> is_buf][column] & (0x01 << line)) = 1<<SER_DAT_PIN; GPIO_SET = 1<<SER_CLK_PIN; -#endif +#endif // SKIP_GPIO } #ifdef SKIP_GPIO +#ifndef SILENT printf("\n"); -#else +#endif // !SILENT +#else // SKIP_GPIO if (clock_gettime(CLOCK_MONOTONIC_RAW, &stop_time) != 0) { display_data -> keep_running = 0; perror("clock_gettime failed"); @@ -112,7 +118,7 @@ void *put_on_display(void *param) GPIO_SET = 1<<GATE_PIN; // Licht aus GPIO_CLR = 1<<PAR_CLK_PIN; GPIO_SET = 1<<PAR_CLK_PIN; -#endif +#endif // SKIP_GPIO } } return NULL; @@ -219,7 +225,7 @@ void multiplexer_setup_non_root(t_display_data *display_data) *(gpio + gpioToPUDCLK[SENSE_PIN]) = 0; usleep(5); /** end of adoption **/ -#endif +#endif // !SKIP_GPIO for (int i=0; i<3; i++) memset(display_data -> buf[i],0,40); @@ -252,7 +258,7 @@ void turn_off_display() } GPIO_CLR = 1<<PAR_CLK_PIN; GPIO_SET = 1<<PAR_CLK_PIN; -#endif +#endif // !SKIP_GPIO } // turn_off_display int got_input() @@ -269,7 +275,7 @@ int got_input() } else return 0; -#else +#else // SKIP_GPIO return ! GET_GPIO(SENSE_PIN); // low = active -#endif +#endif // SKIP_GPIO } // got_input |