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