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:
mmi
2017-09-28 14:30:36 +00:00
parent d54c2c497c
commit 83cce4ba74
21 changed files with 615 additions and 232 deletions

View File

@@ -32,7 +32,12 @@
// Include files
// -----------------------------------------------------------------------------
#include "FreeRTOS.h"
#include "semphr.h"
#include "task.h"
#include "platform.h"
#include "IODevice.h"
#include "stm32f10x_exti.h"
@@ -47,6 +52,17 @@
// Type definitions.
// -----------------------------------------------------------------------------
struct KeypadQueueItem
{
char byte;
};
typedef enum
{
RELEASED = 0,
PRESSED = (!RELEASED)
}Keypad_KeyState;
struct keypadElement
{
T_PL_GPIO gpio;
@@ -55,8 +71,19 @@ struct keypadElement
struct Keypad
{
struct IODevice device;
struct keypadElement row[KEYPAD_NUMBER_OF_ROWS];
struct keypadElement column[KEYPAD_NUMBER_OF_COLUMNS];
Keypad_KeyState lastState[KEYPAD_NUMBER_OF_ROWS][KEYPAD_NUMBER_OF_COLUMNS];
xTaskHandle taskHandle;
SemaphoreHandle_t scanSemaphore;
xQueueHandle rxQueue;
int waitToDebounce_ms;
};
struct KeypadParameters
{
int rxQueueSize;
};
// -----------------------------------------------------------------------------
@@ -67,17 +94,48 @@ struct Keypad
* Keypad_construct
* contructor for the Keypad driver
*
* @param self Keypad object to initialize
* @param parameters Parameters to use for initialisation
* @param debounceTime debounce time for the keypad to use
*
* @return ErrorStatus SUCCESS if initialisation was successful
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Keypad_construct(void);
extern ErrorStatus Keypad_construct(struct Keypad* self, struct KeypadParameters* parameters, int debounceTime);
/** ----------------------------------------------------------------------------
* Keypad_destruct
* destructor for the Keypad driver
*
* @param self Keypad object to destruct
*
* @return ErrorStatus SUCCESS if initialisation was successful
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void Keypad_destruct (const struct Keypad* self);
/** ----------------------------------------------------------------------------
* Keypad_getDefaultParameters
* Returns default parameters for a keypad
*
* @param parameters Keypad parameters struct that will be
* filled with default values
*
* @return ErrorStatus SUCCESS if initialisation was successful
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Keypad_getDefaultParameters(struct KeypadParameters* parameters);
extern ErrorStatus Keypad_logModuleInfo(void);
#endif /* KEYPAD_INC_KEYPADMATRIX_H_ */