OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_STM32F103_Primer_GCC/] [ST_Code/] [circle_api.h] - Blame information for rev 582

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 582 jeremybenn
/********************* (C) COPYRIGHT 2007 RAISONANCE S.A.S. *******************/
2
/**
3
*
4
* @file     circle_api.h
5
* @brief    General header for the STM32-circle projects.
6
* @author   FL
7
* @date     07/2007
8
* @version  1.2
9
* @date     10/2007
10
* @version  1.5 types of OutX_F64 and OutX_F256 changed to u32 (same for Y and Z)
11
* @date     10/2007
12
* @version  1.6 Add the IRQ handler replacement
13
*
14
* It contains the list of the utilities functions organized by sections
15
* (MEMS, LCD, POINTER, ...)
16
*
17
**/
18
/*******************************************************************************
19
*
20
* Use this header with version 1.5 or later of the OS.
21
*
22
* For a complete documentation on the CircleOS, please go to:
23
*  http://www.stm32circle.com
24
*
25
*******************************************************************************/
26
 
27
#include "stm32f10x_lib.h"
28
 
29
/* Define to prevent recursive inclusion -------------------------------------*/
30
#ifndef __CIRCLE_API_H
31
#define __CIRCLE_API_H
32
 
33
//-------------------------------- General -------------------------------------
34
 
35
/**
36
* @enum  eSpeed
37
* @brief Clock speeds.
38
*
39
* Available clock speeds.
40
**/
41
extern enum eSpeed
42
   {
43
   SPEED_VERY_LOW    = 1,
44
   SPEED_LOW         = 2,
45
   SPEED_MEDIUM      = 3,
46
   SPEED_HIGH        = 4,
47
   SPEED_VERY_HIGH   = 5
48
   } CurrentSpeed;
49
enum eSchHandler
50
   {
51
   LED_SCHHDL_ID     = 0,
52
   BUTTON_SCHHDL_ID  = 1,
53
   BUZZER_SCHHDL_ID  = 2,
54
   MENU_SCHHDL_ID    = 3,
55
   POINTER_SCHHDL_ID = 4,
56
   LCD_SCHHDL_ID     = 5,
57
   DRAW_SCHHDL_ID    = 6,
58
   RTC_SCHHDL_ID     = 7,
59
 
60
   UNUSED0_SCHHDL_ID = 8,
61
   UNUSED1_SCHHDL_ID = 9,
62
   UNUSED2_SCHHDL_ID = 10,
63
   UNUSED3_SCHHDL_ID = 11,
64
   UNUSED4_SCHHDL_ID = 12,
65
   UNUSED5_SCHHDL_ID = 13,
66
   UNUSED6_SCHHDL_ID = 14,
67
   UNUSED7_SCHHDL_ID = 15
68
   };
69
 
70
 
71
/// @cond Internal
72
 
73
extern RCC_ClocksTypeDef RCC_ClockFreq;
74
 
75
/* Typedefs ------------------------------------------------------------------*/
76
typedef u32 (*tCircleFunc0 ) (void);
77
typedef u32 (*tCircleFunc1 ) (u32 param1);
78
typedef u32 (*tCircleFunc2 ) (u32 param1, u32 param2);
79
typedef u32 (*tCircleFunc3 ) (u32 param1, u32 param2, u32 param3);
80
typedef u32 (*tCircleFunc4 ) (u32 param1, u32 param2, u32 param3, u32 param4);
81
typedef u32 (*tCircleFunc5 ) (u32 param1, u32 param2, u32 param3, u32 param4, u32 param5);
82
typedef u32 (*tCircleFunc6 ) (u32 param1, u32 param2, u32 param3, u32 param4, u32 param5, u32 param6);
83
 
84
extern tCircleFunc0 (*ptrCircle_API) [];
85
 
86
/* Defines -------------------------------------------------------------------*/
87
#define Circle_API   (*ptrCircle_API)
88
 
89
#define POINTER_ID   0x00
90
#define DRAW_ID      0x20
91
#define LCD_ID       0x40
92
#define LED_ID       0x60
93
#define MEMS_ID      0x70
94
#define BUTTON_ID    0x80
95
#define BUZZER_ID    0x90
96
#define MENU_ID      0xA0
97
#define UTIL_ID      0xB0
98
#define RTC_ID       0xC0
99
 
100
// UTIL functions definition.
101
#define UTIL_SET_PLL_ID                 (UTIL_ID + 0)    // Set clock frequency.
102
#define UTIL_GET_PLL_ID                 (UTIL_ID + 1)    // Get clock frequency.
103
#define UTIL_UINT2STR_ID                (UTIL_ID + 2)    // Convert an unsigned integer into a string.
104
#define UTIL_INT2STR_ID                 (UTIL_ID + 3)    // Convert a signed integer into a string.
105
#define UTIL_GET_VERSION_ID             (UTIL_ID + 4)    // Get CircleOS version.
106
#define UTIL_READ_BACKUPREGISTER_ID     (UTIL_ID + 5)    // Reads data from the specified Data Backup Register.
107
#define UTIL_WRITE_BACKUPREGISTER_ID    (UTIL_ID + 6)    // Writes data to the specified Data Backup Register.
108
#define UTIL_GET_BAT_ID                 (UTIL_ID + 7)    // Return the batterie tension in mV.
109
#define UTIL_GET_USB_ID                 (UTIL_ID + 8)    // Return the USB connexion state.
110
#define UTIL_SET_IRQ_HANDLER_ID         (UTIL_ID + 9)    // Replace an irq handler
111
#define UTIL_GET_IRQ_HANDLER_ID         (UTIL_ID + 10)   // Get the current irq handler
112
#define UTIL_SET_SCH_HANDLER_ID         (UTIL_ID + 11)    // Replace an irq handler
113
#define UTIL_GET_SCH_HANDLER_ID         (UTIL_ID + 12)   // Get the current irq handler
114
#define UTIL_GET_TEMP_ID                (UTIL_ID + 13)   // Return the temperature (1/100 C)
115
#define UTIL_SET_TEMPMODE_ID            (UTIL_ID + 14)   // Set the temperature mode (0: mCelcius, 1: mFahrenheit
116
typedef void (*tHandler) (void);
117
 
118
// Prototypes.
119
#define UTIL_SetPll(a)                          ((tCircleFunc1)(Circle_API [UTIL_SET_PLL_ID])) ((u32)(a))                                    // void UTIL_SetPll( enum eSpeed speed );
120
#define UTIL_GetPll()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_PLL_ID])) ())                                          // enum eSpeed UTIL_GetPll( void );
121
#define UTIL_uint2str(a,b,c,d)                  ((tCircleFunc4)(Circle_API [UTIL_UINT2STR_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))        // void uint2str( char* ptr , u32 X, u16 digit, int fillwithzero );
122
#define UTIL_int2str(a,b,c,d)                   ((tCircleFunc4)(Circle_API [UTIL_INT2STR_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))         // void  int2str( char* ptr , s32 X, u16 digit, int fillwithzero );
123
#define UTIL_GetVersion()              (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_VERSION_ID])) ())                                      // char* UTIL_GetVersion( void );
124
#define UTIL_ReadBackupRegister(a)     (u32)    (((tCircleFunc1)(Circle_API [UTIL_READ_BACKUPREGISTER_ID])) ((u32)(a)))                      // u16 UTIL_ReadBackupRegister( u16 BKP_DR );
125
#define UTIL_WriteBackupRegister(a,b)           ((tCircleFunc2)(Circle_API [UTIL_WRITE_BACKUPREGISTER_ID])) ((u32)(a),(u32)(b))              // void UTIL_WriteBackupRegister( u16 BKP_DR, u16 Data );
126
#define UTIL_GetBat()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_BAT_ID])) ())                                          // u16 UTIL_GetBat( void );
127
#define UTIL_GetUsb()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_USB_ID])) ())                                          // u8 UTIL_GetUsb( void );
128
#define UTIL_SetIrqHandler(a,b)                 (((tCircleFunc2)(Circle_API [UTIL_SET_IRQ_HANDLER_ID])) ((int)a,(tHandler)b))                // void UTIL_SetIrqHandler ( int , tHandler );
129
#define UTIL_GetIrqHandler(a)          (u32)    (((tCircleFunc1)(Circle_API [UTIL_GET_IRQ_HANDLER_ID])) ((int)a))                            // tHandler* UTIL_GetIrqHandler ( int );
130
#define UTIL_SetSchHandler(a,b)                 (((tCircleFunc2)(Circle_API [UTIL_SET_SCH_HANDLER_ID])) ((int)a,(tHandler)b))                // void UTIL_SetSchHandler ( int , tHandler );
131
#define UTIL_GetSchHandler(a)          (u32)    (((tCircleFunc1)(Circle_API [UTIL_GET_SCH_HANDLER_ID])) ((int)a))                            // tHandler* UTIL_GetSchHandler ( int );
132
#define UTIL_GetTemp()                 (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_TEMP_ID])) ())                                         // u16 UTIL_GetTemp( void );
133
#define UTIL_SetTempMode(a)                     (((tCircleFunc1)(Circle_API [UTIL_SET_TEMPMODE_ID])) ((int)a))                               // void UTIL_SetTempMode( int mode );
134
 
135
/// @endcond
136
 
137
//---------------------------------   MEMS  ------------------------------------
138
 
139
/* Exported types ------------------------------------------------------------*/
140
 
141
/**
142
* @enum  Rotate_H12_V_Match_TypeDef
143
* @brief The 4 possible rotations.
144
*
145
* The 4 possible MEM rotations.
146
**/
147
typedef enum
148
   {
149
   V12 = 0,                                        /*!< No rotation.          */
150
   V3  = 1,                                        /*!< Rotation to the right.*/
151
   V6  = 2,                                        /*!< Rotation to the left. */
152
   V9  = 3                                         /*!< Half a rotation.      */
153
   } Rotate_H12_V_Match_TypeDef;
154
 
155
/**
156
* @struct   tMEMS_Info
157
* @brief    MEMS state description.
158
**/
159
typedef struct
160
   {
161
   s16 OutX;                     /*!< MEMS X position.                        */
162
   s16 OutX_F4;                  /*!< MEMS X position filtered on 4 values.   */
163
   s16 OutX_F16;                 /*!< MEMS X position filtered on 16 values.  */
164
   s32 OutX_F64;                 /*!< MEMS X position filtered on 64 values.  */
165
   s32 OutX_F256;                /*!< MEMS X position filtered on 256 values. */
166
   s16 OutY;                     /*!< MEMS Y position.                        */
167
   s16 OutY_F4;                  /*!< MEMS Y position filtered on 4 values.   */
168
   s16 OutY_F16;                 /*!< MEMS Y position filtered on 16 values.  */
169
   s32 OutY_F64;                 /*!< MEMS Y position filtered on 64 values.  */
170
   s32 OutY_F256;                /*!< MEMS Y position filtered on 256 values. */
171
   s16 OutZ;                     /*!< MEMS Z position.                        */
172
   s16 OutZ_F4;                  /*!< MEMS Z position filtered on 4 values.   */
173
   s16 OutZ_F16;                 /*!< MEMS Z position filtered on 16 values.  */
174
   s32 OutZ_F64;                 /*!< MEMS Z position filtered on 64 values.  */
175
   s32 OutZ_F256;                /*!< MEMS Z position filtered on 256 values. */
176
   s16 Shocked;                  /*!< MEMS shock counter (incremented...)     */
177
   s16 RELATIVE_X;               /*!< MEMS relative X position.               */
178
   s16 RELATIVE_Y;               /*!< MEMS relative Y position.               */
179
   s16 DoubleClick;              /*!< MEMS DoubleClick counter(incremented...)*/
180
   } tMEMS_Info;
181
 
182
/// @cond Internal
183
 
184
/* Exported defines ----------------------------------------------------------*/
185
 
186
// MEMS functions definition
187
#define MEMS_GET_POSITION_ID   (MEMS_ID + 0)       // Return the current (relative) Mems information
188
#define MEMS_GET_ROTATION_ID   (MEMS_ID + 1)       // Return the current screen orientation of the circle
189
#define MEMS_SET_NEUTRAL_ID    (MEMS_ID + 2)       // Set the current position as "neutral position"
190
#define MEMS_GET_INFO_ID       (MEMS_ID + 3)       // Return Mems informations
191
 
192
// Prototypes
193
#define MEMS_GetPosition(a,b)             ((tCircleFunc2)(Circle_API [MEMS_GET_POSITION_ID])) ((u32)(a),(u32)(b))      //  void MEMS_GetPosition(s16 * pX, s16* pY);
194
#define MEMS_GetRotation(a)               ((tCircleFunc1)(Circle_API [MEMS_GET_ROTATION_ID])) ((u32)(a))      //  void MEMS_GetRotation(Rotate_H12_V_Match_TypeDef * H12);
195
#define MEMS_SetNeutral()                 ((tCircleFunc0)(Circle_API [MEMS_GET_ROTATION_ID])) ()                       //  void MEMS_SetNeutral( void );
196
#define MEMS_GetInfo()    ( (tMEMS_Info*) (((tCircleFunc0)(Circle_API [MEMS_GET_INFO_ID])) ()))                        //  tMEMS_Info* MEMS_GetInfo (void)
197
 
198
/// @endcond
199
 
200
//--------------------------------   POINTER  ----------------------------------
201
 
202
/* Exported types ------------------------------------------------------------*/
203
 
204
/**
205
* @enum  POINTER_mode
206
* @brief Available pointer modes.
207
*
208
* Description of all the available pointer modes in CircleOS.
209
**/
210
enum POINTER_mode
211
   {
212
   POINTER_UNDEF        = -1,    /*!< Pointer's mode is unknown!              */
213
   POINTER_OFF          =  0,    /*!< Pointer isn't managed and displayed.    */
214
   POINTER_ON           =  1,    /*!< Pointer mode used in main screen.       */
215
   POINTER_MENU         =  2,    /*!< Pointer management is used to select item menu (but pointer isn't displayed).  */
216
   POINTER_APPLICATION  =  3,    /*!< The managment of pointer depend of extern application.                         */
217
   POINTER_RESTORE_LESS =  4     /*!< The background isn't restored (to go faster).                                  */
218
   };
219
 
220
/**
221
* @enum  POINTER_state
222
* @brief The different pointer modes.
223
*
224
* Despite beeing in a undefined state, the pointer can be disabled or enable.
225
**/
226
enum POINTER_state
227
   {
228
   POINTER_S_UNDEF      = -1,                /*!< Pointer state is unknown!   */
229
   POINTER_S_DISABLED   =  0,                /*!< Pointer is disabled.        */
230
   POINTER_S_ENABLED    =  1                 /*!< Pointer is enabled.         */
231
   };
232
 
233
/**
234
* @struct   tPointer_Info
235
* @brief    Pointer position description.
236
**/
237
typedef struct
238
   {
239
   s16 xPos;                              /*!< X position of pointer.         */
240
   s16 yPos;                              /*!< Y position of pointer.         */
241
   s16 shift_PosX;                        /*!< Pointer speed on X axis.       */
242
   s16 shift_PosY;                        /*!< Pointer speed on Y axis        */
243
   s16 X_PosMin;                          /*!< Minimum position on X axis.    */
244
   s16 Y_PosMin;                          /*!< Minimum position on Y axis.    */
245
   s16 X_PosMax;                          /*!< Maximum position on X axis.    */
246
   s16 Y_PosMax;                          /*!< Maximum position on Y axis.    */
247
   } tPointer_Info;
248
 
249
/// @cond Internal
250
 
251
/* Exported defines ---------------------------------------------------------*/
252
#define POINTER_WIDTH 7
253
 
254
// POINTER functions definition
255
#define POINTER_SET_RECT_ID                   (POINTER_ID + 0)          // Set new limits for the move of the pointer
256
#define POINTER_SETRECTSCREEN_ID              (POINTER_ID + 1)          // Remove any space restriction for the pointer moves.
257
#define POINTER_GETCURRENTANGLESTART_ID       (POINTER_ID + 2)          // Return the current minimum angle to move pointer
258
#define POINTER_SETCURRENTANGLESTART_ID       (POINTER_ID + 3)          // Set the current minimum angle to move pointer
259
#define POINTER_GETCURRENTSPEEDONANGLE_ID     (POINTER_ID + 4)          // Return the ratio speed / angle
260
#define POINTER_SETCURRENTSPEEDONANGLE_ID     (POINTER_ID + 5)          // Set the ratio speed / angle
261
#define POINTER_SETMODE_ID                    (POINTER_ID + 6)          // Change the current mode of the pointer management
262
#define POINTER_GETMODE_ID                    (POINTER_ID + 7)          // Return the current mode of the pointer management
263
#define POINTER_SETCURRENTPOINTER_ID          (POINTER_ID + 8)          // Set the dimention and bitmap of pointer
264
#define POINTER_GETSTATE_ID                   (POINTER_ID + 9)          // Return the current state
265
#define POINTER_DRAW_ID                       (POINTER_ID + 10)         // Draw a pointer
266
#define POINTER_SAVE_ID                       (POINTER_ID + 11)         // Save the background of the pointer
267
#define POINTER_RESTORE_ID                    (POINTER_ID + 12)         // Restore the background of the pointer
268
#define POINTER_GETPOSITION_ID                (POINTER_ID + 13)         // Return the poistion of the cursor (x=lower byte, y = upperbyte)
269
#define POINTER_SETPOSITION_ID                (POINTER_ID + 14)         // Force the position of the pointer in the screen
270
#define POINTER_SETAPPLICATION_POINTER_MGR_ID (POINTER_ID + 15)         // Set the application pointer manager
271
#define POINTER_SETCOLOR_ID                   (POINTER_ID + 16)         // Set pointer color
272
#define POINTER_GETCOLOR_ID                   (POINTER_ID + 17)         // Return pointer color
273
#define POINTER_GETINFO_ID                    (POINTER_ID + 18)         // Return pointer informations
274
#define POINTER_SET_CURRENT_AREASTORE_ID      (POINTER_ID + 19)         // Change the current storage area
275
 
276
// Prototypes
277
#define POINTER_SetRect(a,b,c,d)                     ((tCircleFunc4)(Circle_API [POINTER_SET_RECT_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))          //void POINTER_SetRect ( s16 x, s16 y, s16 width, s16 height );  //Restrict the move of the pointer to a rectangle
278
#define POINTER_SetRectScreen()                      ((tCircleFunc0)(Circle_API [POINTER_SETRECTSCREEN_ID])) ()                                        //void POINTER_SetRectScreen ( void );
279
#define POINTER_GetCurrentAngleStart()    (u16)      (((tCircleFunc0)(Circle_API [POINTER_GETCURRENTANGLESTART_ID])) ())                               //u16  POINTER_GetCurrentAngleStart ( void );
280
#define POINTER_SetCurrentAngleStart(a)              ((tCircleFunc1)(Circle_API [POINTER_SETCURRENTANGLESTART_ID])) ((u32)(a))                         //void POINTER_SetCurrentAngleStart ( u16 );
281
#define POINTER_GetCurrentSpeedOnAngle()  (u16)      (((tCircleFunc0)(Circle_API [POINTER_GETCURRENTSPEEDONANGLE_ID])) ())                             //u16  POINTER_GetCurrentSpeedOnAngle ( void );
282
#define POINTER_SetCurrentSpeedOnAngle(a)            ((tCircleFunc1)(Circle_API [POINTER_SETCURRENTSPEEDONANGLE_ID])) ((u32)(a))                       //void POINTER_SetCurrentSpeedOnAngle ( u16  newspeed );
283
#define POINTER_SetMode(a)                           ((tCircleFunc1)(Circle_API [POINTER_SETMODE_ID])) ((u32)(a))                                      //void POINTER_SetMode( enum POINTER_mode mode);
284
#define POINTER_GetMode()       (enum POINTER_mode)  (((tCircleFunc0)(Circle_API [POINTER_GETMODE_ID])) ())                                            //enum POINTER_mode POINTER_GetMode( void );
285
#define POINTER_SetCurrentPointer(a,b,c)             ((tCircleFunc3)(Circle_API [POINTER_SETCURRENTPOINTER_ID])) ((u32)(a),(u32)(b),(u32)(c))          //void POINTER_SetCurrentPointer( unsigned char width, unsigned char height, unsigned char *bmp);
286
#define POINTER_GetState()      (enum POINTER_state) (((tCircleFunc0)(Circle_API [POINTER_GETSTATE_ID])) ())                                           //enum POINTER_state POINTER_GetState(void);
287
#define POINTER_Draw(a,b,c,d,e)                      ((tCircleFunc5)(Circle_API [POINTER_DRAW_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e))     //void POINTER_Draw (u8 Line, u8 Column, u8 Width, u8 Height, u8 *Bmp);
288
#define POINTER_Save(a,b,c,d)                        ((tCircleFunc4)(Circle_API [POINTER_SAVE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))              //void POINTER_Save (u8 Line, u8 Column, u8 Width, u8 Height);
289
#define POINTER_Restore(a,b,c,d)                     ((tCircleFunc4)(Circle_API [POINTER_RESTORE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))           //void POINTER_Restore (u8 Line, u8 Column, u8 Width, u8 Height);
290
#define POINTER_GetPos()                  (u16)      (((tCircleFunc0)(Circle_API [POINTER_GETPOSITION_ID])) ())                                        //u16  POINTER_GetPos(void);
291
#define POINTER_SetPos(a,b)                          ((tCircleFunc2)(Circle_API [POINTER_SETPOSITION_ID])) ((u32)(a),(u32)(b))                         //void POINTER_SetPos ( u16 x, u16 y );
292
#define POINTER_SetApplication_Pointer_Mgr(a)        ((tCircleFunc1)(Circle_API [POINTER_SETAPPLICATION_POINTER_MGR_ID])) ((u32)(a))                   //void POINTER_SetApplication_Pointer_Mgr(  tAppPtrMgr mgr );
293
#define POINTER_SetColor(a)                          ((tCircleFunc1)(Circle_API [POINTER_SETCOLOR_ID])) ((u32)(a))                                     //void POINTER_SetColor ( u16 color )
294
#define POINTER_GetColor()                (u16)      (((tCircleFunc0)(Circle_API [POINTER_GETCOLOR_ID])) ())                                           //u16  POINTER_GetColor ( void )
295
#define POINTER_GetInfo()      (tPointer_Info*)      (((tCircleFunc0)(Circle_API [POINTER_GETINFO_ID])) ())                                            //tPointer_Info* POINTER_GetInfo ( void )
296
#define POINTER_SetCurrentAreaStore(a)               ((tCircleFunc1)(Circle_API [POINTER_SET_CURRENT_AREASTORE_ID])) ((u32)(a))                        //void POINTER_SetCurrentAreaStore ( u8 *ptr )
297
 
298
/// @endcond
299
 
300
//--------------------------------   BUTTON  -----------------------------------
301
 
302
/* Exported types ------------------------------------------------------------*/
303
 
304
/**
305
* @enum  BUTTON_mode
306
* @brief Available button modes.
307
*
308
* List of all the available button mode in the CircleOS.
309
**/
310
enum BUTTON_mode
311
   {
312
   BUTTON_DISABLED      = -1,       /*!< No action on the button is detected. */
313
   BUTTON_ONOFF         =  0,       /*!< Detect ON/OFF pression type.         */
314
   BUTTON_ONOFF_FORMAIN =  1,       /*!< Special mode for main screen.        */
315
   BUTTON_WITHCLICK     =  2        /*!< Currently unused.                    */
316
   };
317
 
318
/**
319
* @enum  BUTTON_state
320
* @brief CircleOS button states.
321
*
322
* Description of the button states provided by CircleOS.
323
**/
324
enum BUTTON_state
325
   {
326
   BUTTON_UNDEF            = -1,    /*!< Undefined state.                     */
327
   BUTTON_RELEASED         =  0,    /*!< Button is released.                  */
328
   BUTTON_PUSHED           =  1,    /*!< Button was just pushed.              */
329
   BUTTON_PUSHED_FORMAIN   =  2,    /*!< Same as BUTTON_PUSHED when button mode is BUTTON_ONOFF_FORMAIN. */
330
   BUTTON_CLICK            =  3,    /*!< Currently unused.                    */
331
   BUTTON_DBLCLICK         =  4     /*!< Currently unused.                    */
332
   };
333
 
334
/// @cond Internal
335
 
336
/* Exported defines ----------------------------------------------------------*/
337
 
338
// BUTTON functions definition
339
#define BUTTON_GETSTATE_ID                   (BUTTON_ID + 0)         // Return state of button
340
#define BUTTON_SETMODE_ID                    (BUTTON_ID + 1)         // Set button mode
341
#define BUTTON_GETMODE_ID                    (BUTTON_ID + 2)         // Return button mode
342
#define BUTTON_WAITFORRELEASE_ID             (BUTTON_ID + 3)         // Disable temporarily any new button event
343
 
344
// Prototypes
345
#define BUTTON_GetState()       (enum BUTTON_state)   (((tCircleFunc0)(Circle_API [BUTTON_GETSTATE_ID])) ())        // enum BUTTON_state BUTTON_GetState(void);
346
#define BUTTON_SetMode(a);                            ((tCircleFunc1)(Circle_API [BUTTON_SETMODE_ID])) ((u32)(a))   // void BUTTON_SetMode( enum BUTTON_mode mode);
347
#define BUTTON_GetMode();       (enum BUTTON_mode)    (((tCircleFunc0)(Circle_API [BUTTON_GETMODE_ID])) ())         // enum BUTTON_mode BUTTON_GetMode ( void ) ;
348
#define BUTTON_WaitForRelease()                       ((tCircleFunc0)(Circle_API [BUTTON_WAITFORRELEASE_ID])) ()    // void BUTTON_WaitForRelease(void);
349
 
350
/// @endcond
351
 
352
//----------------------------------   LCD   -----------------------------------
353
 
354
/* Exported defines ----------------------------------------------------------*/
355
 
356
// RGB is 16-bit coded as    G2G1G0B4 B3B2B1B0 R4R3R2R1 R0G5G4G3
357
#define RGB_MAKE(xR,xG,xB)    ( ( (xG&0x07)<<13 ) + ( (xG)>>5 )  +      \
358
                                ( ((xB)>>3) << 8 )          +      \
359
                                ( ((xR)>>3) << 3 ) )                    /*!< Macro to make a LCD compatible color format from RGB.  */
360
 
361
#define RGB_RED         0x00F8                  /*!<  Predefined color.       */
362
#define RGB_BLACK       0x0000                  /*!<  Predefined color.       */
363
#define RGB_WHITE       0xffff                  /*!<  Predefined color.       */
364
#define RGB_BLUE        0x1F00                  /*!<  Predefined color.       */
365
#define RGB_GREEN       0xE007                  /*!<  Predefined color.       */
366
#define RGB_YELLOW      (RGB_GREEN|RGB_RED)     /*!<  Predefined color.       */
367
#define RGB_MAGENTA     (RGB_BLUE|RGB_RED)      /*!<  Predefined color.       */
368
#define RGB_LIGHTBLUE   (RGB_BLUE|RGB_GREEN)    /*!<  Predefined color.       */
369
#define RGB_ORANGE      (RGB_RED | 0xE001)      /*!<  Predefined color ( Green/2 + red ).  */
370
#define RGB_PINK        (RGB_MAGENTA | 0xE001)  /*!<  Predefined color ( Green/2 + magenta ). */
371
 
372
// PWM rates.
373
#define BACKLIGHTMIN                0x1000   /*!< Minimal PWM rate.           */
374
#define DEFAULT_CCR_BACKLIGHTSTART  0x8000   /*!< Default PWM rate.           */
375
 
376
// SCREEN Infos
377
#define SCREEN_WIDTH          128         /*!< Width of visible screen in pixels.   */
378
#define SCREEN_HEIGHT         128         /*!< Height of visible screen in pixels.  */
379
#define CHIP_SCREEN_WIDTH     132         /*!< Width of screen driven by LCD controller in pixels.  */
380
#define CHIP_SCREEN_HEIGHT    132         /*!< Height of screen driven by LCD controller in pixels.  */
381
 
382
// Characters Infos
383
#define CHAR_WIDTH            7           /*!< Width of a character.   */
384
#define CHAR_HEIGHT           14          /*!< Height of a character.   */
385
 
386
/// @cond Internal
387
 
388
// LCD functions definition
389
#define LCD_SETRECTFORCMD_ID                   (LCD_ID + 0)          // Define the rectangle (for the next command to be applied)
390
#define LCD_GETPIXEL_ID                        (LCD_ID + 1)          // Read the value of one pixel
391
#define LCD_DRAWPIXEL_ID                       (LCD_ID + 2)          // Draw a Graphic image on slave LCD.
392
#define LCD_SENDLCDCMD_ID                      (LCD_ID + 3)          // Send one byte command to LCD LCD.
393
#define LCD_SENDLCDDATA_ID                     (LCD_ID + 4)          // Display one byte data to LCD LCD.
394
#define LCD_READLCDDATA_ID                     (LCD_ID + 5)          // Read LCD byte data displayed on LCD LCD.
395
#define LCD_FILLRECT_ID                        (LCD_ID + 6)          // Fill a rectangle with one color
396
#define LCD_DRAWRECT_ID                        (LCD_ID + 7)          // Draw a rectangle with one color
397
#define LCD_DISPLAYCHAR_ID                     (LCD_ID + 8)          // Display one character
398
#define LCD_RECTREAD_ID                        (LCD_ID + 9)          // Save a rectangle of the monitor RAM
399
#define LCD_SETBACKLIGHT_ID                    (LCD_ID + 10)         // Modify the PWM rate
400
#define LCD_GETBACKLIGHT_ID                    (LCD_ID + 11)         // Return the PWM rate
401
#define LCD_SETROTATESCREEN_ID                 (LCD_ID + 12)         // Enable/Disable screen rotation
402
#define LCD_GETROTATESCREEN_ID                 (LCD_ID + 13)         // Return screen rotation mode
403
#define LCD_SETSCREENORIENTATION_ID            (LCD_ID + 14)         // Set screen orientation
404
#define LCD_GETSCREENORIENTATION_ID            (LCD_ID + 15)         // Return screen orientation
405
#define LCD_SETBACKLIGHT_OFF_ID                (LCD_ID + 16)         // Switch the LCD back light off.
406
#define LCD_SETBACKLIGHT_ON_ID                 (LCD_ID + 17)         // Switch the LCD back light on.
407
 
408
// Prototypes
409
#define LCD_SetRect_For_Cmd(a,b,c,d)                 ((tCircleFunc4)(Circle_API [LCD_SETRECTFORCMD_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))                  //void  LCD_SetRect_For_Cmd ( s16 x, s16 y, s16 width, s16 height)
410
#define LCD_GetPixel(a,b)                 (u16)      (((tCircleFunc2)(Circle_API [LCD_GETPIXEL_ID])) ((u32)(a),(u32)(b)))                                       //u16   LCD_GetPixel (u8 x, u8 y)
411
#define LCD_DrawPixel(a,b,c)                         ((tCircleFunc3)(Circle_API [LCD_DRAWPIXEL_ID])) ((u32)(a),(u32)(b),(u32)(c))                               //void  LCD_SetPixel (u8 x, u8 y, u16 Pixel) ;
412
#define LCD_SendLCDCmd(a)                            ((tCircleFunc1)(Circle_API [LCD_SENDLCDCMD_ID])) ((u32)(a))                                                //void  LCD_SendLCDCmd(u8 Cmd);
413
#define LCD_SendLCDData(a)                           ((tCircleFunc1)(Circle_API [LCD_SENDLCDDATA_ID])) ((u32)(a))                                               //void  LCD_SendLCDData(u8 Data);
414
#define LCD_ReadLCDData()                 (u32)      (((tCircleFunc0)(Circle_API [LCD_READLCDDATA_ID])) ())                                                     //u32   LCD_ReadLCDData(void);
415
#define LCD_FillRect(a,b,c,d,e)                      ((tCircleFunc5)(Circle_API [LCD_FILLRECT_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e))              //void  LCD_FillRect ( u16 x, u16 y, u16 width, u16 height, u16 color );
416
#define LCD_DrawRect(a,b,c,d,e)                      ((tCircleFunc5)(Circle_API [LCD_DRAWRECT_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e))              //void  LCD_DrawRect ( u16 x, u16 y, u16 width, u16 height, u16 color );
417
#define LCD_DisplayChar(a,b,c,d,e,f)                 ((tCircleFunc6)(Circle_API [LCD_DISPLAYCHAR_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e),(u32)(f))  //void  LCD_DisplayChar(u8 x, u8 y, u8 Ascii, u16 TextColor, u16 BGndColor, u16 CharMagniCoeff);
418
#define LCD_RectRead(a,b,c,d,e)                      ((tCircleFunc5)(Circle_API [LCD_RECTREAD_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e))              //void  LCD_RectRead ( u16 x, u16 y, u16 width, u16 height, u8* bmp );
419
#define LCD_SetBackLight(a)                          ((tCircleFunc1)(Circle_API [LCD_SETBACKLIGHT_ID])) ((u32)(a))                                              //void  LCD_SetBackLight(u32 newBaclightStart);
420
#define LCD_GetBackLight()                (u32)      (((tCircleFunc0)(Circle_API [LCD_GETBACKLIGHT_ID])) ())                                                    //u32   LCD_GetBackLight(void);
421
#define LCD_SetRotateScreen(a)                       ((tCircleFunc1)(Circle_API [LCD_SETROTATESCREEN_ID])) ((u32)(a))                                           //void  LCD_SetRotateScreen ( u8 RotateScreen)
422
#define LCD_GetRotateScreen()             (u32)      (((tCircleFunc0)(Circle_API [LCD_GETROTATESCREEN_ID])) ())                                                 //u8    LCD_GetRotateScreen (void)
423
#define LCD_SetScreenOrientation(a)                  ((tCircleFunc1)(Circle_API [LCD_SETSCREENORIENTATION_ID])) ((u32)(a))                                      //void LCD_SetScreenOrientation (Rotate_H12_V_Match_TypeDef ScreenOrientation)
424
#define LCD_GetScreenOrientation()        (u32)      (((tCircleFunc0)(Circle_API [LCD_GETSCREENORIENTATION_ID])) ())                                            //Rotate_H12_V_Match_TypeDef LCD_GetScreenOrientation (void)
425
#define LCD_SetBackLightOff()                        ((tCircleFunc0)(Circle_API [LCD_SETBACKLIGHT_OFF_ID])) ()
426
#define LCD_SetBackLightOn()                         ((tCircleFunc0)(Circle_API [LCD_SETBACKLIGHT_ON_ID])) ()
427
 
428
/// @endcond
429
 
430
//----------------------------------   DRAW   ----------------------------------
431
 
432
/// @cond Internal
433
 
434
/* Exported defines ----------------------------------------------------------*/
435
 
436
// DRAW functions definition
437
#define DRAW_SETDEFAULTCOLOR_ID                   (DRAW_ID + 0)         // Reset colors (bgnd + text)
438
#define DRAW_CLEAR_ID                             (DRAW_ID + 1)         // Clear the LCD display
439
#define DRAW_SETIMAGE_ID                          (DRAW_ID + 2)         // Draw a colored image
440
#define DRAW_SETIMAGEBW_ID                        (DRAW_ID + 3)         // Draw a black and white image
441
#define DRAW_SETLOGOBW_ID                         (DRAW_ID + 4)         // Draw logo
442
#define DRAW_DISPLAYVBAT_ID                       (DRAW_ID + 5)         // Display the voltage of battery in ascii
443
#define DRAW_DISPLAYTIME_ID                       (DRAW_ID + 6)         // Display time in ascii
444
#define DRAW_DISPLAYSTRING_ID                     (DRAW_ID + 7)         // Display a 17char max string of characters
445
#define DRAW_DISPLAYSTRINGINVERTED_ID             (DRAW_ID + 8)         // Display a 17char max string of characters with inverted colors
446
#define DRAW_GETCHARMAGNICOEFF_ID                 (DRAW_ID + 9)         // Return the magnifying value for the characters
447
#define DRAW_SETCHARMAGNICOEFF_ID                 (DRAW_ID + 10)        // Set the magnifying value for the characters
448
#define DRAW_GETTEXTCOLOR_ID                      (DRAW_ID + 11)        // Return the current text color
449
#define DRAW_SETTEXTCOLOR_ID                      (DRAW_ID + 12)        // Set the current text color
450
#define DRAW_GETBGNDCOLOR_ID                      (DRAW_ID + 13)        // Return the current background color
451
#define DRAW_SETBGNDCOLOR_ID                      (DRAW_ID + 14)        // Set the current background color
452
#define DRAW_LINE_ID                              (DRAW_ID + 15)        // Draw a Line between (using Bresenham algorithm) 
453
 
454
//Prototypes
455
#define DRAW_SetDefaultColor()                      ((tCircleFunc0)(Circle_API [DRAW_SETDEFAULTCOLOR_ID])) ()                                                 //void  DRAW_SetDefaultColor (void);
456
#define DRAW_Clear()                                ((tCircleFunc0)(Circle_API [DRAW_CLEAR_ID])) ()                                                           //void  DRAW_Clear(void);
457
#define DRAW_SetImage(a,b,c,d,e)                    ((tCircleFunc5)(Circle_API [DRAW_SETIMAGE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e))            //void  DRAW_SetImage(const u16 *imageptr, u8 x, u8 y, u8 width, u8 height);
458
#define DRAW_SetImageBW(a,b,c,d,e)                  ((tCircleFunc5)(Circle_API [DRAW_SETIMAGEBW_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e))          //void  DRAW_SetImageBW(const u8 *imageptr, u8 x, u8 y, u8 width, u8 height);
459
#define DRAW_SetLogoBW()                            ((tCircleFunc0)(Circle_API [DRAW_SETLOGOBW_ID])) ()                                                       //void  DRAW_SetLogoBW(void);
460
#define DRAW_DisplayVbat(a,b)                       ((tCircleFunc2)(Circle_API [DRAW_DISPLAYVBAT_ID])) ((u32)(a),(u32)(b))                                    //void  DRAW_DisplayVbat(u8 x, u8 y);
461
#define DRAW_DisplayTime(a,b)                       ((tCircleFunc2)(Circle_API [DRAW_DISPLAYTIME_ID])) ((u32)(a),(u32)(b))                                    //void  DRAW_DisplayTime(u8 x, u8 y);
462
#define DRAW_DisplayString(a,b,c,d)                 ((tCircleFunc4)(Circle_API [DRAW_DISPLAYSTRING_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))                //void  DRAW_DisplayString( u8 x, u8 y, u8 *ptr, u8 len );
463
#define DRAW_DisplayStringInverted(a,b,c,d)         ((tCircleFunc4)(Circle_API [DRAW_DISPLAYSTRINGINVERTED_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))        //void  DRAW_DisplayStringInverted( u8 x, u8 y, u8 *ptr, u8 len );
464
#define DRAW_GetCharMagniCoeff()              (u16) (((tCircleFunc0)(Circle_API [DRAW_GETCHARMAGNICOEFF_ID])) ())                                             //u16   DRAW_GetCharMagniCoeff(void);
465
#define DRAW_SetCharMagniCoeff(a)                   ((tCircleFunc1)(Circle_API [DRAW_SETCHARMAGNICOEFF_ID])) ((u32)(a))                                       //void  DRAW_SetCharMagniCoeff(u16 Coeff);
466
#define DRAW_GetTextColor()                   (u16) (((tCircleFunc0)(Circle_API [DRAW_GETTEXTCOLOR_ID])) ())                                                  //u16   DRAW_GetTextColor(void);
467
#define DRAW_SetTextColor(a)                        ((tCircleFunc1)(Circle_API [DRAW_SETTEXTCOLOR_ID])) ((u32)(a))                                            //void  DRAW_SetTextColor(u16 Color);
468
#define DRAW_GetBGndColor()                   (u16) (((tCircleFunc0)(Circle_API [DRAW_GETBGNDCOLOR_ID])) ())                                                  //u16   DRAW_GetBGndColor(void);
469
#define DRAW_SetBGndColor(a)                        ((tCircleFunc1)(Circle_API [DRAW_SETBGNDCOLOR_ID])) ((u32)(a))                                            //void  DRAW_SetBGndColor(u16 Color);
470
#define DRAW_Line(a,b,c,d,e)                        ((tCircleFunc5)(Circle_API [DRAW_LINE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e))                //void  DRAW_Line(s16 x1, s16 y1, s16 x2, s16 y2, u16 color );
471
/// @endcond
472
 
473
//--------------------------------   BUZZER  -----------------------------------
474
 
475
/* Exported type def ---------------------------------------------------------*/
476
 
477
/**
478
* @enum  BUZZER_mode
479
* @brief CircleOS buzzer modes.
480
*
481
* Without the undefined mode, the CircleOS provides 5 modes for its buzzer.
482
**/
483
enum BUZZER_mode
484
   {
485
   BUZZER_UNDEF      = -1,         /*!<  undefined mode for buzzer            */
486
   BUZZER_OFF        =  0,         /*!<  The buzzer is put off.               */
487
   BUZZER_ON         =  1,         /*!<  The buzzer is put on.                */
488
   BUZZER_SHORTBEEP  =  2,         /*!<  Make buzzer to bip for a short time  */
489
   BUZZER_LONGBEEP   =  3,         /*!<  Make buzzer to bip for a long time   */
490
   BUZZER_PLAYMUSIC  =  4          /*!<  Make buzzer to play a music          */
491
   };
492
 
493
/// @cond Internal
494
 
495
/* Exported defines ----------------------------------------------------------*/
496
#define BUZZER_BEEP  BUZZER_SHORTBEEP
497
 
498
// BUZZER functions definition
499
#define BUZZER_SETMODE_ID                       (BUZZER_ID + 0)   // Set new buzzer mode
500
#define BUZZER_GETMODE_ID                       (BUZZER_ID + 1)   // Get the current buzzer mode.
501
#define BUZZER_PLAY_MUSIC_ID                    (BUZZER_ID + 2)   // Plays the provided melody that follows the RTTTL Format.
502
 
503
// Prototypes
504
#define BUZZER_SetMode(a)                            ((tCircleFunc1)(Circle_API [BUZZER_SETMODE_ID])) ((u32)(a))               //void  BUZZER_SetMode( enum BUZZER_mode mode);
505
#define BUZZER_GetMode()      (enum  BUZZER_mode)    (((tCircleFunc0)(Circle_API [BUZZER_GETMODE_ID])) ())                     //enum  BUZZER_mode BUZZER_GetMode( void );
506
#define BUZZER_PlayMusic(a)                          ((tCircleFunc1)(Circle_API [BUZZER_PLAY_MUSIC_ID])) ((u32)(a))            //void BUZZER_PlayMusic (const u8 *melody );
507
 
508
/// @endcond
509
 
510
//---------------------------------   MENU   -----------------------------------
511
 
512
/* Exported defines ----------------------------------------------------------*/
513
#define REMOVE_MENU     0x01  /*!< Menu flag: remove menu when item selected. */
514
#define APP_MENU        0x02  /*!< Menu flag: item is an application.         */
515
#define MENU_MAXITEM    8     /*!< Maximum number of item in a menu.          */
516
 
517
/* Exported type def ---------------------------------------------------------*/
518
 
519
/**
520
* @struct   tMenuItem
521
* @brief    Menu item description.
522
**/
523
typedef struct
524
   {
525
   const char* Text;                            /*!<  Name of Item displayed in menu   */
526
   enum MENU_code (*Fct_Init)  ( void );        /*!<  First function launched if item is selected. */
527
   enum MENU_code (*Fct_Manage)( void );        /*!<  Second function launched after a "return MENU_CONTINU_COMMAND" in the first function   */
528
   int fRemoveMenu;                             /*!<  Flag to know if remove menu at end  */
529
   } tMenuItem;
530
 
531
/**
532
* @struct   tMenu
533
* @brief    Menu description.
534
**/
535
typedef struct
536
   {
537
   unsigned fdispTitle: 1;                /*!< Display title is set.          */
538
   const char* Title;                     /*!< Menu title.                    */
539
   int NbItems;                           /*!< Number of items in the menu ( must be <= MENU_MAXITEM )  */
540
   int LgMax;                             /*!< Unused.                        */
541
   int XPos;                              /*!< X position of menu bottom-left corner. */
542
   int YPos;                              /*!< Y position of menu bottom-left corner. */
543
   int XSize;                             /*!< Unused.                        */
544
   int YSize;                             /*!< Unused.                        */
545
   unsigned int SelectedItem;             /*!< ID of selected item (0 for first item, 1 for second item, ...) */
546
   tMenuItem Items[MENU_MAXITEM];         /*!< Items of menu.  */
547
   } tMenu;
548
 
549
/**
550
* @enum  MENU_code
551
* @brief Application return values.
552
*
553
* List of all the codes available for CircleOS application return values.
554
**/
555
enum MENU_code
556
   {
557
   MENU_LEAVE              = 0,                    /*!< Leave application.    */
558
   MENU_CONTINUE           = 1,                    /*!< Continue application. */
559
   MENU_REFRESH            = 2,                    /*!< Refresh current menu. */
560
   MENU_CHANGE             = 3,                    /*!< Change current menu.  */
561
   MENU_CONTINUE_COMMAND   = 4                     /*!< Sent by Ini functions.*/
562
   };
563
 
564
/// @cond Internal
565
 
566
/* Exported defines ----------------------------------------------------------*/
567
 
568
// MENU functions definition
569
#define MENU_SET_ID                             (MENU_ID + 0)        // Display a menu
570
#define MENU_REMOVE_ID                          (MENU_ID + 1)        // Remove the current menu, DRAW_Clear and set pointer mode to "POINTER_ON".
571
#define MENU_QUESTION_ID                        (MENU_ID + 2)        // Dedicated menu for ask question and yes/no responses
572
#define MENU_PRINT_ID                           (MENU_ID + 3)        // Display a popup menu with a string.
573
#define MENU_CLEAR_CURRENT_COMMAND_ID           (MENU_ID + 4)        // Set CurrentCommand to 0
574
#define MENU_SET_LEVELTITLE_ID                  (MENU_ID + 5)        // Set the title of level menu managed by MENU_SetLevel_Mgr.
575
#define MENU_SET_TEXTCOLOR_ID                   (MENU_ID + 6)        // Set the color used for text menu.
576
#define MENU_GET_TEXTCOLOR_ID                   (MENU_ID + 7)        // Return the color used for text menu.
577
#define MENU_SET_BGNDCOLOR_ID                   (MENU_ID + 8)        // Set the background color used for menu.
578
#define MENU_GET_BGNDCOLOR_ID                   (MENU_ID + 9)        // Return the background color used for menu.
579
#define MENU_QUIT_ID                            (MENU_ID + 10)       // Leave the current menu (stand for "cancel" and do a DRAW_Clear)
580
#define MENU_SET_LEVELINI_ID                    (MENU_ID + 11)       // Initialise a generic function to set a avalue in the range of [0,4]
581
#define MENU_CLEAR_CURRENT_MENU_ID              (MENU_ID + 12)       // Set CurrentMenu to 0
582
#define MENU_SET_LEVEL_MGR_ID                   (MENU_ID + 13)       // Generic function to set a avalue in the range of [0,4] (handling of the control)
583
 
584
// Prototypes
585
#define MENU_Set(a)                                  ((tCircleFunc1)(Circle_API [MENU_SET_ID])) ((u32)(a))                    //void  MENU_Set ( tMenu *mptr );
586
#define MENU_Remove()                                ((tCircleFunc0)(Circle_API [MENU_REMOVE_ID])) ()                         //void  MENU_Remove ( void ) ;
587
#define MENU_Question(a,b)                           ((tCircleFunc2)(Circle_API [MENU_QUESTION_ID])) ((u32)(a),(u32)(b))      //void  MENU_Question ( char *str, int *answer );
588
#define MENU_Print(a)                                ((tCircleFunc1)(Circle_API [MENU_PRINT_ID])) ((u32)(a))                  //void  MENU_Print ( char *str );
589
#define MENU_ClearCurrentCommand()                   ((tCircleFunc0)(Circle_API [MENU_CLEAR_CURRENT_COMMAND_ID])) ()          //void MENU_ClearCurrentCommand(void)
590
#define MENU_SetLevelTitle(a)                        ((tCircleFunc1)(Circle_API [MENU_SET_LEVELTITLE_ID])) ((u32)(a))         //void MENU_SetLevelTitle(u8* title)
591
#define MENU_SetTextColor(a)                         ((tCircleFunc1)(Circle_API [MENU_SET_TEXTCOLOR_ID])) ((u32)(a))          //void MENU_SetTextColor ( int TextColor )
592
#define MENU_GetTextColor()                 (u32)    (((tCircleFunc0)(Circle_API [MENU_GET_TEXTCOLOR_ID])) ())                //int MENU_GetTextColor ( void )
593
#define MENU_SetBGndColor(a)                         ((tCircleFunc1)(Circle_API [MENU_SET_BGNDCOLOR_ID])) ((u32)(a))          //void MENU_SetBGndColor ( int BGndColor )
594
#define MENU_GetBGndColor()                 (u32)    (((tCircleFunc0)(Circle_API [MENU_GET_BGNDCOLOR_ID])) ())                //int MENU_GetBGndColor ( void )
595
#define MENU_Quit()              (enum MENU_code)    (((tCircleFunc0)(Circle_API [MENU_QUIT_ID])) ())                         //enum MENU_code MENU_Quit ( void )
596
#define MENU_SetLevel_Ini()      (enum MENU_code)    (((tCircleFunc0)(Circle_API [MENU_SET_LEVELINI_ID])) ())                 //enum MENU_code MENU_SetLevel_Ini ( void )
597
#define MENU_ClearCurrentMenu()                       ((tCircleFunc0)(Circle_API [MENU_CLEAR_CURRENT_MENU_ID])) ()            //void MENU_ClearCurrentMenu(void)
598
#define MENU_SetLevel_Mgr(a,b)   (enum MENU_code)    ((tCircleFunc2)(Circle_API [MENU_SET_LEVEL_MGR_ID])) ((u32)(a),(u32)(b)) //enum MENU_code MENU_SetLevel_Mgr ( u32 *value, u32 value_range [] )
599
 
600
/// @endcond
601
 
602
//----------------------------------   LED -------------------------------------
603
 
604
/* Exported types ------------------------------------------------------------*/
605
 
606
/**
607
* @enum  LED_mode
608
* @brief LED modes.
609
*
610
* LEDs may be on, off or blinking slowly or fastly!
611
**/
612
enum LED_mode
613
   {
614
   LED_UNDEF       = -1,                     /*!< Undefined led mode.         */
615
   LED_OFF         = 0,                      /*!< Put off the led.            */
616
   LED_ON          = 1,                      /*!< Put on the led.             */
617
   LED_BLINKING_LF = 2,                      /*!< Slow blinking led mode.     */
618
   LED_BLINKING_HF = 3                       /*!< Fast blinking led mode.     */
619
   };
620
 
621
/**
622
* @enum LED_id
623
* @brief Available LEDs.
624
*
625
* List of all the available LEDs.
626
**/
627
enum LED_id
628
   {
629
   LED_GREEN = 0,                                        /*!< Green led id.   */
630
   LED_RED = 1                                           /*!< Red led id.     */
631
   };
632
 
633
/// @cond Internal
634
 
635
/* Exported defines ----------------------------------------------------------*/
636
 
637
// LED functions definition
638
#define LED_SET_ID            (LED_ID + 0)      // Set a specified LED in a specified mode.
639
 
640
// Prototypes
641
#define LED_Set(a,b)          ((tCircleFunc2)(Circle_API [LED_SET_ID])) ((u32)(a),(u32)(b))  //void LED_Set ( enum LED_id id, enum LED_mode mode )               //void LED_Set ( enum LED_id id, enum LED_mode mode );
642
 
643
/// @endcond
644
 
645
//--------------------------------   RTC  --------------------------------------
646
 
647
/* Exported defines ----------------------------------------------------------*/
648
 
649
// Backup registers
650
#define BKP_SYS1  1        /*!<  Backup register reserved for OS  */
651
#define BKP_SYS2  2        /*!<  Backup register reserved for OS  */
652
#define BKP_SYS3  3        /*!<  Backup register reserved for OS  */
653
#define BKP_SYS4  4        /*!<  Backup register reserved for OS  */
654
#define BKP_SYS5  5        /*!<  Backup register reserved for OS  */
655
#define BKP_SYS6  6        /*!<  Backup register reserved for OS  */
656
 
657
#define BKP_USER1    7     /*!<  Backup available for users application */
658
#define BKP_USER2    8     /*!<  Backup available for users application */
659
#define BKP_USER3    9     /*!<  Backup available for users application */
660
#define BKP_USER4    10    /*!<  Backup available for users application */
661
 
662
/// @cond Internal
663
 
664
//RTC functions definition
665
#define RTC_SET_TIME_ID       (RTC_ID + 0)      // Set current time.
666
#define RTC_GET_TIME_ID       (RTC_ID + 1)      // Return current time.
667
#define RTC_DISPLAY_TIME_ID   (RTC_ID + 2)      // Display current time on the 6th line at column 0.
668
 
669
// Prototypes
670
#define RTC_SetTime(a,b,c)    ((tCircleFunc3)(Circle_API [RTC_SET_TIME_ID])) ((u32)(a),(u32)(b),(u32)(c))     //void  RTC_SetTime (u32 THH, u32 TMM, u32 TSS);
671
#define RTC_GetTime(a,b,c)    ((tCircleFunc3)(Circle_API [RTC_GET_TIME_ID])) ((u32)(a),(u32)(b),(u32)(c))     //void  RTC_GetTime (u32 * THH, u32 * TMM, u32 * TSS);
672
#define RTC_DisplayTime()     ((tCircleFunc0)(Circle_API [RTC_DISPLAY_TIME_ID])) ()                           //void  RTC_DisplayTime ( void );
673
 
674
/// @endcond
675
 
676
//--------------------------------- Application -------------------------------
677
typedef void  (*tAppPtrMgr) ( int , int );
678
 
679
#endif /*__CIRCLE_API_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.