Fixed some minor issues/bugs git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@284 05563f52-14a8-4384-a975-3d1654cca0fa
130 lines
6.6 KiB
C
130 lines
6.6 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file DisplayDevice.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 DisplayDevice.h
|
|
/// @ingroup {group_name}
|
|
|
|
#ifndef INC_DISPLAYDEVICE_H_
|
|
#define INC_DISPLAYDEVICE_H_
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions.
|
|
// -----------------------------------------------------------------------------
|
|
|
|
typedef enum
|
|
{
|
|
OFF = 0,
|
|
ON = !OFF
|
|
} DisplayDevice_functionalState;
|
|
|
|
struct DisplayDevice;
|
|
|
|
typedef ErrorStatus (*DisplayResetFunction)(const struct DisplayDevice* self);
|
|
typedef ErrorStatus (*DisplaySetStateFunction)(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
|
typedef ErrorStatus (*DisplayBackspaceFunction)(const struct DisplayDevice* self);
|
|
typedef ErrorStatus (*DisplayCursorPositionFunction)(const struct DisplayDevice* self, unsigned int row, unsigned int column);
|
|
typedef ErrorStatus (*DisplayWriteFunction)(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column);
|
|
typedef ErrorStatus (*DisplayWriteCharacterFunction)(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column);
|
|
typedef ErrorStatus (*DisplayClearFunction)(const struct DisplayDevice* self);
|
|
typedef ErrorStatus (*DisplayClearLineFunction)(const struct DisplayDevice* self, unsigned int row);
|
|
typedef ErrorStatus (*DisplaySetBrightnessFunction)(const struct DisplayDevice* self, unsigned int brightness);
|
|
typedef ErrorStatus (*DisplaySetContrastFunction)(const struct DisplayDevice* self, unsigned int contrast);
|
|
typedef ErrorStatus (*DisplayInvertFunction)(const struct DisplayDevice* self);
|
|
typedef ErrorStatus (*DisplaySetBlinkingCursor)(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
|
|
|
struct DisplayDeviceParameters
|
|
{
|
|
unsigned int numberOfRows;
|
|
unsigned int numberOfColumns;
|
|
unsigned int contrastMin;
|
|
unsigned int contrastMax;
|
|
unsigned int brightnessMin;
|
|
unsigned int brightnessMax;
|
|
};
|
|
|
|
struct DisplayDevice
|
|
{
|
|
DisplayResetFunction _reset;
|
|
DisplaySetStateFunction _setState;
|
|
DisplayBackspaceFunction _backspace;
|
|
DisplayCursorPositionFunction _setCursorToPosition;
|
|
DisplayWriteCharacterFunction _writeCharacter;
|
|
DisplayWriteFunction _write;
|
|
DisplayClearFunction _clear;
|
|
DisplayClearLineFunction _clearLine;
|
|
DisplaySetBrightnessFunction _setBrightness;
|
|
DisplaySetContrastFunction _setContrast;
|
|
DisplayInvertFunction _invert;
|
|
DisplaySetBlinkingCursor _setBlinkingCursor;
|
|
struct DisplayDeviceParameters parameters;
|
|
bool initialized;
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
extern ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayDeviceParameters* parameters,
|
|
DisplayResetFunction reset,
|
|
DisplaySetStateFunction setState,
|
|
DisplayBackspaceFunction backspace,
|
|
DisplayCursorPositionFunction setCursorToPosition,
|
|
DisplayWriteCharacterFunction writeCharacter,
|
|
DisplayWriteFunction write,
|
|
DisplayClearFunction clear,
|
|
DisplayClearLineFunction clearLine,
|
|
DisplaySetBrightnessFunction setBrightness,
|
|
DisplaySetContrastFunction setContrast,
|
|
DisplayInvertFunction invert,
|
|
DisplaySetBlinkingCursor setBlinkingCursor);
|
|
|
|
extern ErrorStatus DisplayDevice_reset(const struct DisplayDevice* self);
|
|
extern ErrorStatus DisplayDevice_setState(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
|
extern ErrorStatus DisplayDevice_backspace(const struct DisplayDevice* self);
|
|
extern ErrorStatus DisplayDevice_setCursorToPosition(const struct DisplayDevice* self, unsigned int row, unsigned int column);
|
|
extern ErrorStatus DisplayDevice_writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column);
|
|
extern ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column);
|
|
extern ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self);
|
|
extern ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, unsigned int row);
|
|
extern ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, unsigned int brightness);
|
|
extern ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, unsigned int contrast);
|
|
extern ErrorStatus DisplayDevice_invert(const struct DisplayDevice* self);
|
|
extern ErrorStatus DisplayDevice_setBlinkingCursorState(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
|
|
|
#endif /* INC_DISPLAYDEVICE_H_ */
|