1 #ifndef __BSP_H__ 2 #define __BSP_H__ 3 4 #include <ubb/ubb.h> 5 6 /* Pin assignments (74HC4052): 7 * 8 * Sniffer UBB 74HC4052 #1 74HC4052 #2 10K Resistor M74HC595B1R EM027AS012 9 * ------- ---- ----------- ----------- ------------ ----------- ---------- 10 * DAT2 DAT2 13 (1Z) 11 * CD DAT3 3 (2Z) 12 * CMD CMD 10 (S0) 10 (S0) IN OUT 10 (SCLR#) 13 * VCC VDD 16 (VCC) 16 (VCC) 16 (VCC) 2 (3V3) 14 * CLK CLK 3 (SCK) 15 * GND GND 8 (GND) 8 (GND) 8 (GND) 1 (GND) 16 * DAT0 DAT0 13 (1Z) 17 * DAT1 DAT1 3 (2Z) 18 * 19 * Multiplexer pin selection: 20 * 21 * {Z}Y{S1/S0} 22 * 23 * 1Z with S1=0, S0=0 => 1Y0 (output 1, channel 0) 24 * 2Z with S1=0, S0=0 => 2Y0 (output 2, channel 0) 25 * 26 * 1Z with S1=0, S0=1 => 1Y1 (output 1, channel 1) 27 * 2Z with S1=0, S0=1 => 2Y1 (output 2, channel 1) 28 * 29 * Connections to the shift register (channel 0): 30 * 31 * Sniffer UBB 74HC4052 #1 M74HC595B1R 32 * ------- --- ----------- ----------- 33 * DAT2 DAT2 12 (1Y0) 12 (RCK) 34 * CD DAT3 1 (2Y0) 14 (SI) 35 * 36 * 74HC4052 #2 37 * ----------- 38 * DAT0 DAT0 12 (1Y0) 10 (SCLR#) 39 * DAT1 DAT1 1 (2Y0) 11 (SCK) 40 * 41 * Connections to the display board (channel 1): 42 * 43 * Sniffer UBB 74HC4052 #1 EM027AS012 44 * ------- --- ----------- ---------- 45 * DAT2 DAT2 14 (1Y1) 4 (MOSI) 46 * CD DAT3 5 (2Y1) 6 (SSEL) 47 * 48 * 74HC4052 #2 49 * ----------- 50 * DAT0 DAT0 14 (1Y1) 11 (PWM) 51 * DAT1 DAT1 5 (2Y1) 12 (RESET) 52 * 53 * Connections from the shift register (providing persistent outputs for 54 * channel 0): 55 * 56 * M74HC595B1R EM027AS012 57 * ----------- ---------- 58 * 15 (QA) 13 (PANEL) 59 * 1 (QB) 14 (DIS) 60 * 61 * General connections: 62 * 63 * Sniffer UBB 74HC4052 M74HC595B1R 64 * ------- ---- -------- ----------- 65 * GND GND 6 (E#) 13 (G#) 66 * 7 (VEE) 67 * 9 (S1) 68 */ 69 70 /* CMD/S0 = 0 */ 71 72 #define SHIFT_SCLR UBB_DAT0 73 #define SHIFT_SCK UBB_DAT1 74 #define SHIFT_RCK UBB_DAT2 75 #define SHIFT_SI UBB_DAT3 76 77 /* CMD/S1 = 1 */ 78 79 #define EPD_PWM UBB_DAT0 80 #define EPD_RESET UBB_DAT1 81 #define EPD_MOSI UBB_DAT2 82 #define EPD_SSEL UBB_DAT3 83 84 /* Channel-insensitive. */ 85 86 #define MUX_S0 UBB_CMD 87 #define EPD_SCK UBB_CLK 88 89 /* NanoNote-specific functions. */ 90 91 void shift_select(); 92 void shift_update(); 93 void shift_init(); 94 void shift_reinit(); 95 void shift_in(uint8_t v); 96 void epd_select(); 97 98 /* Board-specific interface functions. */ 99 100 void bsp_init(); 101 void bsp_InitDisplayHardware(); 102 void bsp_PowerOn(); 103 void bsp_pwm_active(uint16_t delayInMs); 104 void bsp_Shutdown(); 105 void bsp_spiInit(); 106 void bsp_writeToDisplay(uint8_t *data, uint16_t len); 107 void bsp_delayMs(uint32_t ms); 108 void bsp_delayUs(uint32_t us); 109 uint32_t bsp_getMsTicks(); 110 int16_t bsp_getTemp(); 111 112 #endif /* __BSP_H__ */