Fixed issues with the logger and brought logger to same structure as the rest - now the logger is a independent object

Added testItems to HwValidationMenu for SWo

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@235 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-05 07:49:28 +00:00
parent 955d695720
commit c860b5b3b4
17 changed files with 283 additions and 258 deletions

View File

@@ -60,6 +60,8 @@ typedef struct
GPIO_InitTypeDef GPIO_InitStruct;
} T_PL_GPIO;
extern struct Logger* mainLog;
// Export of PCBA information
extern struct Pcba* pcba;

View File

@@ -119,11 +119,11 @@ ErrorStatus Keypad_construct(struct Keypad* self, struct KeypadParameters* param
if(returnValue == SUCCESS)
{
LOGGER_INFO("Keypad task started");
LOGGER_INFO(mainLog, "Keypad task started");
}
else
{
LOGGER_ERROR("Keypad task FAILED");
LOGGER_ERROR(mainLog, "Keypad task FAILED");
}
}
@@ -190,8 +190,6 @@ static void KeypadTask(void* parameters)
{
self->lastState[rowCounter][colCounter] = RELEASED;
// Key has been released
LOGGER_DEBUG("KEY row%d, column%d released", rowCounter, colCounter);
}
else
{
@@ -204,7 +202,6 @@ static void KeypadTask(void* parameters)
{
self->lastState[rowCounter][colCounter] = PRESSED;
// Key has been pressed
LOGGER_DEBUG("KEY row%d, column%d pressed", rowCounter, colCounter);
}
else
{

View File

@@ -34,6 +34,8 @@
#include "stm32f10x_pwr.h"
#include "stm32f10x_it.h"
#include "Logger.h"
#include "platform.h"
#include "adc.h"
#include "gpio.h"
@@ -84,6 +86,9 @@
// The following static file-scope variables represent the actual storage of
// the IO/Peripheral object
// Logger
static struct Logger _mainLog = {.initialized = false};
// PCBA information
// LEDs
@@ -117,8 +122,12 @@ static struct SpiDevice _spiEEPROM;
static struct Keypad _keypad;
static struct KeypadParameters _keypadParameters;
// The following pointers are for export (see platform.h) and external use.
// Note that the pointer content is marked "const"
struct Logger* mainLog = &_mainLog;
struct Pcba* pcba;
struct Gpio* const ledGreen = &_ledGreen;
@@ -265,6 +274,7 @@ ErrorStatus initPlatform(void)
uartLoggerParam->txQueueSize = UART_LOG_TX_QUEUE;
returnValue = Uart_construct(uart1, uartLoggerParam);
/* --------------------------------------------------------------------*/
/* USART3 */
/* --------------------------------------------------------------------*/

View File

@@ -31,6 +31,8 @@
#include "rtc.h"
#include "stm32f10x_rtc.h"
#include "Observable.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------

View File

@@ -244,3 +244,102 @@ ErrorStatus Uart_read (struct Uart* self, char* buffer, size_t length, size_t* a
return returnValue;
}
/** ----------------------------------------------------------------------------
* @brief Function: USART1_IRQHandler
*
* Dedicated Interrupt Service Routine for USART1
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
void USART1_IRQHandler(void)
{
static signed portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
//! Transmission register empty interrupt
if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
{
//! Receive element from usart transmission queue
struct usartQueueItem usartTxItem;
xQueueReceiveFromISR(uart1->txQueue, &usartTxItem, &higherPriorityTaskWoken);
//! Write one byte to the transmit data register
USART_SendData(USART1, usartTxItem.byte);
//! check if queue is empty -> all bytes transmit
if(pdTRUE == xQueueIsQueueEmptyFromISR(uart1->txQueue))
{
//! Disable the COMPORT Transmit interrupt and release semaphore
USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
xSemaphoreGiveFromISR(uart1->txSemaphore, &higherPriorityTaskWoken);
}
}
//! Current interrupt is triggered by USART_RXNE (receive register not empty)
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
//! Read one byte from the receive data register
struct usartQueueItem usartRxItem;
//! Reading from reception register automatically clears the RXNE interrupt
usartRxItem.byte = USART_ReceiveData(USART1);
//! Add the byte to the USART RX queue
//! In case of a full queue, the data is dumped
(void)xQueueSendFromISR(uart1->rxQueue, &usartRxItem, &higherPriorityTaskWoken);
}
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
}
/** ----------------------------------------------------------------------------
* @brief Function: USART3_IRQHandler
*
* Dedicated Interrupt Service Routine for USART3
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
void USART3_IRQHandler(void)
{
static signed portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
//! Transmission register empty interrupt
if(USART_GetITStatus(USART3, USART_IT_TXE) != RESET)
{
//! Receive element from usart transmission queue
struct usartQueueItem usartTxItem;
xQueueReceiveFromISR(uart3->txQueue, &usartTxItem, &higherPriorityTaskWoken);
//! Write one byte to the transmit data register
USART_SendData(USART3, usartTxItem.byte);
//! check if queue is empty -> all bytes transmit
if(pdTRUE == xQueueIsQueueEmptyFromISR(uart3->txQueue))
{
//! Disable the COMPORT Transmit interrupt and release semaphore
USART_ITConfig(USART3, USART_IT_TXE, DISABLE);
xSemaphoreGiveFromISR(uart3->txSemaphore, &higherPriorityTaskWoken);
}
}
//! Current interrupt is triggered by USART_RXNE (receive register not empty)
if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET)
{
//! Read one byte from the receive data register
struct usartQueueItem usartRxItem;
//! Reading from reception register automatically clears the RXNE interrupt
usartRxItem.byte = (char)USART_ReceiveData(USART3);
//! Add the byte to the USART RX queue
//! In case of a full queue, the data is dumped
(void)xQueueSendFromISR(uart3->rxQueue, &usartRxItem, &higherPriorityTaskWoken);
}
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
}