// ----------------------------------------------------------------------------- /// @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 #include "FreeRTOS.h" #include "semphr.h" #include "task.h" #include "stm32f10x.h" #include "DisplayDevice.h" // ----------------------------------------------------------------------------- // Constant and macro definitions // ----------------------------------------------------------------------------- #define DISPLAY_MAX_ROWS (6) #define DISPLAY_MAX_COLUMNS (25) // ----------------------------------------------------------------------------- // Type definitions. // ----------------------------------------------------------------------------- struct DisplayCharacter { char character; bool isUpdated; }; struct Display { struct DisplayDevice* displayDevice; TaskHandle_t taskHandle; int TaskPriority; uint16_t stackSize; bool runTask; SemaphoreHandle_t displayShadowAccessSemaphore; struct DisplayCharacter displayShadow[DISPLAY_MAX_ROWS][DISPLAY_MAX_COLUMNS]; int maxCharactersPerTransmit; }; // ----------------------------------------------------------------------------- // 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); /** ---------------------------------------------------------------------------- * 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_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_write * Description of function * * @param self The display information to use * @param buffer The message to write * @param length Length of the message * @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, unsigned int length, size_t row, size_t column); #endif /* DISPLAY_H_ */