Improvements:
- HAL re-organized - FreeRTOS running stable - UART finished - SPI1 & SPI3 finished and functional - Display driver added (functional) git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@172 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -28,8 +28,17 @@
|
||||
// FreeRTOS includes
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "freeRTOSFixes.h"
|
||||
#include "Logger.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "stm32f10x_rcc.h"
|
||||
|
||||
#include "nhd0420.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "led.h"
|
||||
#include "uart.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
@@ -43,6 +52,11 @@ tick hook. */
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct LedTaskArguments
|
||||
{
|
||||
struct Led* led;
|
||||
int frequency;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
@@ -52,12 +66,16 @@ tick hook. */
|
||||
stats. */
|
||||
unsigned long ulRunTimeStatsClock = 0UL;
|
||||
|
||||
static struct LedTaskArguments ledTaskArguments;
|
||||
static xTaskHandle initTaskHandle;
|
||||
static xTaskHandle ledTaskHandle;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
static void initTask(void* parameters);
|
||||
static void ledBlinkTask(void* parameters);
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -66,7 +84,17 @@ unsigned long ulRunTimeStatsClock = 0UL;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
|
||||
|
||||
// Create TaskHandles
|
||||
|
||||
ledTaskArguments.led = ledOrange;
|
||||
ledTaskArguments.frequency = 2;
|
||||
|
||||
xTaskCreate(initTask, (const char* const)"initTask", 1024, NULL, 0, &initTaskHandle);
|
||||
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 1024, &ledTaskArguments, 0, &ledTaskHandle);
|
||||
|
||||
LOGGER_INFO("Starting the scheduler");
|
||||
|
||||
/* Start the scheduler. */
|
||||
vTaskStartScheduler();
|
||||
@@ -83,3 +111,46 @@ void vApplicationTickHook ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void initTask(void* parameters)
|
||||
{
|
||||
initPlatform();
|
||||
|
||||
Logger_initialize(uart1);
|
||||
|
||||
NHD0420_construct(spiDisplay);
|
||||
|
||||
NHD0420_turnOffDisplay();
|
||||
vTaskDelay(1000);
|
||||
NHD0420_clearScreen();
|
||||
vTaskDelay(1000);
|
||||
NHD0420_turnOnDisplay();
|
||||
vTaskDelay(1000);
|
||||
NHD0420_setContrast(30);
|
||||
vTaskDelay(1000);
|
||||
NHD0420_setBacklightBrightness(3);
|
||||
vTaskDelay(1000);
|
||||
NHD0420_setCursorToHome();
|
||||
vTaskDelay(1000);
|
||||
NHD0420_sendData("Hallo Welt", 10);
|
||||
vTaskDelay(1);
|
||||
NHD0420_setCursorToPosition(4, 5);
|
||||
NHD0420_sendData("Koetjeboe", 9);
|
||||
|
||||
}
|
||||
|
||||
static void ledBlinkTask (void* parameters)
|
||||
{
|
||||
struct LedTaskArguments* arguments = (struct LedTaskArguments*) parameters;
|
||||
struct Led* led = arguments->led;
|
||||
int frequency = arguments->frequency;
|
||||
while (1)
|
||||
{
|
||||
LED_turnOn(led);
|
||||
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
||||
LED_turnOff(led);
|
||||
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user