re-organized HAL
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@220 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file keypadMatrix.h
|
||||
/// @brief File description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2017 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file keypadMatrix.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
#ifndef KEYPAD_INC_KEYPADMATRIX_H_
|
||||
#define KEYPAD_INC_KEYPADMATRIX_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "IODevice.h"
|
||||
|
||||
#include "stm32f10x_exti.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define KEYPAD_NUMBER_OF_ROWS (4)
|
||||
#define KEYPAD_NUMBER_OF_COLUMNS (4)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct KeypadQueueItem
|
||||
{
|
||||
char byte;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RELEASED = 0,
|
||||
PRESSED = (!RELEASED)
|
||||
}Keypad_KeyState;
|
||||
|
||||
struct keypadElement
|
||||
{
|
||||
T_PL_GPIO gpio;
|
||||
EXTI_InitTypeDef EXTI_InitStruct;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* 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(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);
|
||||
|
||||
|
||||
|
||||
#endif /* KEYPAD_INC_KEYPADMATRIX_H_ */
|
||||
Reference in New Issue
Block a user