Updates on the IODevice structure.
Display and Logger fully functional. Keypad task completed - yet to be tested git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@219 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -36,6 +36,8 @@
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "keypadMatrix.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -56,6 +58,8 @@ void SysTick_Handler(void);
|
||||
|
||||
extern void IRQ_setInterruptProperties(uint8_t irqChannel, uint8_t preemptionPriority, uint8_t subPriority, FunctionalState command);
|
||||
|
||||
extern void IRQ_setKeypadEXTI(struct Keypad* self, FunctionalState command);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -40,8 +40,11 @@
|
||||
#include "keypadMatrix.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "IODevice.h"
|
||||
#include "led.h"
|
||||
#include "uart.h"
|
||||
#include "spi.h"
|
||||
#include "spiDevice.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
@@ -137,8 +140,6 @@ static ErrorStatus systeminfoCommandHandler(void)
|
||||
|
||||
errorStatus &= Logger_logModuleInfo();
|
||||
vTaskDelay(100);
|
||||
errorStatus &= Keypad_logModuleInfo();
|
||||
vTaskDelay(100);
|
||||
OS_logTaskInfo(ledTaskHandle);
|
||||
vTaskDelay(100);
|
||||
OS_logTaskInfo(sysTaskHandle);
|
||||
@@ -152,9 +153,7 @@ static void initTask(void* parameters)
|
||||
|
||||
Logger_construct(&uart1->device);
|
||||
|
||||
Keypad_construct();
|
||||
|
||||
NHD0420_construct(spiDisplay);
|
||||
NHD0420_construct(&spiDisplay->device);
|
||||
|
||||
NHD0420_turnOffDisplay();
|
||||
vTaskDelay(1000);
|
||||
@@ -180,14 +179,16 @@ static void initTask(void* parameters)
|
||||
|
||||
static void ledBlinkTask (void* parameters)
|
||||
{
|
||||
char high = 1;
|
||||
char low = 0;
|
||||
struct LedTaskArguments* arguments = (struct LedTaskArguments*) parameters;
|
||||
struct Led* led = arguments->led;
|
||||
int frequency = arguments->frequency;
|
||||
while (1)
|
||||
{
|
||||
LED_turnOn(led);
|
||||
IODevice_write(&led->device, &high, 1);
|
||||
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
||||
LED_turnOff(led);
|
||||
IODevice_write(&led->device, &low, 1);
|
||||
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,11 @@
|
||||
#include "semphr.h"
|
||||
|
||||
#include "stm32f10x_it.h"
|
||||
#include "Logger.h"
|
||||
|
||||
#include "stm32f10x_exti.h"
|
||||
|
||||
#include "Logger.h"
|
||||
#include "keypadMatrix.h"
|
||||
#include "led.h"
|
||||
#include "platform.h"
|
||||
#include "spi.h"
|
||||
@@ -72,7 +73,6 @@ void IRQ_setInterruptProperties(uint8_t irqChannel, uint8_t preemptionPriority,
|
||||
{
|
||||
NVIC_InitTypeDef NVIC_InitStructure; //! Define empty NVIC structure
|
||||
|
||||
//! Configure the USARTx Interrupt
|
||||
NVIC_InitStructure.NVIC_IRQChannel = irqChannel;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = preemptionPriority;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = subPriority;
|
||||
@@ -81,7 +81,18 @@ void IRQ_setInterruptProperties(uint8_t irqChannel, uint8_t preemptionPriority,
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
}
|
||||
|
||||
/**
|
||||
void IRQ_setKeypadEXTI(struct Keypad* self, FunctionalState command)
|
||||
{
|
||||
int colCounter;
|
||||
for (colCounter = 0; colCounter < KEYPAD_NUMBER_OF_COLUMNS; colCounter++)
|
||||
{
|
||||
self->column[colCounter].EXTI_InitStruct.EXTI_LineCmd = command;
|
||||
EXTI_Init(&self->column[colCounter].EXTI_InitStruct);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function handles SVCall exception.
|
||||
* @param None
|
||||
* @retval None
|
||||
@@ -268,13 +279,16 @@ void SPI3_IRQHandler (void)
|
||||
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
|
||||
void EXTI4_IRQHandler(void)
|
||||
{
|
||||
static signed portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
IRQ_setKeypadEXTI(keypad, DISABLE);
|
||||
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
||||
|
||||
LOGGER_INFO_ISR("EXT4 ISR");
|
||||
|
||||
|
||||
EXTI_ClearITPendingBit(EXTI_Line4);
|
||||
|
||||
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
||||
@@ -286,16 +300,22 @@ void EXTI9_5_IRQHandler (void)
|
||||
|
||||
if (EXTI_GetITStatus(EXTI_Line5) != RESET)
|
||||
{
|
||||
IRQ_setKeypadEXTI(keypad, DISABLE);
|
||||
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
||||
LOGGER_INFO_ISR("EXT5 ISR");
|
||||
EXTI_ClearITPendingBit(EXTI_Line5);
|
||||
}
|
||||
else if (EXTI_GetITStatus(EXTI_Line6) != RESET)
|
||||
{
|
||||
IRQ_setKeypadEXTI(keypad, DISABLE);
|
||||
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
||||
LOGGER_INFO_ISR("EXT6 ISR");
|
||||
EXTI_ClearITPendingBit(EXTI_Line6);
|
||||
}
|
||||
else if (EXTI_GetITStatus(EXTI_Line7) != RESET)
|
||||
{
|
||||
IRQ_setKeypadEXTI(keypad, DISABLE);
|
||||
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
||||
LOGGER_INFO_ISR("EXT7 ISR");
|
||||
EXTI_ClearITPendingBit(EXTI_Line7);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user