Replaced LED with more generic class GPIO
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@233 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -25,9 +25,9 @@ ARFLAGS = rs
|
|||||||
OBJECTS = \
|
OBJECTS = \
|
||||||
stm32f10x_it.o \
|
stm32f10x_it.o \
|
||||||
adc.o \
|
adc.o \
|
||||||
|
gpio.o \
|
||||||
IODevice.o \
|
IODevice.o \
|
||||||
keypadMatrix.o \
|
keypadMatrix.o \
|
||||||
led.o \
|
|
||||||
oli_stm32_h107.o \
|
oli_stm32_h107.o \
|
||||||
PCBA.o \
|
PCBA.o \
|
||||||
rtc.o \
|
rtc.o \
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/// @file led.h
|
/// @file gpio.h
|
||||||
/// @brief File description
|
/// @brief File description
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Micro-Key bv
|
// Micro-Key bv
|
||||||
@@ -15,28 +14,26 @@
|
|||||||
/// $Revision$
|
/// $Revision$
|
||||||
/// $Author$
|
/// $Author$
|
||||||
/// $Date$
|
/// $Date$
|
||||||
// (c) 2017 Micro-Key bv
|
// (c) 2015 Micro-Key bv
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// @defgroup {group_name} {group_description}
|
/// @defgroup {group_name} {group_description}
|
||||||
/// Description
|
/// Description
|
||||||
|
|
||||||
/// @file led.h
|
/// @file gpio.h
|
||||||
/// @ingroup {group_name}
|
/// @ingroup {group_name}
|
||||||
|
|
||||||
|
#ifndef INC_GPIO_H_
|
||||||
#ifndef LED_INC_LED_H_
|
#define INC_GPIO_H_
|
||||||
#define LED_INC_LED_H_
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Include files
|
// Include files
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "IODevice.h"
|
#include "IODevice.h"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Constant and macro definitions
|
// Constant and macro definitions
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -44,13 +41,20 @@
|
|||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Type definitions.
|
// Type definitions.
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct Led
|
typedef enum
|
||||||
|
{
|
||||||
|
INPUT = 0,
|
||||||
|
OUTPUT = !INPUT
|
||||||
|
}GpioDirection;
|
||||||
|
|
||||||
|
struct Gpio
|
||||||
{
|
{
|
||||||
struct IODevice device;
|
struct IODevice device;
|
||||||
T_PL_GPIO ledGpio;
|
T_PL_GPIO gpio;
|
||||||
|
GpioDirection direction;
|
||||||
bool status;
|
bool status;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,34 +63,57 @@ struct Led
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus LED_construct (struct Led* self);
|
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
* LED_turnOn
|
* GPIO_construct
|
||||||
* Turns on the LED identified with the ID
|
* Constructs a GPIO as IODevice
|
||||||
*
|
*
|
||||||
* @param ledID Unique identifier of the LED
|
* @param self The GPIO instance
|
||||||
|
* @param direction Direction of the GPIO
|
||||||
|
* - INPUT or OUTPUT
|
||||||
|
* @param io The Input/Output to use
|
||||||
*
|
*
|
||||||
* @return ErrorStatus SUCCESS if init was successful
|
* @return ErrorStatus SUCCESS if construction was successful
|
||||||
* ERROR otherwise
|
* ERROR otherwise
|
||||||
*
|
*
|
||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus LED_turnOn(struct Led* led);
|
extern ErrorStatus GPIO_construct(struct Gpio* self, GpioDirection direction, T_PL_GPIO io);
|
||||||
|
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
* LED_turnOff
|
* GPIO_setValue
|
||||||
* Turns off the LED identified with the ID
|
* Sets value to GPIO self
|
||||||
*
|
*
|
||||||
* @param ledID Unique identifier of the LED
|
* @param self The GPIO instance
|
||||||
|
* @param value the value to use
|
||||||
|
* 0 => Output LOW
|
||||||
|
* 1 => Output HIGH
|
||||||
*
|
*
|
||||||
* @return ErrorStatus SUCCESS if init was successful
|
* @return ErrorStatus SUCCESS if construction was successful
|
||||||
* ERROR otherwise
|
* ERROR otherwise
|
||||||
*
|
*
|
||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus LED_turnOff(struct Led* led);
|
extern ErrorStatus GPIO_setValue(struct Gpio* self, bool value);
|
||||||
|
|
||||||
#endif /* LED_INC_LED_H_ */
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* GPIO_getValue
|
||||||
|
* Gets value from GPIO self
|
||||||
|
*
|
||||||
|
* @param self The GPIO instance
|
||||||
|
* @param value the value that has been read
|
||||||
|
* 0 => Output LOW
|
||||||
|
* 1 => Output HIGH
|
||||||
|
*
|
||||||
|
* @return ErrorStatus SUCCESS if construction was successful
|
||||||
|
* ERROR otherwise
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern ErrorStatus GPIO_getValue(struct Gpio* self, bool* value);
|
||||||
|
|
||||||
|
#endif /* INC_GPIO_H_ */
|
||||||
@@ -64,8 +64,8 @@ typedef struct
|
|||||||
extern struct Pcba* pcba;
|
extern struct Pcba* pcba;
|
||||||
|
|
||||||
// Export of LEDs
|
// Export of LEDs
|
||||||
extern struct Led* const ledGreen;
|
extern struct Gpio* const ledGreen;
|
||||||
extern struct Led* const ledOrange;
|
extern struct Gpio* const ledOrange;
|
||||||
// Export of ADCs
|
// Export of ADCs
|
||||||
extern struct Adc* const adc1;
|
extern struct Adc* const adc1;
|
||||||
// Export of the rtc
|
// Export of the rtc
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/// @file led.c
|
/// @file gpio.c
|
||||||
/// @brief Description
|
/// @brief Description
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Micro-Key bv
|
// Micro-Key bv
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// (c) 2017 Micro-Key bv
|
// (c) 2017 Micro-Key bv
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// @file led.c
|
/// @file gpio.c
|
||||||
/// @ingroup {group_name}
|
/// @ingroup {group_name}
|
||||||
|
|
||||||
|
|
||||||
@@ -25,8 +25,10 @@
|
|||||||
// Include files
|
// Include files
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "led.h"
|
#include "stm32f10x_gpio.h"
|
||||||
|
|
||||||
|
#include "gpio.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Constant and macro definitions
|
// Constant and macro definitions
|
||||||
@@ -39,7 +41,6 @@
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// File-scope variables
|
// File-scope variables
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -58,11 +59,83 @@ static ErrorStatus read(const struct IODevice* self, char* buffer, size_t length
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus LED_construct (struct Led* self)
|
ErrorStatus GPIO_construct(struct Gpio* self, GpioDirection direction, T_PL_GPIO io)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
IODevice_construct(&self->device, read, write);
|
|
||||||
|
returnValue = IODevice_construct(&self->device, read, write);
|
||||||
|
self->direction = direction;
|
||||||
|
self->gpio = io;
|
||||||
|
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ErrorStatus GPIO_setValue(struct Gpio* self, bool value)
|
||||||
|
{
|
||||||
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
|
if (self->direction == OUTPUT)
|
||||||
|
{
|
||||||
|
// Writing to output is valid
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
GPIO_SetBits(self->gpio.GPIO_Typedef, self->gpio.GPIO_InitStruct.GPIO_Pin);
|
||||||
|
self->status = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GPIO_ResetBits(self->gpio.GPIO_Typedef, self->gpio.GPIO_InitStruct.GPIO_Pin);
|
||||||
|
self->status = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Writing to input is invalid
|
||||||
|
returnValue = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ErrorStatus GPIO_getValue(struct Gpio* self, bool* value)
|
||||||
|
{
|
||||||
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
|
if (self->direction == OUTPUT)
|
||||||
|
{
|
||||||
|
// Reading an output is impossible - but returning its current status is valid
|
||||||
|
if(GPIO_ReadOutputDataBit(self->gpio.GPIO_Typedef, self->gpio.GPIO_InitStruct.GPIO_Pin) != 0)
|
||||||
|
{
|
||||||
|
*value = true;
|
||||||
|
self->status = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*value = false;
|
||||||
|
self->status = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Read value on input
|
||||||
|
if(GPIO_ReadInputDataBit(self->gpio.GPIO_Typedef, self->gpio.GPIO_InitStruct.GPIO_Pin) != 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
*value = true;
|
||||||
|
self->status = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*value = false;
|
||||||
|
self->status = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
@@ -70,46 +143,29 @@ ErrorStatus LED_construct (struct Led* self)
|
|||||||
|
|
||||||
static ErrorStatus write(const struct IODevice* self, const char* buffer, size_t length)
|
static ErrorStatus write(const struct IODevice* self, const char* buffer, size_t length)
|
||||||
{
|
{
|
||||||
(void)length;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
if (buffer[0] != 0)
|
if (buffer[0] != 0)
|
||||||
{
|
{
|
||||||
return LED_turnOn((struct Led*)self);
|
returnValue = GPIO_setValue((struct Gpio*)self, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return LED_turnOff((struct Led*)self);
|
returnValue = GPIO_setValue((struct Gpio*)self, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ErrorStatus read(const struct IODevice* self, char* buffer, size_t length, size_t* actualLength)
|
static ErrorStatus read(const struct IODevice* self, char* buffer, size_t length, size_t* actualLength)
|
||||||
{
|
{
|
||||||
struct Led* led = (struct Led*)self;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
bool value;
|
||||||
|
|
||||||
(void)length;
|
(void)length;
|
||||||
*actualLength = 1;
|
*actualLength = 1;
|
||||||
*buffer = (char)led->status;
|
returnValue = GPIO_getValue((struct Gpio*)self, &value);
|
||||||
return SUCCESS;
|
*buffer = (char)value;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus LED_turnOn(struct Led* led)
|
|
||||||
{
|
|
||||||
ErrorStatus returnValue = SUCCESS;
|
|
||||||
|
|
||||||
GPIO_SetBits(led->ledGpio.GPIO_Typedef, led->ledGpio.GPIO_InitStruct.GPIO_Pin);
|
|
||||||
led->status = true;
|
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus LED_turnOff(struct Led* const led)
|
|
||||||
{
|
|
||||||
ErrorStatus returnValue = SUCCESS;
|
|
||||||
|
|
||||||
GPIO_ResetBits(led->ledGpio.GPIO_Typedef, led->ledGpio.GPIO_InitStruct.GPIO_Pin);
|
|
||||||
led->status = false;
|
|
||||||
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
#include "led.h"
|
#include "gpio.h"
|
||||||
#include "PCBA.h"
|
#include "PCBA.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
@@ -87,8 +87,8 @@
|
|||||||
// PCBA information
|
// PCBA information
|
||||||
|
|
||||||
// LEDs
|
// LEDs
|
||||||
static struct Led _ledGreen;
|
static struct Gpio _ledGreen;
|
||||||
static struct Led _ledOrange;
|
static struct Gpio _ledOrange;
|
||||||
|
|
||||||
// ADC
|
// ADC
|
||||||
static struct Adc _adc1;
|
static struct Adc _adc1;
|
||||||
@@ -121,8 +121,8 @@ static struct KeypadParameters _keypadParameters;
|
|||||||
// Note that the pointer content is marked "const"
|
// Note that the pointer content is marked "const"
|
||||||
struct Pcba* pcba;
|
struct Pcba* pcba;
|
||||||
|
|
||||||
struct Led* const ledGreen = &_ledGreen;
|
struct Gpio* const ledGreen = &_ledGreen;
|
||||||
struct Led* const ledOrange = &_ledOrange;
|
struct Gpio* const ledOrange = &_ledOrange;
|
||||||
|
|
||||||
struct Adc* const adc1 = &_adc1;
|
struct Adc* const adc1 = &_adc1;
|
||||||
struct AdcParameters* adc1Parameters = &_adc1Parameters;
|
struct AdcParameters* adc1Parameters = &_adc1Parameters;
|
||||||
@@ -187,8 +187,8 @@ ErrorStatus initPlatform(void)
|
|||||||
/* --------------------------------------------------------------------*/
|
/* --------------------------------------------------------------------*/
|
||||||
/* LEDs */
|
/* LEDs */
|
||||||
/* --------------------------------------------------------------------*/
|
/* --------------------------------------------------------------------*/
|
||||||
LED_construct(ledGreen);
|
GPIO_construct(ledGreen, OUTPUT, ledGreen->gpio);
|
||||||
LED_construct(ledOrange);
|
GPIO_construct(ledOrange, OUTPUT, ledOrange->gpio);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------*/
|
/* --------------------------------------------------------------------*/
|
||||||
/* DMA1 - Channel 1 - For use with ADC1 */
|
/* DMA1 - Channel 1 - For use with ADC1 */
|
||||||
@@ -437,18 +437,18 @@ static ErrorStatus initIO (void)
|
|||||||
|
|
||||||
/*LED IO initialisation --------------------------------------------------*/
|
/*LED IO initialisation --------------------------------------------------*/
|
||||||
// Init LED Green
|
// Init LED Green
|
||||||
ledGreen->ledGpio.GPIO_Typedef = GPIOC;
|
ledGreen->gpio.GPIO_Typedef = GPIOC;
|
||||||
ledGreen->ledGpio.GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
ledGreen->gpio.GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
ledGreen->ledGpio.GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6;
|
ledGreen->gpio.GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6;
|
||||||
ledGreen->ledGpio.GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
ledGreen->gpio.GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_Init(ledGreen->ledGpio.GPIO_Typedef, &ledGreen->ledGpio.GPIO_InitStruct);
|
GPIO_Init(ledGreen->gpio.GPIO_Typedef, &ledGreen->gpio.GPIO_InitStruct);
|
||||||
|
|
||||||
// Init LED Orange
|
// Init LED Orange
|
||||||
ledOrange->ledGpio.GPIO_Typedef = GPIOC;
|
ledOrange->gpio.GPIO_Typedef = GPIOC;
|
||||||
ledOrange->ledGpio.GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
ledOrange->gpio.GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
ledOrange->ledGpio.GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7;
|
ledOrange->gpio.GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7;
|
||||||
ledOrange->ledGpio.GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
ledOrange->gpio.GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_Init(ledOrange->ledGpio.GPIO_Typedef, &ledOrange->ledGpio.GPIO_InitStruct);
|
GPIO_Init(ledOrange->gpio.GPIO_Typedef, &ledOrange->gpio.GPIO_InitStruct);
|
||||||
|
|
||||||
/* ADC1 initialisation ---------------------------------------------------*/
|
/* ADC1 initialisation ---------------------------------------------------*/
|
||||||
// Channel 0 - PA0
|
// Channel 0 - PA0
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Constant and macro definitions
|
// Constant and macro definitions
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Constant and macro definitions
|
// Constant and macro definitions
|
||||||
@@ -95,7 +94,6 @@ caddr_t _sbrk(int incr)
|
|||||||
// Stack overflow hook
|
// Stack overflow hook
|
||||||
void vApplicationStackOverflowHook(xTaskHandle xTask, signed portCHAR* pcTaskName)
|
void vApplicationStackOverflowHook(xTaskHandle xTask, signed portCHAR* pcTaskName)
|
||||||
{
|
{
|
||||||
LED_turnOn(ledGreen);
|
|
||||||
LOGGER_ERROR("STACK OVERFLOW IN TASK %s", pcTaskName);
|
LOGGER_ERROR("STACK OVERFLOW IN TASK %s", pcTaskName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,9 +45,9 @@
|
|||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
|
#include "gpio.h"
|
||||||
#include "IODevice.h"
|
#include "IODevice.h"
|
||||||
#include "keypadMatrix.h"
|
#include "keypadMatrix.h"
|
||||||
#include "led.h"
|
|
||||||
#include "PCBA.h"
|
#include "PCBA.h"
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
@@ -68,7 +68,7 @@ tick hook. */
|
|||||||
|
|
||||||
struct LedTaskArguments
|
struct LedTaskArguments
|
||||||
{
|
{
|
||||||
struct Led* led;
|
struct Gpio* led;
|
||||||
int frequency;
|
int frequency;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -158,8 +158,8 @@ static ErrorStatus systeminfoCommandHandler(void)
|
|||||||
OS_logTaskInfo(ledTaskHandle);
|
OS_logTaskInfo(ledTaskHandle);
|
||||||
vTaskDelay(100);
|
vTaskDelay(100);
|
||||||
OS_logTaskInfo(sysTaskHandle);
|
OS_logTaskInfo(sysTaskHandle);
|
||||||
vTaskDelay(100);
|
// vTaskDelay(100);
|
||||||
OS_logTaskInfo(display->taskHandle);
|
// OS_logTaskInfo(display->taskHandle);
|
||||||
|
|
||||||
return errorStatus;
|
return errorStatus;
|
||||||
}
|
}
|
||||||
@@ -168,9 +168,9 @@ static void initTask(void* parameters)
|
|||||||
{
|
{
|
||||||
initPlatform();
|
initPlatform();
|
||||||
|
|
||||||
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 40, &ledTaskArguments, 0, &ledTaskHandle);
|
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 50, &ledTaskArguments, 0, &ledTaskHandle);
|
||||||
|
|
||||||
Logger_construct(&uart3->device);
|
Logger_construct(&uart1->device);
|
||||||
|
|
||||||
NHD0420_construct(&nhd0420, &spiDisplay->device);
|
NHD0420_construct(&nhd0420, &spiDisplay->device);
|
||||||
|
|
||||||
@@ -203,13 +203,13 @@ static void ledBlinkTask (void* parameters)
|
|||||||
char high = 1;
|
char high = 1;
|
||||||
char low = 0;
|
char low = 0;
|
||||||
struct LedTaskArguments* arguments = (struct LedTaskArguments*) parameters;
|
struct LedTaskArguments* arguments = (struct LedTaskArguments*) parameters;
|
||||||
struct Led* led = arguments->led;
|
struct Gpio* gpio = arguments->led;
|
||||||
int frequency = arguments->frequency;
|
int frequency = arguments->frequency;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
IODevice_write(&led->device, &high, 1);
|
IODevice_write(&gpio->device, &high, 1);
|
||||||
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
||||||
IODevice_write(&led->device, &low, 1);
|
IODevice_write(&gpio->device, &low, 1);
|
||||||
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "led.h"
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user