git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@245 05563f52-14a8-4384-a975-3d1654cca0fa
89 lines
2.6 KiB
C
89 lines
2.6 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file KeyboardDevice.c
|
|
/// @brief 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
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/// @file KeyboardDevice.c
|
|
/// @ingroup {group_name}
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "KeyboardDevice.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// File-scope variables
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
ErrorStatus KeyboardDevice_construct (struct KeyboardDevice* self, struct KeyboardDeviceParameters* parameters, KeyboardReadFunction read)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
if (!self->initialized)
|
|
{
|
|
self->_read = read;
|
|
self->parameters = *parameters;
|
|
self->initialized = true;
|
|
}
|
|
else
|
|
{
|
|
returnValue = ERROR;
|
|
}
|
|
|
|
return returnValue;
|
|
}
|
|
|
|
ErrorStatus KeyboardDevice_read(const struct KeyboardDevice* self, char* buffer, Keypad_KeyState* keyState)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
if (self->_read != NULL)
|
|
{
|
|
returnValue = self->_read(self, buffer, keyState);
|
|
}
|
|
|
|
return returnValue;
|
|
}
|