1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/bsp.h Sun May 19 21:18:16 2013 +0000
1.3 @@ -0,0 +1,112 @@
1.4 +#ifndef __BSP_H__
1.5 +#define __BSP_H__
1.6 +
1.7 +#include <ubb/ubb.h>
1.8 +
1.9 +/* Pin assignments (74HC4052):
1.10 + *
1.11 + * Sniffer UBB 74HC4052 #1 74HC4052 #2 10K Resistor M74HC595B1R EM027AS012
1.12 + * ------- ---- ----------- ----------- ------------ ----------- ----------
1.13 + * DAT2 DAT2 13 (1Z)
1.14 + * CD DAT3 3 (2Z)
1.15 + * CMD CMD 10 (S0) 10 (S0) IN OUT 10 (SCLR#)
1.16 + * VCC VDD 16 (VCC) 16 (VCC) 16 (VCC) 2 (3V3)
1.17 + * CLK CLK 3 (SCK)
1.18 + * GND GND 8 (GND) 8 (GND) 8 (GND) 1 (GND)
1.19 + * DAT0 DAT0 13 (1Z)
1.20 + * DAT1 DAT1 3 (2Z)
1.21 + *
1.22 + * Multiplexer pin selection:
1.23 + *
1.24 + * {Z}Y{S1/S0}
1.25 + *
1.26 + * 1Z with S1=0, S0=0 => 1Y0 (output 1, channel 0)
1.27 + * 2Z with S1=0, S0=0 => 2Y0 (output 2, channel 0)
1.28 + *
1.29 + * 1Z with S1=0, S0=1 => 1Y1 (output 1, channel 1)
1.30 + * 2Z with S1=0, S0=1 => 2Y1 (output 2, channel 1)
1.31 + *
1.32 + * Connections to the shift register (channel 0):
1.33 + *
1.34 + * Sniffer UBB 74HC4052 #1 M74HC595B1R
1.35 + * ------- --- ----------- -----------
1.36 + * DAT2 DAT2 12 (1Y0) 12 (RCK)
1.37 + * CD DAT3 1 (2Y0) 14 (SI)
1.38 + *
1.39 + * 74HC4052 #2
1.40 + * -----------
1.41 + * DAT0 DAT0 12 (1Y0) 10 (SCLR#)
1.42 + * DAT1 DAT1 1 (2Y0) 11 (SCK)
1.43 + *
1.44 + * Connections to the display board (channel 1):
1.45 + *
1.46 + * Sniffer UBB 74HC4052 #1 EM027AS012
1.47 + * ------- --- ----------- ----------
1.48 + * DAT2 DAT2 14 (1Y1) 4 (MOSI)
1.49 + * CD DAT3 5 (2Y1) 6 (SSEL)
1.50 + *
1.51 + * 74HC4052 #2
1.52 + * -----------
1.53 + * DAT0 DAT0 14 (1Y1) 11 (PWM)
1.54 + * DAT1 DAT1 5 (2Y1) 12 (RESET)
1.55 + *
1.56 + * Connections from the shift register (providing persistent outputs for
1.57 + * channel 0):
1.58 + *
1.59 + * M74HC595B1R EM027AS012
1.60 + * ----------- ----------
1.61 + * 15 (QA) 13 (PANEL)
1.62 + * 1 (QB) 14 (DIS)
1.63 + *
1.64 + * General connections:
1.65 + *
1.66 + * Sniffer UBB 74HC4052 M74HC595B1R
1.67 + * ------- ---- -------- -----------
1.68 + * GND GND 6 (E#) 13 (G#)
1.69 + * 7 (VEE)
1.70 + * 9 (S1)
1.71 + */
1.72 +
1.73 +/* CMD/S0 = 0 */
1.74 +
1.75 +#define SHIFT_SCLR UBB_DAT0
1.76 +#define SHIFT_SCK UBB_DAT1
1.77 +#define SHIFT_RCK UBB_DAT2
1.78 +#define SHIFT_SI UBB_DAT3
1.79 +
1.80 +/* CMD/S1 = 1 */
1.81 +
1.82 +#define EPD_PWM UBB_DAT0
1.83 +#define EPD_RESET UBB_DAT1
1.84 +#define EPD_MOSI UBB_DAT2
1.85 +#define EPD_SSEL UBB_DAT3
1.86 +
1.87 +/* Channel-insensitive. */
1.88 +
1.89 +#define MUX_S0 UBB_CMD
1.90 +#define EPD_SCK UBB_CLK
1.91 +
1.92 +/* NanoNote-specific functions. */
1.93 +
1.94 +void shift_select();
1.95 +void shift_update();
1.96 +void shift_init();
1.97 +void shift_reinit();
1.98 +void shift_in(uint8_t v);
1.99 +void epd_select();
1.100 +
1.101 +/* Board-specific interface functions. */
1.102 +
1.103 +void bsp_init();
1.104 +void bsp_InitDisplayHardware();
1.105 +void bsp_PowerOn();
1.106 +void bsp_pwm_active(uint16_t delayInMs);
1.107 +void bsp_Shutdown();
1.108 +void bsp_spiInit();
1.109 +void bsp_writeToDisplay(uint8_t *data, uint16_t len);
1.110 +void bsp_delayMs(uint32_t ms);
1.111 +void bsp_delayUs(uint32_t us);
1.112 +uint32_t bsp_getMsTicks();
1.113 +int16_t bsp_getTemp();
1.114 +
1.115 +#endif /* __BSP_H__ */