• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

circle_api.h

Go to the documentation of this file.
00001 /****************** COPYRIGHT (C) 2007-2010 RAISONANCE S.A.S. *****************/
00031 /*******************************************************************************
00032 *
00033 * Use this header with version 1.5 or later of the OS.
00034 *
00035 * For a complete documentation on the CircleOS, please go to:
00036 *  http://www.stm32circle.com
00037 *
00038 *******************************************************************************/
00039 
00040 /* Define to prevent recursive inclusion -------------------------------------*/
00041 #ifndef __CIRCLE_API_H
00042 #define __CIRCLE_API_H
00043 
00044 #include "stdint.h"
00045 
00046 /*-------------------------------- Type definitions --------------------------*/
00047 #include "circle_types.h"
00048 
00049 /*-------------------------Platform specific definitions ---------------------*/
00050 #include "circle_spe.h"
00051 
00052 /*-------------------------------- General -----------------------------------*/
00059 extern enum eSpeed
00060 {
00061     SPEED_VERY_LOW    = 1,
00062     SPEED_LOW         = 2,
00063     SPEED_MEDIUM      = 3,
00064     SPEED_HIGH        = 4,
00065     SPEED_VERY_HIGH   = 5
00066 } CurrentSpeed;
00067 
00068 enum eSchHandler
00069 {
00070     MEMS_SCHHDL_ID     = 0,
00071     LED_SCHHDL_ID      = 1,
00072     BUTTON_SCHHDL_ID   = 2,
00073     BUZZER_SCHHDL_ID   = 3,
00074     MENU_SCHHDL_ID     = 4,
00075     POINTER_SCHHDL_ID  = 5,
00076     LCD_SCHHDL_ID      = 6,
00077     DRAW_SCHHDL_ID     = 7,
00078     RTC_SCHHDL_ID      = 8,
00079     AUDIO_SCHHDL_ID    = 9,
00080     TOUCHSCR_SCHHDL_ID = 10,
00081     TOOLBAR_SCHHDL_ID  = 11,
00082     POWER_SCHHDL_ID    = 12,
00083     UNUSED5_SCHHDL_ID  = 13,
00084     UNUSED6_SCHHDL_ID  = 14,
00085     UNUSED7_SCHHDL_ID  = 15,
00086     UNUSED8_SCHHDL_ID  = 16
00087 };
00088 
00089 
00091 
00092 /* Typedefs ------------------------------------------------------------------*/
00093 typedef u32( *tCircleFunc0 )( void );
00094 typedef u32( *tCircleFunc1 )( u32 param1 );
00095 typedef u32( *tCircleFunc2 )( u32 param1, u32 param2 );
00096 typedef u32( *tCircleFunc3 )( u32 param1, u32 param2, u32 param3 );
00097 typedef u32( *tCircleFunc4 )( u32 param1, u32 param2, u32 param3, u32 param4 );
00098 typedef u32( *tCircleFunc5 )( u32 param1, u32 param2, u32 param3, u32 param4, u32 param5 );
00099 typedef u32( *tCircleFunc6 )( u32 param1, u32 param2, u32 param3, u32 param4, u32 param5, u32 param6 );
00100 typedef u32( *tCircleFunc7 )( u32 param1, u32 param2, u32 param3, u32 param4, u32 param5, u32 param6, u32 param7 );
00101 typedef u32( *tCircleFunc8 )( u32 param1, u32 param2, u32 param3, u32 param4, u32 param5, u32 param6, u32 param7, u32 param8 );
00102 
00103 extern tCircleFunc0( *ptrCircle_API )[];
00104 
00105 /* Defines -------------------------------------------------------------------*/
00106 #define Circle_API   (*ptrCircle_API)
00107 
00108 #define POINTER_ID   0x00
00109 #define DRAW_ID      0x20
00110 #define LCD_ID       0x40
00111 #define LED_ID       0x60
00112 #define TOUCHSCR_ID  0x61
00113 #define TOOLBAR_ID   0x6A
00114 #define MEMS_ID      0x70
00115 #define BUTTON_ID    0x80
00116 #define JOYSTICK_ID  0x84
00117 #define BUZZER_ID    0x90
00118 #define AUDIO_ID     0x93
00119 #define MENU_ID      0xA0
00120 #define UTIL_ID      0xB0
00121 #define RTC_ID       0xC0
00122 #define AUDIO2_ID    0xC3
00123 #define UTIL2_ID     0xC8
00124 #define SHUTDOWN_ID  0xD0
00125 #define FS_ID        0xD8
00126 
00127 /*/ UTIL functions definition.*/
00128 #define UTIL_SET_PLL_ID                 (UTIL_ID + 0)    /* Set clock frequency.*/
00129 #define UTIL_GET_PLL_ID                 (UTIL_ID + 1)    /* Get clock frequency.*/
00130 #define UTIL_UINT2STR_ID                (UTIL_ID + 2)    /* Convert an unsigned integer into a string.*/
00131 #define UTIL_INT2STR_ID                 (UTIL_ID + 3)    /* Convert a signed integer into a string.*/
00132 #define UTIL_GET_VERSION_ID             (UTIL_ID + 4)    /* Get CircleOS version.*/
00133 #define UTIL_READ_BACKUPREGISTER_ID     (UTIL_ID + 5)    /* Reads data from the specified Data Backup Register.*/
00134 #define UTIL_WRITE_BACKUPREGISTER_ID    (UTIL_ID + 6)    /* Writes data to the specified Data Backup Register.*/
00135 #define UTIL_GET_BAT_ID                 (UTIL_ID + 7)    /* Return the batterie tension in mV.*/
00136 #define UTIL_GET_USB_ID                 (UTIL_ID + 8)    /* Return the USB connexion state.*/
00137 #define UTIL_SET_IRQ_HANDLER_ID         (UTIL_ID + 9)    /* Replace an irq handler*/
00138 #define UTIL_GET_IRQ_HANDLER_ID         (UTIL_ID + 10)   /* Get the current irq handler*/
00139 #define UTIL_SET_SCH_HANDLER_ID         (UTIL_ID + 11)   /* Replace an irq handler*/
00140 #define UTIL_GET_SCH_HANDLER_ID         (UTIL_ID + 12)   /* Get the current irq handler*/
00141 #define UTIL_GET_TEMP_ID                (UTIL_ID + 13)   /* Return the temperature (1/100 C)*/
00142 #define UTIL_SET_TEMPMODE_ID            (UTIL_ID + 14)   /* Set the temperature mode (0: mCelcius, 1: mFahrenheit*/
00143 #define UTIL_GET_PRIMERTYPE_ID          (UTIL_ID + 15)   /* Get the type of PRIMER (1: Primer1, 2: Primer2)*/
00144 #define UTIL_GET_APP_ADDRESS_ID         (UTIL2_ID + 0)   /* Get an application address.*/
00145 #define UTIL_IS_STAND_ALONE_ID          (UTIL2_ID + 1)   /* Get current mode, stand alone or not */
00146 
00147 typedef void ( *tHandler )( void );
00148 
00149 /* Prototypes.*/
00150 #define UTIL_SetPll(a)                          ( (tCircleFunc1)(Circle_API [UTIL_SET_PLL_ID])) ((u32)(a))                                   /* void UTIL_SetPll( enum eSpeed speed );*/
00151 #define UTIL_GetPll()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_PLL_ID])) ())                                          /* enum eSpeed UTIL_GetPll( void );*/
00152 #define UTIL_uint2str(a,b,c,d)                  ( (tCircleFunc4)(Circle_API [UTIL_UINT2STR_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))       /* void uint2str( u8* ptr , u32 X, u16 digit, s32 fillwithzero );*/
00153 #define UTIL_int2str(a,b,c,d)                   ( (tCircleFunc4)(Circle_API [UTIL_INT2STR_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))        /* void  int2str( u8* ptr , s32 X, u16 digit, s32 fillwithzero );*/
00154 #define UTIL_GetVersion()        (const u8*)    (((tCircleFunc0)(Circle_API [UTIL_GET_VERSION_ID])) ())                                      /* u8* UTIL_GetVersion( void );*/
00155 #define UTIL_ReadBackupRegister(a)     (u32)    (((tCircleFunc1)(Circle_API [UTIL_READ_BACKUPREGISTER_ID])) ((u32)(a)))                      /* u16 UTIL_ReadBackupRegister( u16 BKP_DR );*/
00156 #define UTIL_WriteBackupRegister(a,b)           ( (tCircleFunc2)(Circle_API [UTIL_WRITE_BACKUPREGISTER_ID])) ((u32)(a),(u32)(b))             /* void UTIL_WriteBackupRegister( u16 BKP_DR, u16 Data );*/
00157 #define UTIL_GetBat()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_BAT_ID])) ())                                          /* u16 UTIL_GetBat( void );*/
00158 #define UTIL_GetUsb()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_USB_ID])) ())                                          /* u8 UTIL_GetUsb( void );*/
00159 #define UTIL_SetIrqHandler(a,b)                 (((tCircleFunc2)(Circle_API [UTIL_SET_IRQ_HANDLER_ID])) ((s32)a,(u32) b))                    /* void UTIL_SetIrqHandler ( s32 , tHandler );*/
00160 #define UTIL_GetIrqHandler(a)          (u32)    (((tCircleFunc1)(Circle_API [UTIL_GET_IRQ_HANDLER_ID])) ((s32)a))                            /* tHandler* UTIL_GetIrqHandler ( s32 );*/
00161 #define UTIL_SetSchHandler(a,b)                 (((tCircleFunc2)(Circle_API [UTIL_SET_SCH_HANDLER_ID])) ((s32)a,(u32)b))                     /* void UTIL_SetSchHandler ( s32 , tHandler );*/
00162 #define UTIL_GetSchHandler(a)          (u32)    (((tCircleFunc1)(Circle_API [UTIL_GET_SCH_HANDLER_ID])) ((s32)a))                            /* tHandler* UTIL_GetSchHandler ( s32 );*/
00163 #define UTIL_GetTemp()                 (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_TEMP_ID])) ())                                         /* u16 UTIL_GetTemp( void );*/
00164 #define UTIL_SetTempMode(a)                     (((tCircleFunc1)(Circle_API [UTIL_SET_TEMPMODE_ID])) ((s32)a))                               /* void UTIL_SetTempMode( s32 mode );*/
00165 #define UTIL_GetPrimerType()           (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_PRIMERTYPE_ID])) ())                                   /* u16 UTIL_GetPrimerType();*/
00166 #define UTIL_GetAppAddress(a)          (u32)    (((tCircleFunc1)(Circle_API [UTIL_GET_APP_ADDRESS_ID])) ((u32)(a)))                          /* long unsigned UTIL_GetAppAddress(u8* AppName);*/
00167 #define UTIL_IsStandAloneMode()        (u32)    (((tCircleFunc0)(Circle_API [UTIL_IS_STAND_ALONE_ID])) ())        
00168 
00170 
00171 /*---------------------------------   MEMS  ------------------------------------*/
00172 
00173 /* Exported types ------------------------------------------------------------*/
00174 
00181 typedef enum
00182 {
00183     V12 = 0, // upright
00184     V3 = 1,  // on the right side
00185     V6 = 2,  // upside down
00186     V9 = 3,  // on the left side
00187     V12BMP = 4,
00188     V3BMP = 5,
00189     V6BMP = 6,
00190     V9BMP = 7
00191 } Rotate_H12_V_Match_TypeDef;
00192 
00197 typedef struct
00198 {
00199     s16 OutX;                     
00200     s16 OutX_F4;                  
00201     s16 OutX_F16;                 
00202     s32 OutX_F64;                 
00203     s32 OutX_F256;                
00204     s16 OutY;                     
00205     s16 OutY_F4;                  
00206     s16 OutY_F16;                 
00207     s32 OutY_F64;                 
00208     s32 OutY_F256;                
00209     s16 OutZ;                     
00210     s16 OutZ_F4;                  
00211     s16 OutZ_F16;                 
00212     s32 OutZ_F64;                 
00213     s32 OutZ_F256;                
00214     s16 Shocked;                  
00215     s16 RELATIVE_X;               
00216     s16 RELATIVE_Y;               
00217     s16 DoubleClick;              
00218 } tMEMS_Info;
00219 
00221 
00222 /* Exported defines ----------------------------------------------------------*/
00223 
00224 /* MEMS functions definition*/
00225 #define MEMS_GET_POSITION_ID   (MEMS_ID + 0)       /* Return the current (relative) Mems information*/
00226 #define MEMS_GET_ROTATION_ID   (MEMS_ID + 1)       /* Return the current screen orientation of the circle*/
00227 #define MEMS_SET_NEUTRAL_ID    (MEMS_ID + 2)       /* Set the current position as "neutral position"*/
00228 #define MEMS_GET_INFO_ID       (MEMS_ID + 3)       /* Return Mems informations*/
00229 
00230 /* Prototypes*/
00231 #define MEMS_GetPosition(a,b)             ((tCircleFunc2)(Circle_API [MEMS_GET_POSITION_ID])) ((u32)(a),(u32)(b))      /*  void MEMS_GetPosition(s16 * pX, s16* pY);*/
00232 #define MEMS_GetRotation(a)               ((tCircleFunc1)(Circle_API [MEMS_GET_ROTATION_ID])) ((u32)(a))               /*  void MEMS_GetRotation(Rotate_H12_V_Match_TypeDef * H12);*/
00233 #define MEMS_SetNeutral()                 ((tCircleFunc0)(Circle_API [MEMS_SET_ROTATION_ID])) ()                       /*  void MEMS_SetNeutral( void );*/
00234 #define MEMS_GetInfo()    ( (tMEMS_Info*) (((tCircleFunc0)(Circle_API [MEMS_GET_INFO_ID])) ()))                        /*  tMEMS_Info* MEMS_GetInfo (void)*/
00235 
00237 
00238 /*--------------------------------   POINTER  ----------------------------------*/
00239 
00240 /* Exported types ------------------------------------------------------------*/
00241 
00248 enum POINTER_mode
00249 {
00250     POINTER_UNDEF        = -1,    
00251     POINTER_OFF          =  0,    
00252     POINTER_ON           =  1,    
00253     POINTER_MENU         =  2,    
00254     POINTER_APPLICATION  =  3,    
00255     POINTER_RESTORE_LESS =  4     
00256 };
00257 
00264 enum POINTER_state
00265 {
00266     POINTER_S_UNDEF      = -1,                
00267     POINTER_S_DISABLED   =  0,                
00268     POINTER_S_ENABLED    =  1                 
00269 };
00270 
00275 typedef struct
00276 {
00277     s16 xPos;                              
00278     s16 yPos;                              
00279     s16 shift_PosX;                        
00280     s16 shift_PosY;                        
00281     s16 X_PosMin;                          
00282     s16 Y_PosMin;                          
00283     s16 X_PosMax;                          
00284     s16 Y_PosMax;                          
00285 } tPointer_Info;
00286 
00288 
00289 /* Exported defines ---------------------------------------------------------*/
00290 #define POINTER_WIDTH 7
00291 
00292 /* POINTER functions definition*/
00293 #define POINTER_SET_RECT_ID                   (POINTER_ID + 0)          /* Set new limits for the move of the pointer*/
00294 #define POINTER_SETRECTSCREEN_ID              (POINTER_ID + 1)          /* Remove any space restriction for the pointer moves.*/
00295 #define POINTER_GETCURRENTANGLESTART_ID       (POINTER_ID + 2)          /* Return the current minimum angle to move pointer*/
00296 #define POINTER_SETCURRENTANGLESTART_ID       (POINTER_ID + 3)          /* Set the current minimum angle to move pointer*/
00297 #define POINTER_GETCURRENTSPEEDONANGLE_ID     (POINTER_ID + 4)          /* Return the ratio speed / angle*/
00298 #define POINTER_SETCURRENTSPEEDONANGLE_ID     (POINTER_ID + 5)          /* Set the ratio speed / angle*/
00299 #define POINTER_SETMODE_ID                    (POINTER_ID + 6)          /* Change the current mode of the pointer management*/
00300 #define POINTER_GETMODE_ID                    (POINTER_ID + 7)          /* Return the current mode of the pointer management*/
00301 #define POINTER_SETCURRENTPOINTER_ID          (POINTER_ID + 8)          /* Set the dimention and bitmap of pointer*/
00302 #define POINTER_GETSTATE_ID                   (POINTER_ID + 9)          /* Return the current state*/
00303 #define POINTER_DRAW_ID                       (POINTER_ID + 10)         /* Draw a pointer*/
00304 #define POINTER_SAVE_ID                       (POINTER_ID + 11)         /* Save the background of the pointer*/
00305 #define POINTER_RESTORE_ID                    (POINTER_ID + 12)         /* Restore the background of the pointer*/
00306 #define POINTER_GETPOSITION_ID                (POINTER_ID + 13)         /* Return the poistion of the cursor (x=lower byte, y = upperbyte)*/
00307 #define POINTER_SETPOSITION_ID                (POINTER_ID + 14)         /* Force the position of the pointer in the screen*/
00308 #define POINTER_SETAPPLICATION_POINTER_MGR_ID (POINTER_ID + 15)         /* Set the application pointer manager*/
00309 #define POINTER_SETCOLOR_ID                   (POINTER_ID + 16)         /* Set pointer color*/
00310 #define POINTER_GETCOLOR_ID                   (POINTER_ID + 17)         /* Return pointer color*/
00311 #define POINTER_GETINFO_ID                    (POINTER_ID + 18)         /* Return pointer informations*/
00312 #define POINTER_SET_CURRENT_AREASTORE_ID      (POINTER_ID + 19)         /* Change the current storage area*/
00313 
00314 /* Prototypes*/
00315 #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*/
00316 #define POINTER_SetRectScreen()                       ((tCircleFunc0)(Circle_API [POINTER_SETRECTSCREEN_ID])) ()                                        /*void POINTER_SetRectScreen ( void );*/
00317 #define POINTER_GetCurrentAngleStart()    (u16)      (((tCircleFunc0)(Circle_API [POINTER_GETCURRENTANGLESTART_ID])) ())                                /*u16  POINTER_GetCurrentAngleStart ( void );*/
00318 #define POINTER_SetCurrentAngleStart(a)               ((tCircleFunc1)(Circle_API [POINTER_SETCURRENTANGLESTART_ID])) ((u32)(a))                         /*void POINTER_SetCurrentAngleStart ( u16 );*/
00319 #define POINTER_GetCurrentSpeedOnAngle()  (u16)      (((tCircleFunc0)(Circle_API [POINTER_GETCURRENTSPEEDONANGLE_ID])) ())                              /*u16  POINTER_GetCurrentSpeedOnAngle ( void );*/
00320 #define POINTER_SetCurrentSpeedOnAngle(a)             ((tCircleFunc1)(Circle_API [POINTER_SETCURRENTSPEEDONANGLE_ID])) ((u32)(a))                       /*void POINTER_SetCurrentSpeedOnAngle ( u16  newspeed );*/
00321 #define POINTER_SetMode(a)                            ((tCircleFunc1)(Circle_API [POINTER_SETMODE_ID])) ((u32)(a))                                      /*void POINTER_SetMode( enum POINTER_mode mode);*/
00322 #define POINTER_GetMode()         (enum POINTER_mode)(((tCircleFunc0)(Circle_API [POINTER_GETMODE_ID])) ())                                             /*enum POINTER_mode POINTER_GetMode( void );*/
00323 #define POINTER_SetCurrentPointer(a,b,c)              ((tCircleFunc3)(Circle_API [POINTER_SETCURRENTPOINTER_ID])) ((u32)(a),(u32)(b),(u32)(c))          /*void POINTER_SetCurrentPointer( u8 width, u8 height, u8 *bmp);*/
00324 #define POINTER_GetState()       (enum POINTER_state)(((tCircleFunc0)(Circle_API [POINTER_GETSTATE_ID])) ())                                            /*enum POINTER_state POINTER_GetState(void);*/
00325 #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);*/
00326 #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);*/
00327 #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);*/
00328 #define POINTER_GetPos()                        (u16)(((tCircleFunc0)(Circle_API [POINTER_GETPOSITION_ID])) ())                                         /*u16  POINTER_GetPos(void);*/
00329 #define POINTER_SetPos(a,b)                           ((tCircleFunc2)(Circle_API [POINTER_SETPOSITION_ID])) ((u32)(a),(u32)(b))                         /*void POINTER_SetPos ( u16 x, u16 y );*/
00330 #define POINTER_SetApplication_Pointer_Mgr(a)         ((tCircleFunc1)(Circle_API [POINTER_SETAPPLICATION_POINTER_MGR_ID])) ((u32)(a))                   /*void POINTER_SetApplication_Pointer_Mgr(  tAppPtrMgr mgr );*/
00331 #define POINTER_SetColor(a)                           ((tCircleFunc1)(Circle_API [POINTER_SETCOLOR_ID])) ((u32)(a))                                     /*void POINTER_SetColor ( u16 color )*/
00332 #define POINTER_GetColor()                      (u16)(((tCircleFunc0)(Circle_API [POINTER_GETCOLOR_ID])) ())                                            /*u16  POINTER_GetColor ( void )*/
00333 #define POINTER_GetInfo()      (tPointer_Info*)      (((tCircleFunc0)(Circle_API [POINTER_GETINFO_ID])) ())                                             /*tPointer_Info* POINTER_GetInfo ( void )*/
00334 #define POINTER_SetCurrentAreaStore(a)                ((tCircleFunc1)(Circle_API [POINTER_SET_CURRENT_AREASTORE_ID])) ((u32)(a))                        /*void POINTER_SetCurrentAreaStore ( u8 *ptr )*/
00335 
00337 
00338 /*--------------------------------   BUTTON -----------------------------------*/
00339 
00340 /* Exported types ------------------------------------------------------------*/
00341 
00348 enum BUTTON_mode
00349 {
00350     BUTTON_DISABLED      = -1,       
00351     BUTTON_ONOFF         =  0,       
00352     BUTTON_ONOFF_FORMAIN =  1,       
00353     BUTTON_WITHCLICK     =  2        
00354 };
00355 
00362 enum BUTTON_state
00363 {
00364     BUTTON_UNDEF            = -1,    
00365     BUTTON_RELEASED         =  0,    
00366     BUTTON_PUSHED           =  1,    
00367     BUTTON_PUSHED_FORMAIN   =  2,    
00368     BUTTON_CLICK            =  3,    
00369     BUTTON_DBLCLICK         =  4     
00370 };
00371 
00373 
00374 /* Exported defines ----------------------------------------------------------*/
00375 
00376 
00377 /* BUTTON functions definition */
00378 #define BUTTON_GETSTATE_ID                   (BUTTON_ID + 0)         /* Return state of button*/
00379 #define BUTTON_SETMODE_ID                    (BUTTON_ID + 1)         /* Set button mode*/
00380 #define BUTTON_GETMODE_ID                    (BUTTON_ID + 2)         /* Return button mode*/
00381 #define BUTTON_WAITFORRELEASE_ID             (BUTTON_ID + 3)         /* Disable temporarily any new button event*/
00382 
00383 /* Prototypes*/
00384 #define BUTTON_GetState()           (enum BUTTON_state)(((tCircleFunc0)(Circle_API [BUTTON_GETSTATE_ID])) ())       /* enum BUTTON_state BUTTON_GetState(void);*/
00385 #define BUTTON_SetMode(a)                               ((tCircleFunc1)(Circle_API [BUTTON_SETMODE_ID])) ((u32)(a)) /* void BUTTON_SetMode( enum BUTTON_mode mode);*/
00386 #define BUTTON_GetMode()             (enum BUTTON_mode)(((tCircleFunc0)(Circle_API [BUTTON_GETMODE_ID])) ())        /* enum BUTTON_mode BUTTON_GetMode ( void ) ;*/
00387 #define BUTTON_WaitForRelease()                         ((tCircleFunc0)(Circle_API [BUTTON_WAITFORRELEASE_ID])) ()  /* void BUTTON_WaitForRelease(void);*/
00388 
00390 
00391 /*------------------------------   JOYSTICK -----------------------------------*/
00392 
00393 /* Exported types ------------------------------------------------------------*/
00394 
00401 enum JOYSTICK_state
00402 {
00403     JOYSTICK_UNDEF     = -1,        
00404     JOYSTICK_RELEASED  =  0,        
00405     JOYSTICK_LEFT      =  1,        
00406     JOYSTICK_UP        =  2,        
00407     JOYSTICK_RIGHT     =  3,        
00408     JOYSTICK_DOWN      =  4,        
00409     JOYSTICK_RIGHT_UP   =  11,      /*JOYSTICK_RIGHT | JOYSTICK_UP*/
00410     JOYSTICK_LEFT_UP    =  5,       /*JOYSTICK_LEFT  | JOYSTICK_UP*/
00411     JOYSTICK_RIGHT_DOWN =  13,      /*JOYSTICK_RIGHT | JOYSTICK_DOWN*/
00412     JOYSTICK_LEFT_DOWN  =  7,       /*JOYSTICK_LEFT  | JOYSTICK_DOWN */
00413 };
00414 
00416 
00417 /* Exported defines ----------------------------------------------------------*/
00418 
00419 
00420 /* JOYSTICK functions definition*/
00421 #define JOYSTICK_GETSTATE_ID                   (JOYSTICK_ID + 0)     /* Return state of joystick*/
00422 #define JOYSTICK_WAITFORRELEASE_ID             (JOYSTICK_ID + 1)     /* Disable temporarily any new joystick event*/
00423 
00424 /* Prototypes*/
00425 #define JOYSTICK_GetState()       (enum JOYSTICK_state) (((tCircleFunc0)(Circle_API [JOYSTICK_GETSTATE_ID])) ())        // enum JOYSTICK_state JOYSTICK_GetState(void);
00426 #define JOYSTICK_WaitForRelease()                        ((tCircleFunc0)(Circle_API [JOYSTICK_WAITFORRELEASE_ID])) ()   // void JOYSTICK_WaitForRelease(void);
00427 
00429 
00430 /*----------------------------------   LCD   -----------------------------------*/
00431 
00432 /* Exported defines ----------------------------------------------------------*/
00433 
00434 /* RGB is 16-bit coded as    G2G1G0B4 B3B2B1B0 R4R3R2R1 R0G5G4G3*/
00435 #define RGB_MAKE(xR,xG,xB)    ( ( (((xG)>>2)&0x07)<<13 ) + ( (xG)>>5 )  +      \
00436                                 ( ((xB)>>3) << 8 )          +      \
00437                                 ( ((xR)>>3) << 3 ) )                    
00439 // Major HTML Color codes
00440 #define RGB_RED         RGB_MAKE(0xFF, 0x00, 0x00)  //0x00F8
00441 #define RGB_GREEN       RGB_MAKE(0x00, 0xFF, 0x00)  //0xE007 (official name is PASTELGREEN)
00442 #define RGB_PASTELGREEN RGB_MAKE(0x00, 0xFF, 0x00)
00443 #define RGB_LIGHTBLUE   RGB_MAKE(0x00, 0x00, 0xFF)  //0x1F00 (was 0xFF07 in CircleOS 3)
00444 #define RGB_BLUE        RGB_MAKE(0x00, 0x00, 0xFF)  //0x1F00 (official name is LIGHTBLUE)
00445 #define RGB_BLACK       RGB_MAKE(0x00, 0x00, 0x00)  //0x0000
00446 #define RGB_WHITE       RGB_MAKE(0xFF, 0xFF, 0xFF)  //0xFFFF
00447 #define RGB_YELLOW      RGB_MAKE(0xFF, 0xFF, 0x00)  //0xE0FF
00448 #define RGB_MAGENTA     RGB_MAKE(0xFF, 0x00, 0xFF)  //0x1FF8
00449 #define RGB_TURQUOISE   RGB_MAKE(0x00, 0xFF, 0xFF)
00450 #define RGB_ORANGE      RGB_MAKE(0xFF, 0x80, 0x40)  //0x08FC (was 0xE0F9 in CircleOS 3)
00451 #define RGB_PINK        RGB_MAKE(0xFF, 0x3F, 0xFF)  //0xFFF9
00452 #define RGB_LIGHTGREY   RGB_MAKE(0xC0, 0xC0, 0xC0)
00453 #define RGB_DARKGREY    RGB_MAKE(0x80, 0x80, 0x80)
00454 #define RGB_DARKBLUE    RGB_MAKE(0x00, 0x00, 0xA0)
00455 #define RGB_LIGHTPURPLE RGB_MAKE(0xFF, 0x00, 0x80)
00456 #define RGB_DARKPURPLE  RGB_MAKE(0x80, 0x00, 0x80)
00457 #define RGB_BROWN       RGB_MAKE(0x80, 0x40, 0x00)
00458 #define RGB_BURGUNDY    RGB_MAKE(0x80, 0x00, 0x00)
00459 #define RGB_FORESTGREEN RGB_MAKE(0x80, 0x80, 0x00)
00460 #define RGB_GRASSGREEN  RGB_MAKE(0x40, 0x80, 0x80)
00461 
00462 /* PWM rates.*/
00463 #define BACKLIGHTMIN                0x1000   
00464 #define DEFAULT_CCR_BACKLIGHTSTART  0x8000   
00466 /* Characters Infos*/
00467 #define CHAR_WIDTH            7           
00468 #define CHAR_HEIGHT           14          
00470 /* Font Structures */
00471 #define MAX_FONT_NB 20
00472 
00473 typedef enum
00474 {
00475     FONT_PRIMER     = 0,
00476     FONT_PRIMERX2   = 1,
00477     FONT_MEDIUM     = 2,
00478     FONT_MEDIUMX2   = 3,
00479     FONT_NUMBERS    = 4
00480 } ENUM_FontID;
00481 
00482 typedef struct 
00483 {
00484     ENUM_FontID         ID;
00485     u8                  width;
00486     u8                  height;
00487     u8                  FontCoeff;
00488     u8                  ASCII_start;
00489     u8                  ASCII_end;
00490     u8                  *font;
00491     u8                  title[16];
00492 } tFontDef;
00493 
00494 typedef struct
00495 {
00496     u8          nb;
00497     tFontDef fonts[MAX_FONT_NB];
00498 } tFontTable;
00499 
00500 
00502 
00503 /* LCD functions definition*/
00504 #define LCD_SETRECTFORCMD_ID                   (LCD_ID + 0)          /* Define the rectangle (for the next command to be applied)*/
00505 #define LCD_GETPIXEL_ID                        (LCD_ID + 1)          /* Read the value of one pixel*/
00506 #define LCD_DRAWPIXEL_ID                       (LCD_ID + 2)          /* Draw a Graphic image on slave LCD.*/
00507 #define LCD_SENDLCDCMD_ID                      (LCD_ID + 3)          /* Send one byte command to LCD.*/
00508 #define LCD_SENDLCDDATA_ID                     (LCD_ID + 4)          /* Display one byte data to LCD.*/
00509 #define LCD_READLCDDATA_ID                     (LCD_ID + 5)          /* Read LCD byte data displayed on LCD.*/
00510 #define LCD_FILLRECT_ID                        (LCD_ID + 6)          /* Fill a rectangle with one color*/
00511 #define LCD_DRAWRECT_ID                        (LCD_ID + 7)          /* Draw a rectangle with one color*/
00512 #define LCD_DISPLAYCHAR_ID                     (LCD_ID + 8)          /* Display one character*/
00513 #define LCD_RECTREAD_ID                        (LCD_ID + 9)          /* Save a rectangle of the monitor RAM*/
00514 #define LCD_SETBACKLIGHT_ID                    (LCD_ID + 10)         /* Modify the PWM rate*/
00515 #define LCD_GETBACKLIGHT_ID                    (LCD_ID + 11)         /* Return the PWM rate*/
00516 #define LCD_SETROTATESCREEN_ID                 (LCD_ID + 12)         /* Enable/Disable screen rotation*/
00517 #define LCD_GETROTATESCREEN_ID                 (LCD_ID + 13)         /* Return screen rotation mode*/
00518 #define LCD_SETSCREENORIENTATION_ID            (LCD_ID + 14)         /* Set screen orientation*/
00519 #define LCD_GETSCREENORIENTATION_ID            (LCD_ID + 15)         /* Return screen orientation*/
00520 #define LCD_SETBACKLIGHT_OFF_ID                (LCD_ID + 16)         /* Switch the LCD back light off.*/
00521 #define LCD_SETBACKLIGHT_ON_ID                 (LCD_ID + 17)         /* Switch the LCD back light on.*/
00522 #define LCD_SETFONT_ID                         (LCD_ID + 18)         /* Switch to a new font.*/
00523 #define LCD_SETDEFAULT_ID                      (LCD_ID + 19)         /* Switch to the default system font.*/
00524 #define LCD_SETOFFSET_ID                       (LCD_ID + 20)         /* Activate the offset.*/
00525 #define LCD_GETSCREENWIDTH_ID                  (LCD_ID + 21)         /* Return the width of the screen in pixels.*/
00526 #define LCD_GETSCREENHEIGHT_ID                 (LCD_ID + 22)         /* Return the height of the screen in pixels.*/
00527 #define LCD_SETFONTDEF_ID                      (LCD_ID + 23)         /* Change the current font definitition to fit with a new current font.*/
00528 #define LCD_GETFONTDEF_ID                      (LCD_ID + 24)         /* Get the current font definitition.*/
00529 #define LCD_CHANGEFONT_ID                      (LCD_ID + 25)         /* Change the current font and its definitition.*/
00530 #define LCD_SETTRANSPARENCY_ID                 (LCD_ID + 26)         /* Return the transparency value for the characters.*/
00531 #define LCD_GETTRANSPARENCY_ID                 (LCD_ID + 27)         /* Set the transparency value for the characters.*/
00532 #define LCD_FULLSCREEN_ID                      (LCD_ID + 28)         /* Enable or disable the possibility to use all the screen.*/
00533 
00534 /* Prototypes*/
00535 #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)*/
00536 #define LCD_GetPixel(a,b)                      (u16)(((tCircleFunc2)(Circle_API [LCD_GETPIXEL_ID])) ((u32)(a),(u32)(b)))                                        /*u16   LCD_GetPixel (u8 x, u8 y)*/
00537 #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) ;*/
00538 #define LCD_SendLCDCmd(a)                            ((tCircleFunc1)(Circle_API [LCD_SENDLCDCMD_ID])) ((u32)(a))                                                /*void  LCD_SendLCDCmd(u8 Cmd);*/
00539 #define LCD_SendLCDData(a)                           ((tCircleFunc1)(Circle_API [LCD_SENDLCDDATA_ID])) ((u32)(a))                                               /*void  LCD_SendLCDData(u8 Data);*/
00540 #define LCD_ReadLCDData()                      (u32)(((tCircleFunc0)(Circle_API [LCD_READLCDDATA_ID])) ())                                                      /*u32   LCD_ReadLCDData(void);*/
00541 #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 );*/
00542 #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 );*/
00543 #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),(mag_t)(f))/*void  LCD_DisplayChar(u8 x, u8 y, u8 Ascii, u16 TextColor, u16 BGndColor, mag_t CharMagniCoeff);*/
00544 #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 );*/
00545 #define LCD_SetBackLight(a)                          ((tCircleFunc1)(Circle_API [LCD_SETBACKLIGHT_ID])) ((u32)(a))                                              /*void  LCD_SetBackLight(u32 newBaclightStart);*/
00546 #define LCD_GetBackLight()                     (u32)(((tCircleFunc0)(Circle_API [LCD_GETBACKLIGHT_ID])) ())                                                     /*u32   LCD_GetBackLight(void);*/
00547 #define LCD_SetRotateScreen(a)                       ((tCircleFunc1)(Circle_API [LCD_SETROTATESCREEN_ID])) ((u32)(a))                                           /*void  LCD_SetRotateScreen ( u8 RotateScreen)*/
00548 #define LCD_GetRotateScreen()                  (u32)(((tCircleFunc0)(Circle_API [LCD_GETROTATESCREEN_ID])) ())                                                  /*u8    LCD_GetRotateScreen (void)*/
00549 #define LCD_SetScreenOrientation(a)                  ((tCircleFunc1)(Circle_API [LCD_SETSCREENORIENTATION_ID])) ((u32)(a))                                      /*void LCD_SetScreenOrientation (Rotate_H12_V_Match_TypeDef ScreenOrientation)*/
00550 #define LCD_GetScreenOrientation()             (u32)(((tCircleFunc0)(Circle_API [LCD_GETSCREENORIENTATION_ID])) ())                                             /*Rotate_H12_V_Match_TypeDef LCD_GetScreenOrientation (void)*/
00551 #define LCD_SetBackLightOff()                        ((tCircleFunc0)(Circle_API [LCD_SETBACKLIGHT_OFF_ID])) ()
00552 #define LCD_SetBackLightOn()                         ((tCircleFunc0)(Circle_API [LCD_SETBACKLIGHT_ON_ID])) ()
00553 #define LCD_SetFont(a)                               ((tCircleFunc1)(Circle_API [LCD_SETFONT_ID])) ((u32)(a))                                                   /*void LCD_SetFont(u8* NewFont);*/
00554 #define LCD_SetDefaultFont()                         ((tCircleFunc0)(Circle_API [LCD_SETDEFAULT_ID])) ()                                                        /*void LCD_SetDefaultFont(void);*/
00555 #define LCD_SetOffset(a)                             ((tCircleFunc1)(Circle_API [LCD_SETOFFSET_ID])) ((u32)(a))                                                 /*void LCD_SetOffset( ENUM_Offset Offset );*/
00556 #define LCD_GetScreenWidth()                   (s16)(((tCircleFunc0)(Circle_API [LCD_GETSCREENWIDTH_ID])) ())                                                   /*coord_t LCD_GetScreenWidth( void )*/
00557 #define LCD_GetScreenHeight()                  (s16)(((tCircleFunc0)(Circle_API [LCD_GETSCREENHEIGHT_ID])) ())                                                  /*coord_t LCD_GetScreenHeight( void )*/
00558 #define LCD_SetFontDef(a)                            ((tCircleFunc1)(Circle_API [LCD_SETFONTDEF_ID])) ((u32)(a))                                                /*void LCD_SetFontDef(u32* FontDef);*/
00559 #define LCD_GetFontDef(a)                 (tFontDef*)((tCircleFunc0)(Circle_API [LCD_GETFONTDEF_ID])) ()                                                        /*tFontDef* LCD_GetFontDef( void );*/
00560 #define LCD_ChangeFont(a)                            ((tCircleFunc1)(Circle_API [LCD_CHANGEFONT_ID])) ((u8)(a))                                                 /*void LCD_ChangeFont(u8 ENUM_FontID ID);*/
00561 #define LCD_SetTransparency(a)                       ((tCircleFunc1)(Circle_API [LCD_SETTRANSPARENCY_ID])) ((bool)(a))                                          /*void LCD_SetTransparency( u8 NewTransparency )*/
00562 #define LCD_GetTransparency()                   (u8)(((tCircleFunc0)(Circle_API [LCD_GETTRANSPARENCY_ID])) ())                                                  /*u8 LCD_GetTransparency( void )*/
00563 #define LCD_FullScreen(a)                            ((tCircleFunc1)(Circle_API [LCD_FULLSCREEN_ID])) ((u8)(a))                                                 /*void LCD_FullScreen( u8 FullScreenONOFF )*/
00564 
00565 
00566 /*----------------------------------   DRAW   ----------------------------------*/
00567 
00568 /* Exported defines ----------------------------------------------------------*/
00569 enum    Align { LEFT = 0, CENTER = 1, RIGHT = 2 };
00570 #define INVERTED_TEXT   1           
00571 #define NORMAL_TEXT     0           
00572 #define ALL_SCREEN     -1           /*< To center the text in the screen for draw functions. */
00573 
00575 
00576 /* DRAW functions definition*/
00577 #define DRAW_SETDEFAULTCOLOR_ID                   (DRAW_ID + 0)         /* Reset colors (bgnd + text)*/
00578 #define DRAW_CLEAR_ID                             (DRAW_ID + 1)         /* Clear the LCD display*/
00579 #define DRAW_SETIMAGE_ID                          (DRAW_ID + 2)         /* Draw a colored image*/
00580 #define DRAW_SETIMAGEBW_ID                        (DRAW_ID + 3)         /* Draw a black and white image*/
00581 #define DRAW_SETLOGOBW_ID                         (DRAW_ID + 4)         /* Draw logo*/
00582 #define DRAW_DISPLAYVBAT_ID                       (DRAW_ID + 5)         /* Display the voltage of battery in ascii*/
00583 #define DRAW_DISPLAYTIME_ID                       (DRAW_ID + 6)         /* Display time in ascii*/
00584 #define DRAW_DISPLAYSTRING_ID                     (DRAW_ID + 7)         /* Display a x char max string of characters*/
00585 #define DRAW_DISPLAYSTRINGINVERTED_ID             (DRAW_ID + 8)         /* Display a x char max string of characters with inverted colors*/
00586 #define DRAW_GETCHARMAGNICOEFF_ID                 (DRAW_ID + 9)         /* Return the magnifying value for the characters*/
00587 #define DRAW_SETCHARMAGNICOEFF_ID                 (DRAW_ID + 10)        /* Set the magnifying value for the characters*/
00588 #define DRAW_GETTEXTCOLOR_ID                      (DRAW_ID + 11)        /* Return the current text color*/
00589 #define DRAW_SETTEXTCOLOR_ID                      (DRAW_ID + 12)        /* Set the current text color*/
00590 #define DRAW_GETBGNDCOLOR_ID                      (DRAW_ID + 13)        /* Return the current background color*/
00591 #define DRAW_SETBGNDCOLOR_ID                      (DRAW_ID + 14)        /* Set the current background color*/
00592 #define DRAW_LINE_ID                              (DRAW_ID + 15)        /* Draw a Line between (using Bresenham algorithm) */
00593 #define DRAW_SETIMAGESEL_ID                       (DRAW_ID + 16)        /* Draw a colored image with selected background color*/
00594 #define DRAW_PUTC_ID                              (DRAW_ID + 17)        /* Set the current position of the cursor*/
00595 #define DRAW_PUTS_ID                              (DRAW_ID + 18)        /* Draw a colored image with selected background color*/
00596 #define DRAW_SETCURSOR_POS_ID                     (DRAW_ID + 19)        /* Set the current position of the cursor*/
00597 #define DRAW_GETCURSOR_POS_ID                     (DRAW_ID + 20)        /* Get the current position of the cursor*/
00598 #define DRAW_SETCURSORMARGIN_ID                   (DRAW_ID + 21)        /* Set the current margins of the cursor*/
00599 #define DRAW_GETCURSORMARGIN_ID                   (DRAW_ID + 22)        /* Get the current margins of the cursor*/
00600 #define DRAW_DISPLAYSTRINGMODE_ID                 (DRAW_ID + 23)        /* Display a x char max string of characters with attributes*/
00601 #define DRAW_DRAW_CIRCLE_ID                       (DRAW_ID + 24)        /* Display a circle with attributes*/
00602 #define DRAW_DRAW_ELLIPSE_ID                      (DRAW_ID + 25)        /* Display a ellipse with attributes*/
00603 #define DRAW_DRAW_POLYGONE_ID                     (DRAW_ID + 26)        /* Display a polygone*/
00604 
00605 /*Prototypes*/
00606 #define DRAW_SetDefaultColor()                      ((tCircleFunc0)(Circle_API [DRAW_SETDEFAULTCOLOR_ID])) ()                                                 /*void  DRAW_SetDefaultColor (void);*/
00607 #define DRAW_Clear()                                ((tCircleFunc0)(Circle_API [DRAW_CLEAR_ID])) ()                                                           /*void  DRAW_Clear(void);*/
00608 #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);*/
00609 #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);*/
00610 #define DRAW_SetLogoBW()                            ((tCircleFunc0)(Circle_API [DRAW_SETLOGOBW_ID])) ()                                                       /*void  DRAW_SetLogoBW(void);*/
00611 #define DRAW_DisplayVbat(a,b)                       ((tCircleFunc2)(Circle_API [DRAW_DISPLAYVBAT_ID])) ((u32)(a),(u32)(b))                                    /*void  DRAW_DisplayVbat(u8 x, u8 y);*/
00612 #define DRAW_DisplayTime(a,b)                       ((tCircleFunc2)(Circle_API [DRAW_DISPLAYTIME_ID])) ((u32)(a),(u32)(b))                                    /*void  DRAW_DisplayTime(u8 x, u8 y);*/
00613 #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 );*/
00614 #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 );*/
00615 #define DRAW_GetCharMagniCoeff()              (u16)(((tCircleFunc0)(Circle_API [DRAW_GETCHARMAGNICOEFF_ID])) ())                                              /*u16   DRAW_GetCharMagniCoeff(void);*/
00616 #define DRAW_SetCharMagniCoeff(a)                   ((tCircleFunc1)(Circle_API [DRAW_SETCHARMAGNICOEFF_ID])) ((u32)(a))                                       /*void  DRAW_SetCharMagniCoeff(u16 Coeff);*/
00617 #define DRAW_GetTextColor()                   (u16)(((tCircleFunc0)(Circle_API [DRAW_GETTEXTCOLOR_ID])) ())                                                   /*u16   DRAW_GetTextColor(void);*/
00618 #define DRAW_SetTextColor(a)                        ((tCircleFunc1)(Circle_API [DRAW_SETTEXTCOLOR_ID])) ((u32)(a))                                            /*void  DRAW_SetTextColor(u16 Color);*/
00619 #define DRAW_GetBGndColor()                   (u16)(((tCircleFunc0)(Circle_API [DRAW_GETBGNDCOLOR_ID])) ())                                                   /*u16   DRAW_GetBGndColor(void);*/
00620 #define DRAW_SetBGndColor(a)                        ((tCircleFunc1)(Circle_API [DRAW_SETBGNDCOLOR_ID])) ((u32)(a))                                            /*void  DRAW_SetBGndColor(u16 Color);*/
00621 #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 );*/
00622 #define DRAW_SetImageSel(a,b,c,d,e,f,g)             ((tCircleFunc7)(Circle_API [DRAW_SETIMAGESEL_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e),(u32)(f),(u32)(g))  /*void DRAW_SetImageSel(const u16* imageptr, u8 x, u8 y, u8 width, u8 height, u16 oldBgndColor, u16 newBgndColor);*/
00623 #define DRAW_Putc(a)                                ((tCircleFunc1)(Circle_API [DRAW_PUTC_ID])) ((u32)(a))                                                    /*void DRAW_Putc( u8 Ascii );*/
00624 #define DRAW_Puts(a)                                ((tCircleFunc1)(Circle_API [DRAW_PUTS_ID])) ((u32)(a))                                                    /*void DRAW_Puts( const u8* ptr );*/
00625 #define DRAW_SetCursorPos(a,b)                      ((tCircleFunc2)(Circle_API [DRAW_SETCURSOR_POS_ID])) ((u32)(a),(u32)(b))                                  /*void DRAW_SetCursorPos( s32 x, s32 y );*/
00626 #define DRAW_GetCursorPos()                   (u16)(((tCircleFunc0)(Circle_API [DRAW_GETCURSOR_POS_ID])) ())                                                  /*s32 DRAW_GetCursorPos();*/
00627 #define DRAW_SetCursorMargin(a,b,c,d)               ((tCircleFunc4)(Circle_API [DRAW_SETCURSORMARGIN_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))              /*void DRAW_SetCursorMargin( s32 lx, s32 rx, s32 hy, s32 ly );*/
00628 #define DRAW_GetCursorMargin(a,b,c,d)               ((tCircleFunc4)(Circle_API [DRAW_GETCURSORMARGIN_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))              /*void DRAW_GetCursorMargin( s32* lx, s32* rx, s32* hy, s32* ly );*/
00629 #define DRAW_DisplayStringWithMode(a,b,c,d,e,f)     ((tCircleFunc6)(Circle_API [DRAW_DISPLAYSTRINGMODE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e),(u32)(f))  /*void DRAW_DisplayStringWithMode( coord_t x, coord_t y, const u8* ptr, len_t len, bool mode, enumset_t align );*/
00630 #define DRAW_Circle(a,b,c,d,e,f,g)                  ((tCircleFunc7)(Circle_API [DRAW_DRAW_CIRCLE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e),(u32)(f),(u32)(g))   /*DRAW_Circle(coord_t CENTER_x, coord_t CENTER_y, coord_t RADIUS_r, color_t Color, color_t Fill_Color, bool Fill, bool Circle);*/
00631 #define DRAW_Ellipse(a,b,c,d,e,f,g,h)               ((tCircleFunc8)(Circle_API [DRAW_DRAW_ELLIPSE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d),(u32)(e),(u32)(f),(u32)(g),(u32)(h))  /*DRAW_Ellipse( coord_t CENTER_x, coord_t CENTER_y, coord_t RADIUS_a, coord_t RADIUS_b, color_t Color, color_t Fill_Color, bool Fill, bool Ellipse);*/
00632 #define DRAW_Polygon(a,b,c)                         ((tCircleFunc3)(Circle_API [DRAW_DRAW_POLYGONE_ID])) ((u32)(a),(u32)(b),(u32)(c))                         /*DRAW_Polygon(coord_t *points, u16 NUM_Points, color_t Line_Color)*/
00633 
00635 
00636 
00637 /*--------------------------------   BUZZER  -----------------------------------*/
00638 
00639 /* Exported type def ---------------------------------------------------------*/
00640 
00647 enum BUZZER_mode
00648 {
00649     BUZZER_UNDEF      = -1,         
00650     BUZZER_OFF        =  0,         
00651     BUZZER_ON         =  1,         
00652     BUZZER_SHORTBEEP  =  2,         
00653     BUZZER_LONGBEEP   =  3,         
00654     BUZZER_PLAYMUSIC  =  4          
00655 };
00656 
00658 
00659 /* Exported defines ----------------------------------------------------------*/
00660 #define BUZZER_BEEP  BUZZER_SHORTBEEP
00661 
00662 /* BUZZER functions definition*/
00663 #define BUZZER_SETMODE_ID                       (BUZZER_ID + 0)   /* Set new buzzer mode*/
00664 #define BUZZER_GETMODE_ID                       (BUZZER_ID + 1)   /* Get the current buzzer mode.*/
00665 #define BUZZER_PLAY_MUSIC_ID                    (BUZZER_ID + 2)   /* Plays the provided melody that follows the RTTTL Format.*/
00666 
00667 /* Prototypes*/
00668 #define BUZZER_SetMode(a)                            ((tCircleFunc1)(Circle_API [BUZZER_SETMODE_ID])) ((u32)(a))               /*void  BUZZER_SetMode( enum BUZZER_mode mode);*/
00669 #define BUZZER_GetMode()         (enum  BUZZER_mode)(((tCircleFunc0)(Circle_API [BUZZER_GETMODE_ID])) ())                      /*enum  BUZZER_mode BUZZER_GetMode( void );*/
00670 #define BUZZER_PlayMusic(a)                          ((tCircleFunc1)(Circle_API [BUZZER_PLAY_MUSIC_ID])) ((u32)(a))            /*void BUZZER_PlayMusic (const u8 *melody );*/
00671 
00672 
00674 
00675 
00676 /*---------------------------------   MENU   -----------------------------------*/
00677 
00678 /* Exported defines ----------------------------------------------------------*/
00679 #define REMOVE_MENU     0x01  
00680 #define APP_MENU        0x02  
00681 #define MENU_MAXITEM    8     
00683 /* Exported type def ---------------------------------------------------------*/
00684 
00689 typedef struct
00690 {
00691     const u8* Text;                              
00692     enum MENU_code( *Fct_Init )( void );         
00693     enum MENU_code( *Fct_Manage )( void );       
00694     s32 fRemoveMenu;                             
00695 } tMenuItem;
00696 
00701 typedef struct
00702 {
00703     unsigned fdispTitle: 1;                
00704     const u8* Title;                       
00705     s32 NbItems;                           
00706     s32 LgMax;                             
00707     s32 XPos;                              
00708     s32 YPos;                              
00709     s32 XSize;                             
00710     s32 YSize;                             
00711     u32 SelectedItem;                      
00712     tMenuItem Items[MENU_MAXITEM];         
00713 } tMenu;
00714 
00721 enum MENU_code
00722 {
00723     MENU_LEAVE              = 0,                    
00724     MENU_CONTINUE           = 1,                    
00725     MENU_REFRESH            = 2,                    
00726     MENU_CHANGE             = 3,                    
00727     MENU_CONTINUE_COMMAND   = 4,                    
00728     MENU_LEAVE_AS_IT        = 5,                    
00729     MENU_RESTORE_COMMAND    = 6                     
00730 };
00731 
00733 
00734 /* Exported defines ----------------------------------------------------------*/
00735 
00736 /* MENU functions definition*/
00737 #define MENU_SET_ID                             (MENU_ID + 0)        /* Display a menu*/
00738 #define MENU_REMOVE_ID                          (MENU_ID + 1)        /* Remove the current menu, DRAW_Clear and set pointer mode to "POINTER_ON".*/
00739 #define MENU_QUESTION_ID                        (MENU_ID + 2)        /* Dedicated menu for ask question and yes/no responses*/
00740 #define MENU_PRINT_ID                           (MENU_ID + 3)        /* Display a popup menu with a string.*/
00741 #define MENU_CLEAR_CURRENT_COMMAND_ID           (MENU_ID + 4)        /* Set CurrentCommand to 0*/
00742 #define MENU_SET_LEVELTITLE_ID                  (MENU_ID + 5)        /* Set the title of level menu managed by MENU_SetLevel_Mgr.*/
00743 #define MENU_SET_TEXTCOLOR_ID                   (MENU_ID + 6)        /* Set the color used for text menu.*/
00744 #define MENU_GET_TEXTCOLOR_ID                   (MENU_ID + 7)        /* Return the color used for text menu.*/
00745 #define MENU_SET_BGNDCOLOR_ID                   (MENU_ID + 8)        /* Set the background color used for menu.*/
00746 #define MENU_GET_BGNDCOLOR_ID                   (MENU_ID + 9)        /* Return the background color used for menu.*/
00747 #define MENU_QUIT_ID                            (MENU_ID + 10)       /* Leave the current menu (stand for "cancel" and do a DRAW_Clear)*/
00748 #define MENU_SET_LEVELINI_ID                    (MENU_ID + 11)       /* Initialise a generic function to set a avalue in the range of [0,4]*/
00749 #define MENU_CLEAR_CURRENT_MENU_ID              (MENU_ID + 12)       /* Set CurrentMenu to 0*/
00750 #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)*/
00751 #define MENU_SET_APP_DIVIDER_ID                 (MENU_ID + 14)       /* Set divider for applications calls*/
00752 #define MENU_RESTORE_APP_DIVIDER_ID             (MENU_ID + 15)       /* Restore the factory divider for applications calls*/
00753 
00754 /* Prototypes*/
00755 #define MENU_Set(a)                                   ((tCircleFunc1)(Circle_API [MENU_SET_ID])) ((u32)(a))                     /* void MENU_Set( tMenu* mptr ); */
00756 #define MENU_Remove()                                 ((tCircleFunc0)(Circle_API [MENU_REMOVE_ID])) ()                          /* void MENU_Remove( void ); */
00757 #define MENU_Question(a,b)                            ((tCircleFunc2)(Circle_API [MENU_QUESTION_ID])) ((u32)(a),(bool*)(b))     /* void MENU_Question( u8* str, bool* answer ); */
00758 #define MENU_Print(a)                                 ((tCircleFunc1)(Circle_API [MENU_PRINT_ID])) ((u32)(a))                   /* void MENU_Print( u8* str ) */
00759 #define MENU_ClearCurrentCommand()                    ((tCircleFunc0)(Circle_API [MENU_CLEAR_CURRENT_COMMAND_ID])) ()           /* void MENU_ClearCurrentCommand( void ) */
00760 #define MENU_SetLevelTitle(a)                         ((tCircleFunc1)(Circle_API [MENU_SET_LEVELTITLE_ID])) ((u32)(a))          /* void MENU_SetLevelTitle( u8* title ) */
00761 #define MENU_SetTextColor(a)                          ((tCircleFunc1)(Circle_API [MENU_SET_TEXTCOLOR_ID])) ((u32)(a))           /* void MENU_SetTextColor( s32 TextColor ) */
00762 #define MENU_GetTextColor()                 (color_t)(((tCircleFunc0)(Circle_API [MENU_GET_TEXTCOLOR_ID])) ())                  /* color_t MENU_GetTextColor( void ) */
00763 #define MENU_SetBGndColor(a)                          ((tCircleFunc1)(Circle_API [MENU_SET_BGNDCOLOR_ID])) ((u32)(a))           /* void MENU_SetBGndColor( s32 BGndColor ) */
00764 #define MENU_GetBGndColor()                 (color_t)(((tCircleFunc0)(Circle_API [MENU_GET_BGNDCOLOR_ID])) ())                  /* color_t MENU_GetBGndColor( void ) */
00765 #define MENU_Quit()                  (enum MENU_code)(((tCircleFunc0)(Circle_API [MENU_QUIT_ID])) ())                           /* enum MENU_code MENU_Quit( void ) */
00766 #define MENU_SetLevel_Ini()          (enum MENU_code)(((tCircleFunc0)(Circle_API [MENU_SET_LEVELINI_ID])) ())                   /* enum MENU_code MENU_SetLevel_Ini( void ) */
00767 #define MENU_ClearCurrentMenu()                       ((tCircleFunc0)(Circle_API [MENU_CLEAR_CURRENT_MENU_ID])) ()              /* void MENU_ClearCurrentMenu( void ) */
00768 #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 [] ) */
00769 #define MENU_SetAppliDivider(a)                       ((tCircleFunc1)(Circle_API [MENU_SET_APP_DIVIDER_ID])) ((u32)(a))         /* void MENU_SetAppliDivider( s32 divider ) */
00770 #define MENU_RestoreAppliDivider()                    ((tCircleFunc0)(Circle_API [MENU_RESTORE_APP_DIVIDER_ID])) ()             /* void MENU_RestoreAppliDivider( void ) */
00771 
00773 
00774 /*----------------------------------   LED -------------------------------------*/
00775 
00776 /* Exported types ------------------------------------------------------------*/
00777 
00784 enum LED_mode
00785 {
00786     LED_UNDEF       = -1,                     
00787     LED_OFF         = 0,                      
00788     LED_ON          = 1,                      
00789     LED_BLINKING_LF = 2,                      
00790     LED_BLINKING_HF = 3                       
00791 };
00792 
00799 enum LED_id
00800 {
00801     LED_GREEN = 0,                                        
00802     LED_RED = 1                                           
00803 };
00804 
00806 
00807 /* Exported defines ----------------------------------------------------------*/
00808 
00809 /* LED functions definition*/
00810 #define LED_SET_ID            (LED_ID + 0)      /* Set a specified LED in a specified mode.*/
00811 
00812 /* Prototypes*/
00813 #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 );*/
00814 
00816 
00817 /*--------------------------------   RTC  --------------------------------------*/
00818 
00819 /* Exported defines ----------------------------------------------------------*/
00820 
00821 /* Backup registers*/
00822 #define BKP_SYS1      1    
00823 #define BKP_SYS2      2    
00824 #define BKP_SYS3      3    
00825 #define BKP_SYS4      4    
00826 #define BKP_SYS5      5    
00827 #define BKP_SYS6      6    
00828 #define BKP_SYS7     11    
00829 #define BKP_SYS8     12    
00830 #define BKP_SYS9     13    
00831 #define BKP_SYS10    14    
00832 #define BKP_SYS11    15    
00833 #define BKP_SYS12    16    
00834 #define BKP_SYS13    17    
00835 #define BKP_SYS14    18    
00837 #define BKP_USER1     7    
00838 #define BKP_USER2     8    
00839 #define BKP_USER3     9    
00840 #define BKP_USER4    10    
00842 
00843 
00844 /*RTC functions definition*/
00845 #define RTC_SET_TIME_ID       (RTC_ID + 0)      /* Set current time.*/
00846 #define RTC_GET_TIME_ID       (RTC_ID + 1)      /* Return current time.*/
00847 #define RTC_DISPLAY_TIME_ID   (RTC_ID + 2)      /* Display current time on the 6th line at column 0.*/
00848 
00849 /* Prototypes*/
00850 #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);*/
00851 #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);*/
00852 #define RTC_DisplayTime()     ((tCircleFunc0)(Circle_API [RTC_DISPLAY_TIME_ID])) ()                           /*void  RTC_DisplayTime ( void );*/
00853 
00855 
00856 /*------------------------------   TOOLBAR -----------------------------------*/
00857 
00858 /* Exported defines ----------------------------------------------------------*/
00859 #define TOOLBAR_MAXITEMS 4
00860 
00861 /* Exported types ------------------------------------------------------------*/
00866 typedef struct
00867 {
00868     const u16*  icon;
00869     enum MENU_code( *Fct_Manage )( void );
00870 } tToolbarItem;
00871 
00876 typedef struct
00877 {
00878     index_t NbItems;
00879     u32 FirstDispItem;            /* index of the first displayed item (if > 4)*/
00880     tToolbarItem Items[TOOLBAR_MAXITEMS];
00881 } tToolbar;
00882 
00883 
00885 
00886 /* TOOLBAR functions definition*/
00887 #define TOOLBAR_SET_ID                   (TOOLBAR_ID + 0)     /* Set new toolbar*/
00888 #define TOOLBAR_SET_DEFAULT_TOOLBAR_ID   (TOOLBAR_ID + 1)     /* Restore default factory toolbar*/
00889 #define TOOLBAR_CHANGE_BUTTON_ID         (TOOLBAR_ID + 2)     /* Change icone and function of a button*/
00890 
00891 /* Prototypes*/
00892 #define TOOLBAR_Set(a)                   (((tCircleFunc1)(Circle_API [TOOLBAR_SET_ID])) ((u32)(a)))                                /* void TOOLBAR_Set(tToolbar* NewToolbar);*/
00893 #define TOOLBAR_SetDefaultToolbar()       ((tCircleFunc0)(Circle_API [TOOLBAR_SET_DEFAULT_TOOLBAR_ID])) ()                         /* void TOOLBAR_SetDefaultToolbar(void);*/
00894 #define TOOLBAR_ChangeButton(a,b,c)      (((tCircleFunc3)(Circle_API [TOOLBAR_CHANGE_BUTTON_ID])) ((u32)(a),(u32)(b),(u32)(c) ))   /* void TOOLBAR_ChangeButton(s32 button, const u8  *newicon, enum MENU_code (*newfct)( void ));*/
00895 
00896 
00897 /*------------------------------ TOUCHSCREEN ----------------------------------*/
00898 
00899 /* Exported defines ----------------------------------------------------------*/
00900 #define LIST_MAXITEM 64
00901 
00902 /* Exported types ------------------------------------------------------------*/
00903 typedef enum {TS_NORMAL, TS_DRAWING, TS_CALIBRATION} TOUCHSCR_Mode_enum;
00904 
00909 typedef struct
00910 {
00911     const u8* Text;
00912 } tListItem;
00913 
00918 typedef struct
00919 {
00920     unsigned     fdispTitle : 1;
00921     const u8*   Title;
00922     s32          NbItems;
00923     s32          LgMax;
00924     s32          XPos, YPos;
00925     s32          XSize, YSize;
00926     s32          NbDisp;             /* Number of lines to be displayed*/
00927     u32 SelectedItem;                /* Current selected item*/
00928     u32 FirstDisplayItem;            /* Index of the first displayed item*/
00929     tListItem    Items[LIST_MAXITEM];
00930 } tList;
00931 
00933 
00934 /* TOUCHSCREEN functions definition*/
00935 #define TOUCHSCR_GET_POS_ID               (TOUCHSCR_ID + 0)      /* Get the position of the hit point according the LCD position*/
00936 #define TOUCHSCR_GET_ABS_POS_ID           (TOUCHSCR_ID + 1)      /* Get the absolute position of the hit point*/
00937 #define TOUCHSCR_IS_PRESSED_ID            (TOUCHSCR_ID + 2)      /* See if toucscreen touched or not*/
00938 #define TOUCHSCR_GET_MODE_ID              (TOUCHSCR_ID + 3)      /* Get the running mode of the touchscreen (normal, calibration...)*/
00939 #define TOUCHSCR_SET_SENS_ID              (TOUCHSCR_ID + 4)      /* Set the sensitivity if the touch (0 to 4095)*/
00940 #define LIST_MANAGER_ID                   (TOUCHSCR_ID + 5)      /* Manage the current list*/
00941 #define LIST_SET_ID                       (TOUCHSCR_ID + 6)      /* Set the new list to manage with the touchscreen*/
00942 #define TOUCHSCR_GET_POSX_ID              (TOUCHSCR_ID + 7)      /* Get the horizontal position of the hit point according the LCD position*/
00943 #define TOUCHSCR_GET_POSY_ID              (TOUCHSCR_ID + 8)      /* Get the vertical position of the hit point according the LCD position*/
00944 
00945 /* Prototypes*/
00946 #define TOUCHSCR_GetPos()           (u16)                        (((tCircleFunc0)(Circle_API [TOUCHSCR_GET_POS_ID])) () )           /* u16 TOUCHSCR_GetPos( void );*/
00947 #define TOUCHSCR_GetAbsPos()        (u16)                        (((tCircleFunc0)(Circle_API [TOUCHSCR_GET_ABS_POS_ID])) () )       /* u16 TOUCHSCR_GetAbsPos( void );*/
00948 #define TOUCHSCR_IsPressed()        (bool)                       (((tCircleFunc0)(Circle_API [TOUCHSCR_IS_PRESSED_ID])) () )        /* bool TOUCHSCR_IsPressed( void )*/
00949 #define TOUCHSCR_GetMode()          (TOUCHSCR_Mode_enum)         (((tCircleFunc0)(Circle_API [TOUCHSCR_GET_MODE_ID])) ()  )         /* TOUCHSCR_Mode_enum TOUCHSCR_GetMode( void );*/
00950 #define TOUCHSCR_SetSensibility(a)                               (((tCircleFunc1)(Circle_API [TOUCHSCR_SET_SENS_ID])) ((u32)(a)) )  /* void TOUCHSCR_SetSensibility( u16 sens );*/
00951 #define LIST_Manager()              (s32)                        (((tCircleFunc0)(Circle_API [LIST_MANAGER_ID])) ()  )              /* s32 LIST_Manager( void );*/
00952 #define LIST_Set(a,b,c,d)                                        (((tCircleFunc4)(Circle_API [LIST_SET_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))  ) /* void LIST_Set( tList *lptr, u16 posX, u16 posY, bool center );*/
00953 #define TOUCHSCR_GetPosX()          (s32)                        (((tCircleFunc0)(Circle_API [TOUCHSCR_GET_POSX_ID])) () )           /* s32 TOUCHSCR_GetPos( void );*/
00954 #define TOUCHSCR_GetPosY()          (s32)                        (((tCircleFunc0)(Circle_API [TOUCHSCR_GET_POSY_ID])) () )           /* s32 TOUCHSCR_GetPos( void );*/
00955 
00956 
00958 
00959 /*-------------------------------- AUDIO -------------------------------------*/
00960 
00961 /* Exported types ------------------------------------------------------------*/
00962 typedef enum { OFF, ON} ON_OFF_enum ;
00963 typedef enum { AUDIO_MODE, VOICE_MODE, AUDIO_CIRCULAR_MODE, VOICE_CIRCULAR_MODE}  AUDIO_DeviceMode_enum;
00964 typedef enum { NO_SOUND, IS_PLAYING }                           AUDIO_Playback_status_enum;
00965 typedef enum { NO_RECORD, IS_RECORDING }                        AUDIO_Recording_status_enum ;
00966 typedef enum { LG_8_BITS, LG_16_BITS}  AUDIO_Length_enum;
00967 typedef enum { FRQ_48KHZ , FRQ_44KHZ , FRQ_22KHZ , FRQ_16KHZ , FRQ_8KHZ} AUDIO_Frequency_enum; // KJ - Changed to support more FRQ
00968 typedef enum { MONO, STEREO}                                    AUDIO_Format_enum;
00969 typedef enum { FULL = 0, LOW_EMPTY = 1, HIGH_EMPTY = 2 }                AUDIO_PlaybackBuffer_Status ;
00970 typedef enum { EMPTY = 0, LOW_FULL = 1, HIGH_FULL = 2 }                 AUDIO_RecordBuffer_Status ;
00971 typedef s8 sound_type;
00972 
00974 
00975 /* AUDIO functions definition*/
00976 #define AUDIO_SET_MODE_ID               (AUDIO_ID + 0)     /* Set new codec mode*/
00977 #define AUDIO_GET_MODE_ID               (AUDIO_ID + 1)     /* Get the current codec mode*/
00978 #define AUDIO_PLAY_ID                   (AUDIO_ID + 2)     /* Issues audio samples (stored in buffer) to the audio codec via I2S*/
00979 #define AUDIO_SPEAKER_ONOFF_ID          (AUDIO_ID + 3)     /* Set the PLS switch of the audio codec ON or OFF, in order to mute or not the loudspeaker.*/
00980 #define AUDIO_MUTE_ONOFF_ID             (AUDIO_ID + 4)     /* Set the MUT switch of the audio codec ON or OFF*/
00981 #define AUDIO_ISMUTE_ID                 (AUDIO_ID + 5)     /* Indicates if the audio is MUTE or not*/
00982 #define AUDIO_INC_VOLUME_ID             (AUDIO_ID + 6)     /* Increment the volume of the loudspeaker and headphones*/
00983 #define AUDIO_DEC_VOLUME_ID             (AUDIO_ID + 7)     /* Decrement the volume of the loudspeaker and headphones*/
00984 #define AUDIO_PLAYBACK_GETSTATUS_ID     (AUDIO_ID + 8)     /* Get the current status of the playback mode*/
00985 #define AUDIO_RECORD_GETSTATUS_ID       (AUDIO_ID + 9)     /* Get the current status of the record mode*/
00986 #define AUDIO_RECORD_ID                 (AUDIO_ID + 10)    /* Store audio samples into buffer from the audio codec via I2S*/
00987 #define AUDIO_READ_REGISTER_ID          (AUDIO_ID + 11)    /* Reads a data byte from one of STw5094A configuration registers*/
00988 #define AUDIO_WRITE_REGISTER_ID         (AUDIO_ID + 12)    /* Send a data byte to one of STw5094A configuration registers*/
00989 
00990 #define AUDIO_SET_BUFFER_SIZE_ID        (AUDIO2_ID + 0)    /* Adjust the size of the local buffer used in MONO mode.*/
00991 #define AUDIO_RECORD_BUFF_GETSTATUS_ID  (AUDIO2_ID + 1)    /* Stores audio samples to the buffer from the audio codec via I2S.*/
00992 #define AUDIO_RECORD_STOP_ID            (AUDIO2_ID + 2)    /* Stop the record by stopping the DMA transfer.*/
00993 #define AUDIO_PLAY_BUFF_GETSTATUS_ID    (AUDIO2_ID + 3)    /* Issues audio samples (stored in buffer) to the audio codec via I2S.*/
00994 #define AUDIO_PLAY_STOP_ID              (AUDIO2_ID + 4)    /* Stop the playback by stopping the DMA transfer.*/
00995 
00996 /* Prototypes*/
00997 #define AUDIO_SetMode(a,b,c,d)                                     (((tCircleFunc4)(Circle_API [AUDIO_SET_MODE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d)))
00998 /* void AUDIO_SetMode( AUDIO_DeviceMode_enum mode,  */
00999 /*                     AUDIO_Playback_length_enum length,*/
01000 /*                     AUDIO_Playback_frequence_enum frequence,*/                                                                                                                                /*                     AUDIO_format_enum format);*/
01001 #define AUDIO_GetMode()                         (AUDIO_DeviceMode_enum)(((tCircleFunc0)(Circle_API [AUDIO_GET_MODE_ID])) () )                           /* AUDIO_DeviceMode_enum AUDIO_GetMode();*/
01002 #define AUDIO_Play(a,b)                                                 ((tCircleFunc2)(Circle_API[AUDIO_PLAY_ID])) ((u32) (a), (u32) (b))              /* void AUDIO_Play( sound_type * buffer, s32 size );*/
01003 #define AUDIO_SPEAKER_OnOff(a)                                          ((tCircleFunc1)(Circle_API [AUDIO_SPEAKER_ONOFF_ID])) ((u32) (a))               /* void AUDIO_SPEAKER_OnOff(ON_OFF_enum mode);*/
01004 #define AUDIO_MUTE_OnOff(a)                                             ((tCircleFunc1)(Circle_API [AUDIO_MUTE_ONOFF_ID]))    ((u32) (a))               /* void AUDIO_MUTE_OnOff(ON_OFF_enum mode);*/
01005 #define AUDIO_IsMute()                                           (bool)(((tCircleFunc0)(Circle_API [AUDIO_ISMUTE_ID])) () )                             /* bool AUDIO_IsMute(void);*/
01006 #define AUDIO_Inc_Volume(a)                                             ((tCircleFunc1)(Circle_API [AUDIO_INC_VOLUME_ID])) ((u32) (a))                  /* void AUDIO_Inc_Volume(u8 dB);*/
01007 #define AUDIO_Dec_Volume(a)                                             ((tCircleFunc1)(Circle_API [AUDIO_DEC_VOLUME_ID])) ((u32) (a))                  /* void AUDIO_Dec_Volume(u8 dB)*/
01008 #define AUDIO_Playback_GetStatus()         (AUDIO_Playback_status_enum)(((tCircleFunc0)(Circle_API [AUDIO_PLAYBACK_GETSTATUS_ID])) () )                 /* AUDIO_Playback_status_enum AUDIO_Playback_GetStatus();*/
01009 #define AUDIO_Recording_GetStatus()       (AUDIO_Recording_status_enum)(((tCircleFunc0)(Circle_API [AUDIO_RECORD_GETSTATUS_ID])) () )                   /* AUDIO_Record_status_enum AUDIO_Playback_GetStatus();*/
01010 #define AUDIO_Record(a,b)                                               ((tCircleFunc2)(Circle_API[AUDIO_RECORD_ID])) ((u32) (a), (u32) (b))            /* void AUDIO_Record( sound_type * buffer, s32 size );*/
01011 #define AUDIO_ReadRegister(a)                                       (u8)((tCircleFunc1)(Circle_API[AUDIO_READ_REGISTER_ID])) ((u32) (a))                /* u8 AUDIO_ReadRegister(u8 register_to_read);*/
01012 #define AUDIO_WriteRegister(a,b)                                        ((tCircleFunc2)(Circle_API[AUDIO_WRITE_REGISTER_ID])) ((u32) (a), (u32) (b))    /* void AUDIO_WriteRegister(u8 register_to_write, u8 data_to_write);*/
01013 #define AUDIO_RecordBuffer_GetStatus(a)      (AUDIO_RecordBuffer_Status)((tCircleFunc1)(Circle_API[AUDIO_RECORD_BUFF_GETSTATUS_ID])) ((u32) (a))        /* AUDIO_RecordBuffer_Status AUDIO_RecordBuffer_GetStatus(AUDIO_RecordBuffer_Status value);*/
01014 #define AUDIO_Record_Stop()                                             ((tCircleFunc0)(Circle_API [AUDIO_RECORD_STOP_ID])) ()                          /* void AUDIO_Record_Stop( );*/
01015 #define AUDIO_PlaybackBuffer_GetStatus(a)  (AUDIO_PlaybackBuffer_Status)((tCircleFunc1)(Circle_API[AUDIO_PLAY_BUFF_GETSTATUS_ID])) ((u32) (a))          /* AUDIO_PlaybackBuffer_Status AUDIO_PlaybackBuffer_GetStatus(AUDIO_PlaybackBuffer_Status value);*/
01016 #define AUDIO_Playback_Stop()                                           ((tCircleFunc0)(Circle_API [AUDIO_PLAY_STOP_ID])) ()                            /* void AUDIO_Playback_Stop( );*/
01017 #define AUDIO_SetLocalBufferSize(a)                                     ((tCircleFunc1)(Circle_API [AUDIO_SET_BUFFER_SIZE_ID]))    ((u32) (a))          /* void AUDIO_SetLocalBufferSize(s32 size);*/
01018 
01020 
01021 
01022 /*------------------------------ POWER / SHUTDOWN -----------------------------*/
01023 
01024 /* Exported types ------------------------------------------------------------*/
01025 
01026 
01028 
01029 /* Exported defines ----------------------------------------------------------*/
01030 
01031 /* SHUTDOWN functions definition*/
01032 #define SHUTDOWN_ACTION_ID           (SHUTDOWN_ID + 0)     /* Switch off the power supply*/
01033 
01034 /* Prototypes*/
01035 #define SHUTDOWN_Action()            ((tCircleFunc0)(Circle_API [SHUTDOWN_ACTION_ID])) ()  /* void SHUTDOWN_Action( void );*/
01036 
01038 
01039 
01040 /*------------------------------ Filesystem -----------------------------------*/
01041 
01042 /* Exported defines ----------------------------------------------------------*/
01043 #define MAX_PATH_LENGTH 200
01044 
01045 /*===================================================================*/
01046 /* 32-bit error codes*/
01047 #define FS_OK           0           // no error
01048 #define FS_EOF          1           // end of file (not an error)
01049 #define FS_WRITEPROT    2           // volume is write protected
01050 #define FS_NOTFOUND     3           // path or file not found
01051 #define FS_PATHLEN      4           // path too long
01052 #define FS_ALLOCNEW     5           // must allocate new directory cluster
01053 #define FS_ERRMISC      0xffffffff  // generic error
01054 
01055 /*===================================================================*/
01056 /* File access modes*/
01057 #define FS_READ         1           // read-only
01058 #define FS_WRITE        2           // write-only
01059 #define FS_CREATEDIR   (2+4)        // create dir (NTRF100521)
01060 
01061 /*===================================================================*/
01062 /* DOS attribute bits*/
01063 #define FS_ATTR_READ_ONLY           0x01
01064 #define FS_ATTR_HIDDEN              0x02
01065 #define FS_ATTR_SYSTEM              0x04
01066 #define FS_ATTR_VOLUME_ID           0x08
01067 #define FS_ATTR_DIRECTORY           0x10
01068 #define FS_ATTR_ARCHIVE             0x20
01069 #define FS_ATTR_LONG_NAME   (FS_ATTR_READ_ONLY | FS_ATTR_HIDDEN | FS_ATTR_SYSTEM | FS_ATTR_VOLUME_ID)
01070 
01071 /* Exported types ------------------------------------------------------------*/
01072 
01073 typedef enum STORAGE_device
01074 {
01075     MMCSD_SDIO,
01076     INTERNAL_FLASH // currently not used
01077 } eSTORAGE_device;
01078 
01083 typedef struct _tagVOLINFO
01084 {
01085     u8 unit;                // unit on which this volume resides
01086     u8 filesystem;          // formatted filesystem
01087 
01088     /* These two fields aren't very useful, so support for them has been commented out to*/
01089     /* save memory. (Note that the "system" tag is not actually used by DOS to determine*/
01090     /* filesystem type - that decision is made entirely on the basis of how many clusters*/
01091     /* the drive contains. DOSFS works the same way).*/
01092     /* See tag: OEMID in dosfs.c*/
01093     /*  u8 oemid[9];            // OEM ID ASCIIZ*/
01094     /*  u8 system[9];           // system ID ASCIIZ*/
01095     u8  label[12];          /* volume label ASCIIZ*/
01096     u32 startsector;        /* starting sector of filesystem*/
01097     u8  secperclus;         /* sectors per cluster*/
01098     u16 reservedsecs;       /* reserved sectors*/
01099     u32 numsecs;            /* number of sectors in volume*/
01100     u32 secperfat;          /* sectors per FAT*/
01101     u16 rootentries;        /* number of root dir entries*/
01102 
01103     u32 numclusters;        /* number of clusters on drive*/
01104 
01105     /* The fields below are PHYSICAL SECTOR NUMBERS.*/
01106     u32 fat1;               /* starting sector# of FAT copy 1*/
01107     u32 rootdir;            /* starting sector# of root directory (FAT12/FAT16) or cluster (FAT32)*/
01108     u32 dataarea;           /* starting sector# of data area (cluster #2)*/
01109 } VOLINFO, *PVOLINFO;
01110 
01111 
01112 
01129 typedef struct _tagDIRENT
01130 {
01131     u8 name[11];            /* filename*/
01132     u8 attr;                /* attributes (see ATTR_* constant definitions)*/
01133     u8 reserved;            /* reserved, must be 0*/
01134     u8 crttimetenth;        /* create time, 10ths of a second (0-199 are valid)*/
01135     u8 crttime_l;           /* creation time low byte*/
01136     u8 crttime_h;           /* creation time high byte*/
01137     u8 crtdate_l;           /* creation date low byte*/
01138     u8 crtdate_h;           /* creation date high byte*/
01139     u8 lstaccdate_l;        /* last access date low byte*/
01140     u8 lstaccdate_h;        /* last access date high byte*/
01141     u8 startclus_h_l;       /* high word of first cluster, low byte (FAT32)*/
01142     u8 startclus_h_h;       /* high word of first cluster, high byte (FAT32)*/
01143     u8 wrttime_l;           /* last write time low byte*/
01144     u8 wrttime_h;           /* last write time high byte*/
01145     u8 wrtdate_l;           /* last write date low byte*/
01146     u8 wrtdate_h;           /* last write date high byte*/
01147     u8 startclus_l_l;       /* low word of first cluster, low byte*/
01148     u8 startclus_l_h;       /* low word of first cluster, high byte*/
01149     u8 filesize_0;          /* file size, low byte*/
01150     u8 filesize_1;          
01151     u8 filesize_2;          
01152     u8 filesize_3;          /* file size, high byte*/
01153 } DIRENT, *PDIRENT;
01154 
01155 
01160 typedef struct _tagDIRINFO
01161 {
01162     u32 currentcluster;     /* current cluster in dir*/
01163     u8  currentsector;      /* current sector in cluster*/
01164     u8  currententry;       /* current dir entry in sector*/
01165     u8* scratch;            /* ptr to user-supplied scratch buffer (one sector)*/
01166     u8  flags;              /* internal DOSFS flags*/
01167 } DIRINFO, *PDIRINFO;
01168 
01173 typedef struct _tagFILEINFO
01174 {
01175     PVOLINFO volinfo;       /* VOLINFO used to open this file*/
01176     u32 dirsector;          /* physical sector containing dir entry of this file*/
01177     u8  diroffset;          /* # of this entry within the dir sector*/
01178     u8  mode;               /* mode in which this file was opened*/
01179     u32 firstcluster;       /* first cluster of file*/
01180     u32 filelen;            /* byte length of file*/
01181 
01182     u32 cluster;            /* current cluster*/
01183     u32 pointer;            /* current (BYTE) pointer*/
01184 } FILEINFO, *PFILEINFO;
01185 
01186 
01188 
01189 /* FILE SYSTEM functions definition*/
01190 
01191 #define FS_MOUNT_ID               (FS_ID+0)  /* Mount device: perform necessary initialization*/
01192 #define FS_UNMOUNT_ID             (FS_ID+1)  /* Unmount device: perform necessary deinitialization*/
01193 #define FS_OPENFILE_ID            (FS_ID+2)  /* Opens file / directory from specified path*/
01194 #define FS_READFILE_ID            (FS_ID+3)  /* Reads from specified file*/
01195 #define FS_WRITEFILE_ID           (FS_ID+4)  /* writs data to specified file*/
01196 #define FS_CLOSE_ID               (FS_ID+5)  /* closes file*/
01197 #define FS_SEEK_ID                (FS_ID+6)  /* seek in file*/
01198 #define FS_DELETE_ID              (FS_ID+7)  /* delete file or directory*/
01199 #define FS_GET_NEXT_ENTRY_ID      (FS_ID+8)  /* Reads next entry from dir*/
01200 #define FS_OPEN_DIRECTORY_ID      (FS_ID+9)  /* Open directory*/
01201 #define FS_GET_VOLUME_INFO_ID     (FS_ID+10) /* get volume info*/
01202 #define FS_EXPLORER_INI_ID        (FS_ID+11) /* Initialize the explorer list*/
01203 #define FS_EXPLORER_ID            (FS_ID+12) /* Manage the navigation into the SDCard*/
01204 #define FS_GET_SD_CURRENT_PATH_ID (FS_ID+13) /* Get the current path of the SDCard*/
01205 #define FS_GET_SD_VOLINFO_ID      (FS_ID+14) /* Get the current path of the SDCard*/
01206 #define FS_GET_PATH_FILTER_ID     (FS_ID+15) /* Get the current path filter*/
01207 #define FS_SET_PATH_FILTER_ID     (FS_ID+16) /* Set the current path filer*/
01208 
01209 /* Prototypes*/
01210 #define FS_Mount(a)                              (u32)((tCircleFunc1)(Circle_API [FS_MOUNT_ID])) ((u32) (a))                                    /* u32 FS_Mount(enum STORAGE_device device);*/
01211 #define FS_Unmount(a)                            (u32)((tCircleFunc1)(Circle_API [FS_UNMOUNT_ID])) ((u32) (a))                                  /* u32 FS_Unmount(enum STORAGE_device device);*/
01212 #define FS_OpenFile(a,b,c,d)                    (u32)(((tCircleFunc4)(Circle_API [FS_OPENFILE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))  )    /* u32 FS_OpenFile(PVOLINFO volinfo, u8 *path, u8 mode, PFILEINFO fileinfo);*/
01213 #define FS_ReadFile(a,b,c,d)                    (u32)(((tCircleFunc4)(Circle_API [FS_READFILE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))  )    /* u32 FS_ReadFile(PFILEINFO fileinfo,  u8 *buffer, u32 *successcount, u32 len);*/
01214 #define FS_WriteFile(a,b,c,d)                   (u32)(((tCircleFunc4)(Circle_API [FS_WRITEFILE_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))  )   /* u32 FS_WriteFile(PFILEINFO fileinfo,  u8 *buffer, u32 *successcount, u32 len);*/
01215 #define FS_Close(a)                              (u32)((tCircleFunc1)(Circle_API [FS_CLOSE_ID])) ((u32) (a))                                    /* u32 FS_Close(PFILEINFO fileinfo);*/
01216 #define FS_Seek(a,b)                                  ((tCircleFunc2)(Circle_API[FS_SEEK_ID])) ((u32) (a), (u32) (b))                           /* void FS_Seek(PFILEINFO fileinfo, u32 offset);*/
01217 #define FS_Delete(a,b)                           (u32)((tCircleFunc2)(Circle_API[FS_DELETE_ID])) ((u32) (a), (u32) (b))                         /* u32 FS_Delete(PVOLINFO volinfo, u8 *path);*/
01218 #define FS_GetNextEntry(a,b,c)                  (u32)(((tCircleFunc3)(Circle_API [FS_GET_NEXT_ENTRY_ID])) ((u32)(a),(u32)(b),(u32)(c) ))        /* u32 FS_GetNextEntry(PVOLINFO volinfo, PDIRINFO dirinfo, PDIRENT dirent);*/
01219 #define FS_OpenDirectory(a,b,c)                 (u32)(((tCircleFunc3)(Circle_API [FS_OPEN_DIRECTORY_ID])) ((u32)(a),(u32)(b),(u32)(c) ))        /* u32 FS_OpenDirectory(PVOLINFO volinfo,u8 *dirname, PDIRINFO dirinfo);    */
01220 #define FS_GetVolumeInfo(a,b,c)                 (u32)(((tCircleFunc3)(Circle_API [FS_GET_VOLUME_INFO_ID])) ((u32)(a),(u32)(b),(u32)(c) ))       /* u32 FS_GetVolumeInfo(u8 unit,  u32 startsector, PVOLINFO volinfo);   */
01221 #define FS_Explorer_Ini()                       (u32)(((tCircleFunc0)(Circle_API [FS_EXPLORER_INI_ID])) () )                                    /* enum MENU_code FS_Explorer_Ini ( void );*/
01222 #define FS_Explorer()                           (u32)(((tCircleFunc0)(Circle_API [FS_EXPLORER_ID])) () )                                        /* s32 FS_Explorer (void);*/
01223 #define FS_GetSDCardCurrentPath()               (u32)(((tCircleFunc0)(Circle_API [FS_GET_SD_CURRENT_PATH_ID])) () )                             /* u8* FS_GetSDCardCurrentPath (void);*/
01224 #define FS_GetSDCardVolInfo()                   (u32)(((tCircleFunc0)(Circle_API [FS_GET_SD_VOLINFO_ID])) () )                                  /* VOLINFO* FS_GetSDCardVolInfo (void);*/
01225 #define FS_GetPathFilter()                      (u32)(((tCircleFunc0)(Circle_API [FS_GET_PATH_FILTER_ID])) () )                                 /* u8* FS_GetPathFilter ( void );*/
01226 #define FS_SetPathFilter(a)                           ((tCircleFunc1)(Circle_API [FS_SET_PATH_FILTER_ID])) ((u32) (a))                          /* void FS_SetPathFilter ( u8* filter );*/
01227 
01229 
01230 //--------------------------------- Application -------------------------------
01231 typedef void ( *tAppPtrMgr )( coord_t sposX, coord_t sposY );
01232 
01233 
01234 #endif /*__CIRCLE_API_H */