MiniDisplay.h
author StephaneLenclud
Wed, 04 Feb 2015 21:47:17 +0100
changeset 25 3fa4007c0b19
parent 24 9c233658ab28
child 31 0a2b658e0d56
permissions -rw-r--r--
First draft implementation of Futaba MDM166AA.
Only clock and brightness working for now.
sl@1
     1
//
sl@1
     2
//
sl@1
     3
//
sl@1
     4
sl@1
     5
#ifndef MINI_DISPLAY_H
sl@1
     6
#define MINI_DISPLAY_H
sl@1
     7
sl@2
     8
/* Cmake will define MyLibrary_EXPORTS on Windows when it
sl@2
     9
configures to build a shared library. If you are going to use
sl@2
    10
another build system on windows or create the visual studio
sl@2
    11
projects by hand you need to define MyLibrary_EXPORTS when
sl@2
    12
building a DLL on windows.
sl@1
    13
*/
sl@2
    14
// We are using the Visual Studio Compiler and building Shared libraries
sl@1
    15
sl@4
    16
#if defined (_WIN32)
sl@2
    17
  #if defined(MiniDisplay_EXPORTS)
sl@2
    18
    #define  MDAPI __declspec(dllexport)
sl@2
    19
  #else
sl@2
    20
    #define  MDAPI __declspec(dllimport)
sl@2
    21
  #endif /* MyLibrary_EXPORTS */
sl@2
    22
#else /* defined (_WIN32) */
sl@2
    23
 #define MDAPI
sl@2
    24
#endif
sl@2
    25
sl@2
    26
typedef void* MiniDisplayDevice;
sl@2
    27
sl@4
    28
typedef enum
sl@4
    29
    {
StephaneLenclud@24
    30
	EMiniDisplayAutoDetect=0,
sl@8
    31
    EMiniDisplayFutabaGP1212A01,
StephaneLenclud@18
    32
    EMiniDisplayFutabaGP1212A02,
StephaneLenclud@25
    33
	EMiniDisplayFutabaMDM166AA,
StephaneLenclud@18
    34
	EMiniDisplayAutoDetectFailed
sl@8
    35
    }
sl@8
    36
TMiniDisplayType;
sl@8
    37
sl@8
    38
typedef enum
sl@8
    39
    {
sl@4
    40
    EMiniDisplayRequestNone,
sl@4
    41
    EMiniDisplayRequestDeviceId,
sl@4
    42
    EMiniDisplayRequestFirmwareRevision,
sl@4
    43
    EMiniDisplayRequestPowerSupplyStatus
sl@4
    44
    }
sl@4
    45
TMiniDisplayRequest;
sl@4
    46
StephaneLenclud@24
    47
/**
StephaneLenclud@24
    48
Attempt to establish a connection to with a display of the given type.
StephaneLenclud@24
    49
Supports display auto-detection too.
StephaneLenclud@24
    50
StephaneLenclud@24
    51
@param [IN] The display type we want to connect to.
StephaneLenclud@24
    52
@return Handle to the device we connected to on success, null otherwise.
StephaneLenclud@24
    53
*/
sl@8
    54
extern "C" MDAPI MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType);
StephaneLenclud@24
    55
StephaneLenclud@24
    56
/**
StephaneLenclud@24
    57
Close the connection with the given display device.
StephaneLenclud@24
    58
StephaneLenclud@24
    59
@param [IN] The device to apply this command to.
StephaneLenclud@24
    60
*/
sl@2
    61
extern "C" MDAPI void MiniDisplayClose(MiniDisplayDevice aDevice);
sl@1
    62
sl@1
    63
/**
StephaneLenclud@24
    64
Provides the number of display types supported.
StephaneLenclud@24
    65
That includes the pseudo 'Auto-Detect' display.
StephaneLenclud@24
    66
@return The number of display type supported.
StephaneLenclud@24
    67
*/
StephaneLenclud@24
    68
extern "C" MDAPI int MiniDisplayTypeCount();
StephaneLenclud@24
    69
StephaneLenclud@24
    70
/**
StephaneLenclud@24
    71
Provides the human readable name of the given display type.
StephaneLenclud@24
    72
StephaneLenclud@24
    73
@param [IN] The display type we want to get the name for.
StephaneLenclud@24
    74
@return The name of the given display type.
StephaneLenclud@24
    75
*/
StephaneLenclud@24
    76
extern "C" MDAPI wchar_t* MiniDisplayTypeName(TMiniDisplayType aType);
StephaneLenclud@24
    77
StephaneLenclud@24
    78
/**
sl@2
    79
Clear our MiniDisplay.
sl@2
    80
@param [IN] The device to apply this command to.
sl@1
    81
*/
sl@2
    82
extern "C" MDAPI void MiniDisplayClear(MiniDisplayDevice aDevice);
sl@1
    83
sl@2
    84
/**
sl@2
    85
Fill our MiniDisplay.
sl@2
    86
@param [IN] The device to apply this command to.
sl@2
    87
*/
sl@2
    88
extern "C" MDAPI void MiniDisplayFill(MiniDisplayDevice aDevice);
sl@1
    89
sl@2
    90
/**
sl@2
    91
Swap our MiniDisplay buffers committing our back buffer content to the screen.
sl@2
    92
@param [IN] The device to apply this command to.
sl@2
    93
*/
sl@2
    94
extern "C" MDAPI void MiniDisplaySwapBuffers(MiniDisplayDevice aDevice);
sl@2
    95
sl@2
    96
/**
sl@2
    97
Provide maximum brightness level for the given device.
sl@2
    98
@param [IN] The device to apply this command to.
sl@2
    99
@return Maximum brightness level.
sl@2
   100
*/
sl@2
   101
extern "C" MDAPI int MiniDisplayMaxBrightness(MiniDisplayDevice aDevice);
sl@2
   102
sl@2
   103
/**
sl@2
   104
Provide minimum brightness level for the given device.
sl@2
   105
@param [IN] The device to apply this command to.
sl@2
   106
@return Minimum brightness level.
sl@2
   107
*/
sl@2
   108
extern "C" MDAPI int MiniDisplayMinBrightness(MiniDisplayDevice aDevice);
sl@2
   109
sl@2
   110
/**
sl@2
   111
Set device brightness level.
sl@2
   112
@param [IN] The device to apply this command to.
sl@2
   113
@param [IN] Brightness level
sl@2
   114
*/
sl@2
   115
extern "C" MDAPI void MiniDisplaySetBrightness(MiniDisplayDevice aDevice, int aBrightness);
sl@1
   116
sl@3
   117
/**
sl@3
   118
Provide pixels width of our display.
sl@3
   119
@param [IN] The device to apply this command to.
sl@3
   120
@return Width in pixels.
sl@3
   121
*/
sl@3
   122
extern "C" MDAPI int MiniDisplayWidthInPixels(MiniDisplayDevice aDevice);
sl@3
   123
sl@3
   124
/**
sl@3
   125
Provide pixels height of our display.
sl@3
   126
@param [IN] The device to apply this command to.
sl@3
   127
@return Height in pixels.
sl@3
   128
*/
sl@3
   129
extern "C" MDAPI int MiniDisplayHeightInPixels(MiniDisplayDevice aDevice);
sl@3
   130
sl@3
   131
/**
sl@3
   132
Set our given pixel.
sl@3
   133
@param [IN] The device to apply this command to.
sl@3
   134
@param [IN] Pixel X coordinate.
sl@3
   135
@param [IN] Pixel Y coordinate.
sl@3
   136
@param [IN] Pixel value.
sl@3
   137
*/
sl@22
   138
extern "C" MDAPI void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, unsigned int aPixel);
sl@3
   139
sl@3
   140
//TODO: Have an API to specify pixel depth
sl@3
   141
sl@4
   142
/**
sl@4
   143
Provide vendor name.
sl@4
   144
@param [IN] The device to apply this command to.
sl@4
   145
@return Vendor name.
sl@4
   146
*/
sl@4
   147
extern "C" MDAPI wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice);
sl@4
   148
sl@4
   149
/**
sl@4
   150
Provide product name.
sl@4
   151
@param [IN] The device to apply this command to.
sl@4
   152
@return Product name.
sl@4
   153
*/
sl@4
   154
extern "C" MDAPI wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice);
sl@4
   155
sl@4
   156
/**
sl@4
   157
Provide Serial number.
sl@4
   158
@param [IN] The device to apply this command to.
sl@4
   159
@return Serial number name.
sl@4
   160
*/
sl@4
   161
extern "C" MDAPI wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice);
sl@4
   162
sl@4
   163
/**
sl@4
   164
Request device ID.
sl@4
   165
@param [IN] The device to apply this command to.
sl@4
   166
*/
sl@11
   167
extern "C" MDAPI void MiniDisplayRequest(MiniDisplayDevice aDevice, TMiniDisplayRequest aRequest);
sl@4
   168
sl@4
   169
/**
sl@4
   170
Tell whether or not a request is pending.
sl@4
   171
@param [IN] The device to apply this command to.
sl@4
   172
@return true if we have a request pending, false otherwise.
sl@4
   173
*/
sl@4
   174
extern "C" MDAPI bool MiniDisplayRequestPending(MiniDisplayDevice aDevice);
sl@4
   175
sl@4
   176
sl@4
   177
/**
sl@4
   178
Provide the current request if any.
sl@4
   179
@param [IN] The device to apply this command to.
sl@4
   180
@return The current request if any.
sl@4
   181
*/
sl@4
   182
extern "C" MDAPI TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice);
sl@4
   183
sl@4
   184
sl@4
   185
/**
sl@4
   186
Cancel any pending request.
sl@4
   187
@param [IN] The device to apply this command to.
sl@4
   188
*/
sl@4
   189
extern "C" MDAPI void MiniDisplayCancelRequest(MiniDisplayDevice aDevice);
sl@1
   190
sl@5
   191
/**
sl@5
   192
Attempt request completion.
sl@5
   193
@param [IN] The device to apply this command to.
sl@5
   194
*/
sl@6
   195
extern "C" MDAPI TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice);
sl@5
   196
sl@5
   197
/**
sl@5
   198
Provide device ID.
sl@5
   199
@param [IN] The device to apply this command to.
sl@5
   200
@return Device ID name.
sl@5
   201
*/
sl@5
   202
extern "C" MDAPI char* MiniDisplayDeviceId(MiniDisplayDevice aDevice);
sl@5
   203
sl@5
   204
/**
sl@5
   205
Provide firmware revision.
sl@5
   206
@param [IN] The device to apply this command to.
sl@5
   207
@return Firmware revision name.
sl@5
   208
*/
sl@5
   209
extern "C" MDAPI char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice);
sl@5
   210
sl@6
   211
/**
sl@6
   212
Get power supply status.
sl@6
   213
@param [IN] The device to apply this command to.
sl@6
   214
*/
sl@6
   215
extern "C" MDAPI bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice);
sl@6
   216
sl@16
   217
/**
sl@16
   218
Turn device Power ON.
sl@16
   219
@param [IN] The device to apply this command to.
sl@16
   220
*/
sl@16
   221
extern "C" MDAPI void MiniDisplayPowerOn(MiniDisplayDevice aDevice);
sl@16
   222
sl@16
   223
/**
sl@16
   224
Turn device Power OFF.
sl@16
   225
@param [IN] The device to apply this command to.
sl@16
   226
*/
sl@16
   227
extern "C" MDAPI void MiniDisplayPowerOff(MiniDisplayDevice aDevice);
sl@16
   228
sl@16
   229
/**
sl@16
   230
Specifies whether or not this display supports power ON/OFF functions.
sl@16
   231
@param [IN] The device to apply this command to.
sl@16
   232
@return True if one can turn display power on and off, false otherwise.
sl@16
   233
*/
sl@16
   234
extern "C" MDAPI bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice);
sl@6
   235
sl@17
   236
/**
sl@17
   237
Show built-in clock.
sl@17
   238
@param [IN] The device to apply this command to.
sl@17
   239
*/
sl@17
   240
extern "C" MDAPI void MiniDisplayShowClock(MiniDisplayDevice aDevice);
sl@17
   241
sl@17
   242
/**
sl@17
   243
Hide built-in clock.
sl@17
   244
@param [IN] The device to apply this command to.
sl@17
   245
*/
sl@17
   246
extern "C" MDAPI void MiniDisplayHideClock(MiniDisplayDevice aDevice);
sl@17
   247
sl@17
   248
/**
sl@17
   249
Specifies whether or not this display supports clock functions.
sl@17
   250
@param [IN] The device to apply this command to.
sl@17
   251
@return True if this display supports built-in clock, false otherwise.
sl@17
   252
*/
sl@17
   253
extern "C" MDAPI bool MiniDisplaySupportClock(MiniDisplayDevice aDevice);
sl@17
   254
sl@5
   255
sl@1
   256
#endif
sl@1
   257