git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@421 05563f52-14a8-4384-a975-3d1654cca0fa
303 lines
11 KiB
C
303 lines
11 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file Display.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
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/**
|
|
* Display implementation
|
|
* \defgroup Display Package Display
|
|
* \ingroup hsb-mrts
|
|
* @{
|
|
*/
|
|
|
|
#ifndef DISPLAY_H_
|
|
#define DISPLAY_H_
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "FreeRTOS.h"
|
|
#include "semphr.h"
|
|
#include "task.h"
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
#include "DisplayContent.h"
|
|
|
|
#include "DisplayDevice.h"
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions.
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
struct Display
|
|
{
|
|
struct DisplayDevice* displayDevice;
|
|
TaskHandle_t taskHandle;
|
|
int TaskPriority;
|
|
uint16_t stackSize;
|
|
bool runTask;
|
|
SemaphoreHandle_t displayWriteRequest;
|
|
struct DisplayContent displayContent;
|
|
int maxCharactersPerTransmit;
|
|
int refreshFeedCounter;
|
|
int refreshFeedFrequency_ms;
|
|
int refreshPeriod_ms;
|
|
bool initialized;
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_construct
|
|
* Constructor for a display application
|
|
*
|
|
* @param self The display object to initialize
|
|
* @param displayDevice The specific display device that the
|
|
* application will use
|
|
* @param TaskPriority Priority for the display Task
|
|
* 0 is highest (most important)
|
|
* @param stackSize Number of words (not bytes) for the
|
|
* display task
|
|
* @param maxNumberOfCharacters Max number of characters to send within
|
|
* one transfer action
|
|
*
|
|
* @return ErrorStatus SUCCESS if initialisation was OK
|
|
* ERROR otherwise
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_construct(struct Display* self, struct DisplayDevice* displayDevice, int TaskPriority, uint16_t stackSize, int maxCharactersPerTransmit, int refreshFeedFrequency_ms, int refreshPeriod);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_destruct
|
|
* Destructor for a display application
|
|
*
|
|
* @param self The display object to destruct
|
|
*
|
|
* @return void
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern void Display_destruct(struct Display* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_clearScreen
|
|
* Clear the complete display
|
|
*
|
|
* @param self The display information to use
|
|
*
|
|
* @return ErrorStatus SUCCESS if clearing display was OK
|
|
* ERROR otherwise
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_clearScreen(struct Display* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_clearLine
|
|
* Clears one particular line on the display
|
|
*
|
|
* @param self The display information to use
|
|
* @param line Linenumber to clear
|
|
*
|
|
* @return ErrorStatus SUCCESS if clearing line was OK
|
|
* ERROR otherwise, e.g. line number out of
|
|
* bound
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_clearLine(struct Display* self, size_t line);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_setState
|
|
* Sets the display state
|
|
*
|
|
* @param self The display information to use
|
|
* @param state The state to set
|
|
*
|
|
* @return ErrorStatus SUCCESS if clearing display was OK
|
|
* ERROR otherwise
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_setState(struct Display* self, DisplayDevice_functionalState state);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_setBrightness
|
|
* Sets the display brightness
|
|
*
|
|
* @param self The display information to use
|
|
* @param brightness The brightness to set
|
|
*
|
|
* @return ErrorStatus SUCCESS if clearing display was OK
|
|
* ERROR otherwise
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_setBrightness(struct Display* self, size_t brightness);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_setContrast
|
|
* Sets the display contrast
|
|
*
|
|
* @param self The display information to use
|
|
* @param state The contrast to set
|
|
*
|
|
* @return ErrorStatus SUCCESS if clearing display was OK
|
|
* ERROR otherwise
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_setContrast(struct Display* self, size_t contrast);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_setBlinkingCursorState
|
|
* Sets the status of the blinking cursor
|
|
*
|
|
* @param self The display information to use
|
|
* @param state The state of the blinking cursor to set
|
|
*
|
|
* @return ErrorStatus SUCCESS if clearing display was OK
|
|
* ERROR otherwise
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_setBlinkingCursorState(struct Display* self, DisplayDevice_functionalState state);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_setCurosrToPosition
|
|
* Sets didplay cursor to given position
|
|
*
|
|
* @param self
|
|
* @param row
|
|
* @param column
|
|
*
|
|
* @return ErrorStatus
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_setCursorToPosition(struct Display* self, unsigned int row, unsigned int column);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_backspace
|
|
* puts the cursor back one column and removes the character
|
|
*
|
|
* @param self
|
|
*
|
|
* @return ErrorStatus
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_backspace(struct Display* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_write
|
|
* Write a text on the display
|
|
* Length of string/message gets calculated (and verified) automatically
|
|
*
|
|
* @param self The display information to use
|
|
* @param buffer The message to write
|
|
* @param row The row of the display to put the message
|
|
* Starts with 1
|
|
* @param column The column to start at with the message
|
|
* Starts with 1
|
|
*
|
|
* @return ErrorStatus SUCCESS if putting message to display was
|
|
* successful
|
|
* ERROR otherwise, especially
|
|
* - Message too long
|
|
* - Row/Column outside display boundaries
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_write(struct Display* self, const char* buffer, size_t row, size_t column);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_writeCentered
|
|
* Puts a string on the specified row of the display in centered mode
|
|
*
|
|
* @param self The display object
|
|
* @param buffer String/message to write
|
|
* @param row The row to put the message to
|
|
*
|
|
* @return ErrorStatus SUCCESS if putting message to display was
|
|
* successful
|
|
* ERROR otherwise, especially
|
|
* - Message too long
|
|
* - Row outside display boundaries
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus Display_writeCentered(struct Display* self, const char* buffer, unsigned int row);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Display_feedRefreshCounter
|
|
* Feeds the refresh counter for display content
|
|
* Must be called regulary. Count rhythm and limits are defined in self
|
|
*
|
|
* @param self The display instance
|
|
*
|
|
* @return void
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern void Display_feedRefreshCounter(struct Display* self);
|
|
extern void Display_feedRefreshCounterFromISR(struct Display* self);
|
|
|
|
#endif /* DISPLAY_H_ */
|
|
|
|
/** @} */
|