Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/Display.h
mmi 17207a3a4b Fixed some major issues with RAM shortage. Also moved the cached storage to a MALLOC design instead of fixed memory usage. Using freertos porteds malloc and free required to move to HEAP4 to make sure memory does not get fragmented.
Resized nearly all task stacks

Also: 
- Menu fixes for insertion. Almost done, just need to fix the negative voltage insertion for mcp and cathode
- Added Device parameters, must be filled in

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@271 05563f52-14a8-4384-a975-3d1654cca0fa
2017-11-07 15:50:25 +00:00

280 lines
9.8 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
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file Display.h
/// @ingroup {group_name}
#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_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_ */