Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/Display.h
mmi a73154a5e6 Fixed issue with external DAC handlign from repair process
repair process implemented. Simple regulation without feedback (must be addeed, yet)

HW validation menu functional but buggy (IOs not OK)

Added ClearLine functionality to displayDevice

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@244 05563f52-14a8-4384-a975-3d1654cca0fa
2017-10-09 15:29:23 +00:00

221 lines
7.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 "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;
SemaphoreHandle_t displayWriteRequest;
struct DisplayCharacter displayShadow[DISPLAY_MAX_ROWS][DISPLAY_MAX_COLUMNS];
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_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);
/** ----------------------------------------------------------------------------
* 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);
#endif /* DISPLAY_H_ */