Skip to content

Commit a10a9c8

Browse files
committed
Afficheur OK
1 parent a86142b commit a10a9c8

File tree

4 files changed

+32
-27
lines changed

4 files changed

+32
-27
lines changed

signaux.dwf3work

-5.53 KB
Binary file not shown.

software/firmware/App/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ TickType_t msToTicks(TickType_t ms);
7575
#define PriorityPeriodicWakeup (configMAX_PRIORITIES -3)
7676
#define PriorityDrawDisplay (configMAX_PRIORITIES -4)
7777

78-
#define EPD_CONFIG_LUT 0
78+
#define EPD_CONFIG_LUT 1
7979

8080
#define DEBUG_PROTOCOL 1
8181
#define DEBUG_CHANNEL 0x12

software/firmware/Drivers/BSP/WFT0583CZ61_7.5_EPD/EPD_7in5_V2.c

+28-26
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ const uint8_t LUT_BB_7IN5_V2[]={
127127
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi) {
128128
GPIO_InitTypeDef GPIO_InitStruct = {0};
129129

130+
__HAL_RCC_GPIOA_CLK_ENABLE();
130131
__HAL_RCC_DMA1_CLK_ENABLE();
131132

132133
/**SPI1 GPIO Configuration
@@ -220,7 +221,7 @@ EPD_Status EPD_HWInit(void) {
220221

221222
/*Configure GPIO pins : BUSY_Pin*/
222223
GPIO_InitStruct.Pin = BUSY_Pin;
223-
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
224+
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
224225
GPIO_InitStruct.Pull = GPIO_NOPULL;
225226
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
226227

@@ -250,9 +251,11 @@ EPD_Status EPD_HWInit(void) {
250251
hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
251252
hspi1.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
252253

254+
//HAL_SPI_DeInit(&hspi1);
253255
if (HAL_SPI_Init(&hspi1) != HAL_OK)
254256
status = EPD_ERROR_HW;
255257

258+
HAL_SPI_MspInit(&hspi1);
256259
return status;
257260
}
258261

@@ -322,6 +325,12 @@ EPD_Status EPD_SWInit(void) {
322325
return status;
323326
}
324327

328+
static void EPD_usDelay(uint32_t val) {
329+
volatile uint32_t tmp;
330+
331+
for (tmp=val; tmp!=0; tmp--);
332+
}
333+
325334
/******************************************************************************
326335
function : Display hardware reset
327336
parameter:
@@ -332,10 +341,11 @@ EPD_Status EPD_Reset(void) {
332341
//vTaskDelay(msToTicks(200));
333342
DEV_Digital_Write(EPD_RST_PIN, 0);
334343
//HAL_Delay(2);
335-
vTaskDelay(msToTicks(100));
344+
//vTaskDelay(msToTicks(100));
345+
EPD_usDelay(25); // ~ 50 µs
336346
DEV_Digital_Write(EPD_RST_PIN, 1);
337347
//HAL_Delay(200);
338-
vTaskDelay(msToTicks(200));
348+
//vTaskDelay(msToTicks(100));
339349

340350
return EPD_OK;
341351
}
@@ -404,12 +414,13 @@ static void EPD_SendBuffer(uint8_t *buffer, uint32_t count) {
404414
DEV_SPI_WriteBuffer(buffer, count);
405415

406416
ulTaskNotifyTake( pdTRUE, msToTicks(500)); // timeout to 500ms
417+
//while (!__HAL_SPI_GET_FLAG(&hspi1, SPI_FLAG_TXE)); // Wait last char to be sent
407418

408419
DEV_Digital_Write(EPD_CS_PIN, 1);
409420
}
410421

411422
/******************************************************************************
412-
function : Wait until the busy_pin goes LOW
423+
function : Wait until the busy_pin is LOW
413424
parameter:
414425
******************************************************************************/
415426
static void EPD_WaitUntilIdle(void) {
@@ -419,26 +430,11 @@ static void EPD_WaitUntilIdle(void) {
419430
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_1);
420431
epd_thread_handler= xTaskGetCurrentTaskHandle();
421432

422-
423-
// //Debug("e-Paper busy\r\n");
424-
// unsigned char busy;
425-
// do{
426-
// //HAL_Delay(1000);
427-
// //EPD_SendCommand(0x71);
428-
// HAL_Delay(5);
429-
// busy = DEV_Digital_Read(EPD_BUSY_PIN);
430-
// busy =!(busy & 0x01);
431-
// }while(busy);
432-
//
433-
// HAL_Delay(5);
434-
// //Debug("e-Paper busy release\r\n");
435-
436-
// wait for event, without timeout
437433
while (!end_busy) {
438434
ulNotificationValue= ulTaskNotifyTake( pdTRUE, msToTicks(100)); // timeout to 100ms
439435
if (ulNotificationValue!= 1) {
440-
//Check if busy is not low
441-
if (!(DEV_Digital_Read(EPD_BUSY_PIN) & 0x01))
436+
//Check if busy is returned to high state
437+
if ((DEV_Digital_Read(EPD_BUSY_PIN) & 0x01))
442438
end_busy = 1;
443439
} else
444440
end_busy = 1;
@@ -481,7 +477,6 @@ function : Turn On Display
481477
void EPD_RefreshDisplay(void) {
482478
EPD_SendCommand(0x12); //DISPLAY REFRESH
483479
//HAL_Delay(100); //!!!The delay here is necessary, 200uS at least!!!
484-
vTaskDelay(msToTicks(200));
485480
EPD_WaitUntilIdle();
486481
}
487482

@@ -531,9 +526,16 @@ void EXTI1_IRQHandler(void) {
531526
* @brief This function handles DMA1 channel3 global interrupt.
532527
*/
533528
void DMA1_Channel3_IRQHandler(void) {
529+
HAL_DMA_IRQHandler(hspi1.hdmatx);
530+
}
531+
532+
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
533+
{
534+
/* Turn LED3 on: Transfer in transmission/reception process is complete */
535+
//BSP_LED_On(LED3);
536+
//wTransferState = TRANSFER_COMPLETE;
534537
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
535538

536-
HAL_DMA_IRQHandler(&hdma_spi1_tx);
537539
if (epd_thread_handler != NULL) {
538540
/* Notify the task that an event has been emitted. */
539541
vTaskNotifyGiveFromISR(epd_thread_handler, &xHigherPriorityTaskWoken );
@@ -542,9 +544,9 @@ void DMA1_Channel3_IRQHandler(void) {
542544
epd_thread_handler = NULL;
543545

544546
/* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch
545-
should be performed to ensure the interrupt returns directly to the highest
546-
priority task. The macro used for this purpose is dependent on the port in
547-
use and may be called portEND_SWITCHING_ISR(). */
547+
should be performed to ensure the interrupt returns directly to the highest
548+
priority task. The macro used for this purpose is dependent on the port in
549+
use and may be called portEND_SWITCHING_ISR(). */
548550
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
549551
}
550552
}

software/firmware/Drivers/BSP/XBEE/xbee.c

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include "xbee.h"
1515
#include "xbee_ll.h"
1616

17+
/* If some function are not used, there will be removed at compile time */
18+
#pragma GCC diagnostic ignored "-Wunused-function"
19+
1720
/**
1821
* @brief Buffer used for sending data
1922
*/

0 commit comments

Comments
 (0)