From 5a0164d8a9b8af427c2b7c6db3bdadcf58c8c9b2 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Mon, 18 Apr 2016 19:03:36 -0500 Subject: 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. --- laser-tag badge/laser-tag.brd | 52 +++++++++---------------------------------- laser-tag badge/laser-tag.sch | 14 ++++++------ laser-tag software/epaper.c | 25 +++++++-------------- 3 files changed, 25 insertions(+), 66 deletions(-) diff --git a/laser-tag badge/laser-tag.brd b/laser-tag badge/laser-tag.brd index 1d27067..c67c595 100644 --- a/laser-tag badge/laser-tag.brd +++ b/laser-tag badge/laser-tag.brd @@ -2689,33 +2689,6 @@ Source: Comchip CGRM4001-G.pdf - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2864,15 +2837,23 @@ Source: Comchip CGRM4001-G.pdf - + + - + + + + + + + + @@ -3562,13 +3543,6 @@ Source: Comchip CGRM4001-G.pdf - - - - - - - @@ -3624,11 +3598,6 @@ Source: Comchip CGRM4001-G.pdf - - - - - @@ -3644,7 +3613,6 @@ Source: Comchip CGRM4001-G.pdf - diff --git a/laser-tag badge/laser-tag.sch b/laser-tag badge/laser-tag.sch index 9a8e882..56a72eb 100644 --- a/laser-tag badge/laser-tag.sch +++ b/laser-tag badge/laser-tag.sch @@ -10068,13 +10068,18 @@ support interrupts + + + + - - + + + @@ -10749,11 +10754,6 @@ support interrupts 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; -- cgit v1.2.3-18-g5258