diff options
author | Erich Eckner <git@eckner.net> | 2018-11-01 11:20:07 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-11-01 11:20:07 +0100 |
commit | d9b831fcc29585eab34c58c5a67c060d886bc8a6 (patch) | |
tree | 6694c246dd55b33d73aaa01464bc73982b237953 /multiplexer.c | |
parent | 1da3a7ecddeff8c8ecbcc496f156651099dcf00d (diff) | |
download | anzeige-d9b831fcc29585eab34c58c5a67c060d886bc8a6.tar.xz |
multiplexer: set up pull-up resistor on SENSE_PIN
Diffstat (limited to 'multiplexer.c')
-rw-r--r-- | multiplexer.c | 11 |
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++) |