aboutsummaryrefslogtreecommitdiff
path: root/laser-tag software
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2016-04-18 19:03:36 -0500
committerDavid Barksdale <amatus@amatus.name>2016-04-18 19:29:08 -0500
commit5a0164d8a9b8af427c2b7c6db3bdadcf58c8c9b2 (patch)
tree085919d02a15acb2681849a60b9ba174c8e6ab40 /laser-tag software
parent99cc0e2559bd99fe551208e68d91d71ac6a8bdf9 (diff)
Make compatible with V0 badges again
Since we don't need to control reset to fix EPD stuck problems wire it back to PTA20 and revert the code changes.
Diffstat (limited to 'laser-tag software')
-rw-r--r--laser-tag software/epaper.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/laser-tag software/epaper.c b/laser-tag software/epaper.c
index af6aa90..a1c6391 100644
--- a/laser-tag software/epaper.c
+++ b/laser-tag software/epaper.c
@@ -2,8 +2,6 @@
#include "fsl_gpio_driver.h"
#include "fsl_spi_dma_master_driver.h"
-#define HAS_RESET 0
-
typedef enum { /* Image pixel -> Display pixel */
EPD_compensate, /* B -> W, W -> B (Current Image) */
EPD_white, /* B -> N, W -> W (Current Image) */
@@ -11,14 +9,14 @@ typedef enum { /* Image pixel -> Display pixel */
EPD_normal /* B -> B, W -> W (New Image) */
} EPD_stage;
-static const gpio_output_pin_user_config_t pinReset = {
+static const gpio_output_pin_user_config_t pinDischarge = {
.pinName = GPIO_MAKE_PIN(GPIOA_IDX, 19),
.config.outputLogic = 0,
};
static const gpio_output_pin_user_config_t pinCS = {
.pinName = GPIO_MAKE_PIN(GPIOD_IDX, 4),
- .config.outputLogic = 0,
+ .config.outputLogic = 1,
};
static const spi_dma_master_user_config_t spiConfig = {
@@ -48,7 +46,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(&pinReset);
+ GPIO_DRV_OutputPinInit(&pinDischarge);
GPIO_DRV_OutputPinInit(&pinCS);
}
@@ -223,18 +221,6 @@ int EPD_Draw(const uint8_t *old_image, const uint8_t *new_image)
uint32_t calculatedBaudRate;
SPI_DRV_DmaMasterConfigureBus(1, &spiConfig, &calculatedBaudRate);
- /* Reset */
-#if HAS_RESET
- GPIO_DRV_WritePinOutput(pinReset.pinName, 0);
-#endif
- GPIO_DRV_WritePinOutput(pinCS.pinName, 0);
- EPD_Delay(5);
-#if HAS_RESET
- GPIO_DRV_WritePinOutput(pinReset.pinName, 1);
-#endif
- GPIO_DRV_WritePinOutput(pinCS.pinName, 1);
- EPD_Delay(5);
-
/* read the COG ID */
uint8_t id = EPD_ReadCogID();
if ((id & 0x0f) != 0x02) {
@@ -341,6 +327,11 @@ 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);
+
out:
SPI_DRV_DmaMasterDeinit(1);
return rc;