#ifndef MULTIPLEXER_H #define MULTIPLEXER_H // // How to access GPIO registers from C-code on the Raspberry-Pi // Example program // 15-January-2012 // Dom and Gert // Revised: 15-Feb-2013 # include #ifndef __arm__ #ifndef FORCE_GPIO #define SKIP_GPIO #endif // FORCE_GPIO #endif // __arm__ // Access from ARM Running Linux #define BCM2708_PERI_BASE 0x20000000 #define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */ /** stolen/cited from wiringPi's wiringPi/wiringPi.c lines 536-548 **/ // GPPUD: // GPIO Pin pull up/down register #define GPPUD 37 // gpioToPUDCLK // (Word) offset to the Pull Up Down Clock regsiter static uint8_t gpioToPUDCLK [] = { 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, }; /** cite end **/ #define PAGE_SIZE (4*1024) #define BLOCK_SIZE (4*1024) #define SER_DAT_PIN 26 #define SER_CLK_PIN 19 #define GATE_PIN 13 #define PAR_CLK_PIN 6 #define SENSE_PIN 5 #define SCROLL_BUF_LEN 4096 static int tpic_settle_time_iterator = 1000; #define wait_tpic_settle_time for (int i=0; i