2021-01-12 18:59:36 +00:00
|
|
|
#include "cmsis_os2.h"
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
#include "user_epd_impl.h"
|
|
|
|
|
|
|
|
extern osSemaphoreId_t g_epd_busy_semphr;
|
2021-01-14 15:25:28 +00:00
|
|
|
extern osSemaphoreId_t g_spi2_semphr;
|
2021-01-12 18:59:36 +00:00
|
|
|
|
|
|
|
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
|
|
|
if(GPIO_Pin == SPI2_BUSY_Pin) {
|
2021-01-14 15:25:28 +00:00
|
|
|
if(osKernelGetState() == osKernelRunning) { // Kernel has started, release semaphore.
|
2021-01-12 18:59:36 +00:00
|
|
|
osSemaphoreRelease(g_epd_busy_semphr);
|
|
|
|
// CMSIS-OS2 wraps FreeRTOS call, no need to use __xxFromISR functions here.
|
|
|
|
}
|
|
|
|
}
|
2021-01-14 15:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) {
|
|
|
|
if(hspi->Instance == SPI2) {
|
|
|
|
if(osKernelGetState() == osKernelRunning) {
|
|
|
|
osSemaphoreRelease(g_spi2_semphr);
|
|
|
|
}
|
|
|
|
}
|
2021-01-12 18:59:36 +00:00
|
|
|
}
|