From d9b831fcc29585eab34c58c5a67c060d886bc8a6 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 1 Nov 2018 11:20:07 +0100 Subject: multiplexer: set up pull-up resistor on SENSE_PIN --- multiplexer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'multiplexer.c') 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++) -- cgit v1.2.3-70-g09d2