summaryrefslogtreecommitdiff
path: root/multiplexer.c
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-11-01 11:20:07 +0100
committerErich Eckner <git@eckner.net>2018-11-01 11:20:07 +0100
commitd9b831fcc29585eab34c58c5a67c060d886bc8a6 (patch)
tree6694c246dd55b33d73aaa01464bc73982b237953 /multiplexer.c
parent1da3a7ecddeff8c8ecbcc496f156651099dcf00d (diff)
downloadanzeige-d9b831fcc29585eab34c58c5a67c060d886bc8a6.tar.xz
multiplexer: set up pull-up resistor on SENSE_PIN
Diffstat (limited to 'multiplexer.c')
-rw-r--r--multiplexer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/multiplexer.c b/multiplexer.c
index b260891..9bfdf1b 100644
--- a/multiplexer.c
+++ b/multiplexer.c
@@ -198,6 +198,17 @@ void multiplexer_setup_non_root(t_display_data *display_data)
INP_GPIO(PAR_CLK_PIN);
OUT_GPIO(PAR_CLK_PIN);
INP_GPIO(SENSE_PIN);
+ // enable pull-up on SENSE_PIN
+ /** adopted from wiringPi's wiringPi/wiringPi.c lines 1507-1511 **/
+ *(gpio + GPPUD) = 2; // bit 0: pull down; bit 1: pull up
+ usleep(5);
+ *(gpio + gpioToPUDCLK[SENSE_PIN]) = 1 << (SENSE_PIN & 31);
+ usleep(5);
+ *(gpio + GPPUD) = 0;
+ usleep(5);
+ *(gpio + gpioToPUDCLK[SENSE_PIN]) = 0;
+ usleep(5);
+ /** end of adoption **/
#endif
for (int i=0; i<3; i++)