keypad functional
started with external DAC implementation git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@224 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
<option id="gnu.c.compiler.option.debugging.level.1951365338" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
<option id="gnu.c.compiler.option.debugging.level.1951365338" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||||
<option id="gnu.c.compiler.option.include.paths.35161744" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
<option id="gnu.c.compiler.option.include.paths.35161744" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/hsb-mrts/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x}""/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1588900239" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1588900239" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ ARFLAGS = rs
|
|||||||
OBJECTS = \
|
OBJECTS = \
|
||||||
IODevice.o \
|
IODevice.o \
|
||||||
keypadMatrix.o \
|
keypadMatrix.o \
|
||||||
|
MAX5715.o \
|
||||||
nhd0420.o
|
nhd0420.o
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/// @file MAX5715.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) 2015 Micro-Key bv
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// @defgroup {group_name} {group_description}
|
||||||
|
/// Description
|
||||||
|
|
||||||
|
/// @file MAX5715.h
|
||||||
|
/// @ingroup {group_name}
|
||||||
|
|
||||||
|
#ifndef INC_MAX5715_H_
|
||||||
|
#define INC_MAX5715_H_
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Include files
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "IODevice.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Constant and macro definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define MAX5715_SEL_DACA (0x0)
|
||||||
|
#define MAX5715_SEL_DACB (0x1)
|
||||||
|
#define MAX5715_SEL_DACC (0x2)
|
||||||
|
#define MAX5715_SEL_DACD (0x4)
|
||||||
|
|
||||||
|
#define MAX5715_CMD_CODEn (0x00)
|
||||||
|
#define MAX5715_CMD_LOADn (0x10)
|
||||||
|
#define MAX5715_CMD_CODEn_LOAD_ALL (0x20)
|
||||||
|
#define MAX5715_CMD_CODEn_LOADn (0x30)
|
||||||
|
#define MAX5715_CMD_POWER_NORMAL (0x40)
|
||||||
|
#define MAX5715_CMD_POWER_PD1K (0x41)
|
||||||
|
#define MAX5715_CMD_POWER_PD100K (0x42)
|
||||||
|
#define MAX5715_CMD_POWER_HIGHZ (0x43)
|
||||||
|
#define MAX5715_CMD_SW_CLEAR (0x50)
|
||||||
|
#define MAX5715_CMD_SW_RESET (0x51)
|
||||||
|
#define MAX5715_CMD_CONFIG_LATCH_ON (0x60)
|
||||||
|
#define MAX5715_CMD_CONFIG_LATCH_OFF (0x61)
|
||||||
|
#define MAX5715_CMD_REF_DAC_EXT (0x70)
|
||||||
|
#define MAX5715_CMD_REF_DAC_2V5 (0x71)
|
||||||
|
#define MAX5715_CMD_REF_DAC_2V0 (0x72)
|
||||||
|
#define MAX5715_CMD_REF_DAC_4V0 (0x73)
|
||||||
|
#define MAX5715_CMD_REF_ON_EXT (0x74)
|
||||||
|
#define MAX5715_CMD_REF_ON_2V5 (0x75)
|
||||||
|
#define MAX5715_CMD_REF_ON_2V0 (0x76)
|
||||||
|
#define MAX5715_CMD_REF_ON_4V0 (0x77)
|
||||||
|
#define MAX5715_CMD_CODE_ALL (0x80)
|
||||||
|
#define MAX5715_CMD_LOAD_ALL (0x81)
|
||||||
|
#define MAX5715_CMD_CODE_ALL_LOAD_ALL (0x82)
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Type definitions.
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function declarations
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* MAX5715_construct
|
||||||
|
* Description of function
|
||||||
|
*
|
||||||
|
* @param self
|
||||||
|
*
|
||||||
|
* @return ErrorStatus
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
extern ErrorStatus MAX5715_construct(const struct IODevice* self, para2_name);
|
||||||
|
|
||||||
|
#endif /* INC_MAX5715_H_ */
|
||||||
@@ -91,25 +91,25 @@
|
|||||||
#define NHD0420_CMD_SHOW_RS232_BR (0x71)
|
#define NHD0420_CMD_SHOW_RS232_BR (0x71)
|
||||||
#define NHD0420_CMD_SHOW_I2C_ADDRSS (0x72)
|
#define NHD0420_CMD_SHOW_I2C_ADDRSS (0x72)
|
||||||
|
|
||||||
#define NHD0420_turnOnDisplay() NHD0420_sendCommand(NHD0420_CMD_DISPLAY_ON)
|
#define NHD0420_turnOnDisplay(a) NHD0420_sendCommand(a, NHD0420_CMD_DISPLAY_ON)
|
||||||
#define NHD0420_turnOffDisplay() NHD0420_sendCommand(NHD0420_CMD_DISPLAY_OFF)
|
#define NHD0420_turnOffDisplay(a) NHD0420_sendCommand(a, NHD0420_CMD_DISPLAY_OFF)
|
||||||
|
|
||||||
#define NHD0420_setCursorToHome() NHD0420_sendCommand(NHD0420_CMD_CURSOR_HOME)
|
#define NHD0420_setCursorToHome(a) NHD0420_sendCommand(a, NHD0420_CMD_CURSOR_HOME)
|
||||||
#define NHD0420_setUnderlineCursorOn() NHD0420_sendCommand(NHD0420_CMD_CURSOR_UL_ON)
|
#define NHD0420_setUnderlineCursorOn(a) NHD0420_sendCommand(a, NHD0420_CMD_CURSOR_UL_ON)
|
||||||
#define NHD0420_setUnderlineCursorOff() NHD0420_sendCommand(NHD0420_CMD_CURSOR_UL_OFF)
|
#define NHD0420_setUnderlineCursorOff(a) NHD0420_sendCommand(a, NHD0420_CMD_CURSOR_UL_OFF)
|
||||||
#define NHD0420_moveCursorToLeft() NHD0420_sendCommand(NHD0420_CMD_CURSOR_MV_LEFT)
|
#define NHD0420_moveCursorToLeft(a) NHD0420_sendCommand(a, NHD0420_CMD_CURSOR_MV_LEFT)
|
||||||
#define NHD0420_moveCursorToRight() NHD0420_sendCommand(NHD0420_CMD_CURSOR_MV_RIGHT)
|
#define NHD0420_moveCursorToRight(a) NHD0420_sendCommand(a, NHD0420_CMD_CURSOR_MV_RIGHT)
|
||||||
#define NHD0420_turnOnBlinkingCursor() NHD0420_sendCommand(NHD0420_CMD_CURSOR_BLK_ON)
|
#define NHD0420_turnOnBlinkingCursor(a) NHD0420_sendCommand(a, NHD0420_CMD_CURSOR_BLK_ON)
|
||||||
#define NHD0420_turnOffBlinkingCursor() NHD0420_sendCommand(NHD0420_CMD_CURSOR_BLK_OFF)
|
#define NHD0420_turnOffBlinkingCursor(a) NHD0420_sendCommand(a, NHD0420_CMD_CURSOR_BLK_OFF)
|
||||||
#define NHD0420_useBackspace() NHD0420_sendCommand(NHD0420_CMD_CURSOR_BACKSPACE)
|
#define NHD0420_useBackspace(a) NHD0420_sendCommand(a, NHD0420_CMD_CURSOR_BACKSPACE)
|
||||||
#define NHD0420_clearScreen() NHD0420_sendCommand(NHD0420_CMD_CLR_SCREEN)
|
#define NHD0420_clearScreen(a) NHD0420_sendCommand(a, NHD0420_CMD_CLR_SCREEN)
|
||||||
|
|
||||||
#define NHD0420_moveDisplayToLeft() NHD0420_sendCommand(NHD0420_CMD_MV_DISPLAY_LEFT)
|
#define NHD0420_moveDisplayToLeft(a) NHD0420_sendCommand(a, NHD0420_CMD_MV_DISPLAY_LEFT)
|
||||||
#define NHD0420_moveDisplayToRight() NHD0420_sendCommand(NHD0420_CMD_MV_DISPLAY_RIGHT)
|
#define NHD0420_moveDisplayToRight(a) NHD0420_sendCommand(a, NHD0420_CMD_MV_DISPLAY_RIGHT)
|
||||||
|
|
||||||
#define NHD0420_showFirmwareVersion() NHD0420_sendCommand(NHD0420_CMD_SHOW_VERSION)
|
#define NHD0420_showFirmwareVersion(a) NHD0420_sendCommand(a, NHD0420_CMD_SHOW_VERSION)
|
||||||
#define NHD0420_showRS232Baudrate() NHD0420_sendCommand(NHD0420_CMD_SHOW_RS232_BR)
|
#define NHD0420_showRS232Baudrate(a) NHD0420_sendCommand(a, NHD0420_CMD_SHOW_RS232_BR)
|
||||||
#define NHD0420_showI2CAddress() NHD0420_sendCommand(NHD0420_CMD_SHOW_I2C_ADDRSS)
|
#define NHD0420_showI2CAddress(a) NHD0420_sendCommand(a, NHD0420_CMD_SHOW_I2C_ADDRSS)
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Type definitions.
|
// Type definitions.
|
||||||
@@ -148,7 +148,7 @@ extern ErrorStatus NHD0420_construct(const struct IODevice* const device);
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern void NHD0420_destruct(void);
|
extern void NHD0420_destruct(const struct IODevice* self);
|
||||||
|
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
@@ -178,7 +178,7 @@ extern ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters);
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus NHD0420_setCursorToPosition(char row, char column);
|
extern ErrorStatus NHD0420_setCursorToPosition(const struct IODevice* self, char row, char column);
|
||||||
|
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
@@ -195,7 +195,7 @@ extern ErrorStatus NHD0420_setCursorToPosition(char row, char column);
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus NHD0420_setContrast(char contrast);
|
extern ErrorStatus NHD0420_setContrast(const struct IODevice* self, char contrast);
|
||||||
|
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
@@ -212,7 +212,7 @@ extern ErrorStatus NHD0420_setContrast(char contrast);
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus NHD0420_setBacklightBrightness(char brightness);
|
extern ErrorStatus NHD0420_setBacklightBrightness(const struct IODevice* self, char brightness);
|
||||||
|
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
@@ -237,7 +237,7 @@ extern ErrorStatus NHD0420_setBacklightBrightness(char brightness);
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus NHD0420_setRS232Baudrate(char baudrate);
|
extern ErrorStatus NHD0420_setRS232Baudrate(const struct IODevice* self, char baudrate);
|
||||||
|
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
@@ -263,7 +263,7 @@ extern ErrorStatus NHD0420_setRS232Baudrate(char baudrate);
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus NHD0420_setI2CAddress(char address);
|
extern ErrorStatus NHD0420_setI2CAddress(const struct IODevice* self, char address);
|
||||||
|
|
||||||
/** ----------------------------------------------------------------------------
|
/** ----------------------------------------------------------------------------
|
||||||
* NHD0420_SendCommand
|
* NHD0420_SendCommand
|
||||||
@@ -277,8 +277,8 @@ extern ErrorStatus NHD0420_setI2CAddress(char address);
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
extern ErrorStatus NHD0420_sendCommand(char command);
|
extern ErrorStatus NHD0420_sendCommand(const struct IODevice* self, char command);
|
||||||
|
|
||||||
extern ErrorStatus NHD0420_sendData(const char* buffer, size_t length);
|
extern ErrorStatus NHD0420_sendData(const struct IODevice* self, const char* buffer, size_t length);
|
||||||
|
|
||||||
#endif /* DISPLAY_INC_NHD0420_H_ */
|
#endif /* DISPLAY_INC_NHD0420_H_ */
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/// @file MAX5715.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 MAX5715.c
|
||||||
|
/// @ingroup {group_name}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Include files
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Constant and macro definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Type definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// File-scope variables
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function declarations
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function definitions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
@@ -188,7 +188,10 @@ static void KeypadTask(void* parameters)
|
|||||||
{
|
{
|
||||||
if (self->lastState[rowCounter][colCounter] == PRESSED)
|
if (self->lastState[rowCounter][colCounter] == PRESSED)
|
||||||
{
|
{
|
||||||
|
self->lastState[rowCounter][colCounter] = RELEASED;
|
||||||
// Key has been released
|
// Key has been released
|
||||||
|
LOGGER_DEBUG("KEY row%d, column%d released", rowCounter, colCounter);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -199,7 +202,9 @@ static void KeypadTask(void* parameters)
|
|||||||
{
|
{
|
||||||
if (self->lastState[rowCounter][colCounter] == RELEASED)
|
if (self->lastState[rowCounter][colCounter] == RELEASED)
|
||||||
{
|
{
|
||||||
|
self->lastState[rowCounter][colCounter] = PRESSED;
|
||||||
// Key has been pressed
|
// Key has been pressed
|
||||||
|
LOGGER_DEBUG("KEY row%d, column%d pressed", rowCounter, colCounter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ static int nhd0420_cursorRowOffset[NHD0420_NUMBER_OF_ROWS] =
|
|||||||
NHD0420_CURSOR_OFFSET_ROW4
|
NHD0420_CURSOR_OFFSET_ROW4
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct IODevice* displayDevice = NULL;
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Function declarations
|
// Function declarations
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -76,20 +74,11 @@ ErrorStatus NHD0420_construct(const struct IODevice* const device)
|
|||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
if (displayDevice == NULL)
|
|
||||||
{
|
|
||||||
displayDevice = device;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
returnValue = ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NHD0420_destruct (void)
|
void NHD0420_destruct (const struct IODevice* self)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -138,7 +127,7 @@ ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus NHD0420_setCursorToPosition(char row, char column)
|
ErrorStatus NHD0420_setCursorToPosition(const struct IODevice* self, char row, char column)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
@@ -161,14 +150,14 @@ ErrorStatus NHD0420_setCursorToPosition(char row, char column)
|
|||||||
{
|
{
|
||||||
char address = nhd0420_cursorRowOffset[(int)row] + column;
|
char address = nhd0420_cursorRowOffset[(int)row] + column;
|
||||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CURSOR_SET, address};
|
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CURSOR_SET, address};
|
||||||
returnValue = NHD0420_sendData(buffer, 3);
|
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus NHD0420_setContrast(char contrast)
|
ErrorStatus NHD0420_setContrast(const struct IODevice* self, char contrast)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
@@ -187,14 +176,14 @@ ErrorStatus NHD0420_setContrast(char contrast)
|
|||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_CONTRAST, contrast};
|
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_CONTRAST, contrast};
|
||||||
returnValue = NHD0420_sendData(buffer, 3);
|
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus NHD0420_setBacklightBrightness(char brightness)
|
ErrorStatus NHD0420_setBacklightBrightness(const struct IODevice* self, char brightness)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
@@ -213,14 +202,14 @@ ErrorStatus NHD0420_setBacklightBrightness(char brightness)
|
|||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_BRIGHTNESS, brightness};
|
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_BRIGHTNESS, brightness};
|
||||||
returnValue = NHD0420_sendData(buffer, 3);
|
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus NHD0420_setRS232Baudrate(char baudrate)
|
ErrorStatus NHD0420_setRS232Baudrate(const struct IODevice* self, char baudrate)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
@@ -238,13 +227,13 @@ ErrorStatus NHD0420_setRS232Baudrate(char baudrate)
|
|||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_RS232_BR, baudrate};
|
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_RS232_BR, baudrate};
|
||||||
returnValue = NHD0420_sendData(buffer, 3);
|
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus NHD0420_setI2CAddress(char address)
|
ErrorStatus NHD0420_setI2CAddress(const struct IODevice* self, char address)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
@@ -262,7 +251,7 @@ ErrorStatus NHD0420_setI2CAddress(char address)
|
|||||||
if (returnValue == SUCCESS)
|
if (returnValue == SUCCESS)
|
||||||
{
|
{
|
||||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_I2C_ADDRSS, address};
|
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_I2C_ADDRSS, address};
|
||||||
returnValue = NHD0420_sendData(buffer, 3);
|
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
@@ -279,23 +268,23 @@ ErrorStatus NHD0420_setI2CAddress(char address)
|
|||||||
* @todo
|
* @todo
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
ErrorStatus NHD0420_sendCommand(char command)
|
ErrorStatus NHD0420_sendCommand(const struct IODevice* self, char command)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
char buffer[NHD0420_CMD_LENGTH] = {NHD0420_CMD_PREFIX, command};
|
char buffer[NHD0420_CMD_LENGTH] = {NHD0420_CMD_PREFIX, command};
|
||||||
|
|
||||||
returnValue = IODevice_write(displayDevice, buffer, NHD0420_CMD_LENGTH);
|
returnValue = IODevice_write(self, buffer, NHD0420_CMD_LENGTH);
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorStatus NHD0420_sendData(const char* buffer, size_t length)
|
ErrorStatus NHD0420_sendData(const struct IODevice* self, const char* buffer, size_t length)
|
||||||
{
|
{
|
||||||
ErrorStatus returnValue = SUCCESS;
|
ErrorStatus returnValue = SUCCESS;
|
||||||
|
|
||||||
returnValue = IODevice_write(displayDevice, buffer, length);
|
returnValue = IODevice_write(self, buffer, length);
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ static ErrorStatus write(const struct IODevice* self, const char* buffer, size_t
|
|||||||
{
|
{
|
||||||
(void)length;
|
(void)length;
|
||||||
|
|
||||||
if (buffer != 0)
|
if (buffer[0] != 0)
|
||||||
{
|
{
|
||||||
return LED_turnOn((struct Led*)self);
|
return LED_turnOn((struct Led*)self);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,8 +202,8 @@ ErrorStatus initPlatform(void)
|
|||||||
keypad->column[3].EXTI_InitStruct.EXTI_LineCmd = ENABLE;
|
keypad->column[3].EXTI_InitStruct.EXTI_LineCmd = ENABLE;
|
||||||
EXTI_Init(&keypad->column[3].EXTI_InitStruct);
|
EXTI_Init(&keypad->column[3].EXTI_InitStruct);
|
||||||
|
|
||||||
IRQ_setInterruptProperties(EXTI4_IRQn, 11, 0, ENABLE);
|
IRQ_setInterruptProperties(EXTI4_IRQn, 12, 12, ENABLE);
|
||||||
IRQ_setInterruptProperties(EXTI9_5_IRQn, 11, 0, ENABLE);
|
IRQ_setInterruptProperties(EXTI9_5_IRQn, 12, 12, ENABLE);
|
||||||
|
|
||||||
Keypad_getDefaultParameters(keypadParam);
|
Keypad_getDefaultParameters(keypadParam);
|
||||||
Keypad_construct(keypad, keypadParam, KEYPAD_DEBOUNCE_TIME_MS);
|
Keypad_construct(keypad, keypadParam, KEYPAD_DEBOUNCE_TIME_MS);
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
<option id="gnu.c.compiler.option.debugging.level.539814773" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
<option id="gnu.c.compiler.option.debugging.level.539814773" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||||
<option id="gnu.c.compiler.option.include.paths.1508262411" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
<option id="gnu.c.compiler.option.include.paths.1508262411" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/HAL/Misc/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/HAL/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/HAL/Platform/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/Platform/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/Source/portable/GCC/ARM_CM3}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/Source/portable/GCC/ARM_CM3}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/Source/include}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/Source/include}""/>
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
@@ -97,8 +97,6 @@ ErrorStatus Logger_construct(struct IODevice* const device)
|
|||||||
|
|
||||||
if(!initialized)
|
if(!initialized)
|
||||||
{
|
{
|
||||||
|
|
||||||
///TODO This is currently hardcoded into the UART - there must be a way for more generic usage
|
|
||||||
loggerDevice = device;
|
loggerDevice = device;
|
||||||
|
|
||||||
if(returnValue == SUCCESS)
|
if(returnValue == SUCCESS)
|
||||||
|
|||||||
@@ -155,18 +155,19 @@ static void initTask(void* parameters)
|
|||||||
|
|
||||||
NHD0420_construct(&spiDisplay->device);
|
NHD0420_construct(&spiDisplay->device);
|
||||||
|
|
||||||
NHD0420_turnOffDisplay();
|
NHD0420_turnOffDisplay(&spiDisplay->device);
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
NHD0420_clearScreen();
|
NHD0420_clearScreen(&spiDisplay->device);
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
NHD0420_turnOnDisplay();
|
NHD0420_turnOnDisplay(&spiDisplay->device);
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
NHD0420_setContrast(30);
|
NHD0420_setContrast(&spiDisplay->device, 30);
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
NHD0420_setBacklightBrightness(3);
|
NHD0420_setBacklightBrightness(&spiDisplay->device, 3);
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
NHD0420_setCursorToHome();
|
NHD0420_setCursorToHome(&spiDisplay->device);
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
|
NHD0420_sendData(&spiDisplay->device, "Anode repair A", 20);
|
||||||
|
|
||||||
|
|
||||||
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 40, &ledTaskArguments, 0, &ledTaskHandle);
|
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 40, &ledTaskArguments, 0, &ledTaskHandle);
|
||||||
|
|||||||
@@ -285,10 +285,6 @@ void EXTI4_IRQHandler(void)
|
|||||||
|
|
||||||
IRQ_setKeypadEXTI(keypad, DISABLE);
|
IRQ_setKeypadEXTI(keypad, DISABLE);
|
||||||
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
||||||
|
|
||||||
LOGGER_INFO_ISR("EXT4 ISR");
|
|
||||||
|
|
||||||
|
|
||||||
EXTI_ClearITPendingBit(EXTI_Line4);
|
EXTI_ClearITPendingBit(EXTI_Line4);
|
||||||
|
|
||||||
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
||||||
@@ -302,21 +298,18 @@ void EXTI9_5_IRQHandler (void)
|
|||||||
{
|
{
|
||||||
IRQ_setKeypadEXTI(keypad, DISABLE);
|
IRQ_setKeypadEXTI(keypad, DISABLE);
|
||||||
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
||||||
LOGGER_INFO_ISR("EXT5 ISR");
|
|
||||||
EXTI_ClearITPendingBit(EXTI_Line5);
|
EXTI_ClearITPendingBit(EXTI_Line5);
|
||||||
}
|
}
|
||||||
else if (EXTI_GetITStatus(EXTI_Line6) != RESET)
|
else if (EXTI_GetITStatus(EXTI_Line6) != RESET)
|
||||||
{
|
{
|
||||||
IRQ_setKeypadEXTI(keypad, DISABLE);
|
IRQ_setKeypadEXTI(keypad, DISABLE);
|
||||||
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
||||||
LOGGER_INFO_ISR("EXT6 ISR");
|
|
||||||
EXTI_ClearITPendingBit(EXTI_Line6);
|
EXTI_ClearITPendingBit(EXTI_Line6);
|
||||||
}
|
}
|
||||||
else if (EXTI_GetITStatus(EXTI_Line7) != RESET)
|
else if (EXTI_GetITStatus(EXTI_Line7) != RESET)
|
||||||
{
|
{
|
||||||
IRQ_setKeypadEXTI(keypad, DISABLE);
|
IRQ_setKeypadEXTI(keypad, DISABLE);
|
||||||
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
xSemaphoreGiveFromISR(keypad->scanSemaphore, &higherPriorityTaskWoken);
|
||||||
LOGGER_INFO_ISR("EXT7 ISR");
|
|
||||||
EXTI_ClearITPendingBit(EXTI_Line7);
|
EXTI_ClearITPendingBit(EXTI_Line7);
|
||||||
}
|
}
|
||||||
else if (EXTI_GetITStatus(EXTI_Line8) != RESET)
|
else if (EXTI_GetITStatus(EXTI_Line8) != RESET)
|
||||||
|
|||||||
Reference in New Issue
Block a user