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