aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2016-04-16 14:04:59 -0500
committerDavid Barksdale <amatus@amatus.name>2016-04-16 14:04:59 -0500
commit0a25bcc2548c2949c2c8fe9e46b2499c39d5ee1f (patch)
tree733c1a83052c16312c932a933d0c03c286ff1d3e
parentc62f5b0693e70bf18353c8b38be3347ab5a943d0 (diff)
Using PTA19 for EPD reset
This code will not work on V0 badges anymore. You'll need to remove Q1 and Q2 and cut the trace on the top going to breakout pin 34 and wire it to pin 33.
-rw-r--r--laser-tag software/epaper.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/laser-tag software/epaper.c b/laser-tag software/epaper.c
index 1d3dfba..32427e5 100644
--- a/laser-tag software/epaper.c
+++ b/laser-tag software/epaper.c
@@ -9,9 +9,9 @@ typedef enum { /* Image pixel -> Display pixel */
EPD_normal /* B -> B, W -> W (New Image) */
} EPD_stage;
-static const gpio_output_pin_user_config_t pinDischarge = {
+static const gpio_output_pin_user_config_t pinReset = {
.pinName = GPIO_MAKE_PIN(GPIOA_IDX, 19),
- .config.outputLogic = 0,
+ .config.outputLogic = 1,
};
static const gpio_output_pin_user_config_t pinCS = {
@@ -45,7 +45,7 @@ void EPD_Init()
PORT_HAL_SetMuxMode(g_portBase[GPIOD_IDX], 5, kPortMuxAlt2);
PORT_HAL_SetMuxMode(g_portBase[GPIOD_IDX], 6, kPortMuxAlt2);
PORT_HAL_SetMuxMode(g_portBase[GPIOD_IDX], 7, kPortMuxAlt2);
- GPIO_DRV_OutputPinInit(&pinDischarge);
+ GPIO_DRV_OutputPinInit(&pinReset);
GPIO_DRV_OutputPinInit(&pinCS);
SPI_DRV_DmaMasterInit(1, &spiState);
uint32_t calculatedBaudRate;
@@ -195,6 +195,14 @@ void EPD_frame_repeat(const uint8_t *data, uint8_t fixed_value, EPD_stage stage)
int EPD_Draw(const uint8_t *old_image, const uint8_t *new_image)
{
+ /* Reset */
+ GPIO_DRV_WritePinOutput(pinReset.pinName, 0);
+ GPIO_DRV_WritePinOutput(pinCS.pinName, 0);
+ EPD_Delay(5);
+ GPIO_DRV_WritePinOutput(pinReset.pinName, 1);
+ GPIO_DRV_WritePinOutput(pinCS.pinName, 1);
+ EPD_Delay(5);
+
/* read the COG ID */
uint8_t id = EPD_ReadCogID();
if ((id & 0x0f) != 0x02) {
@@ -297,11 +305,6 @@ int EPD_Draw(const uint8_t *old_image, const uint8_t *new_image)
EPD_WriteCommandByte(0x07, 0x01);
EPD_Delay(50);
- /* discharge external */
- GPIO_DRV_WritePinOutput(pinDischarge.pinName, 1);
- EPD_Delay(150);
- GPIO_DRV_WritePinOutput(pinDischarge.pinName, 0);
-
return 0;
}