📄 circle_api.h
字号:
/* Exported defines ----------------------------------------------------------*/
#define REMOVE_MENU 0x01 /*!< Menu flag: remove menu when item selected. */
#define APP_MENU 0x02 /*!< Menu flag: item is an application. */
#define MENU_MAXITEM 8 /*!< Maximum number of item in a menu. */
/* Exported type def ---------------------------------------------------------*/
/**
* @struct tMenuItem
* @brief Menu item description.
**/
typedef struct
{
const char* Text; /*!< Name of Item displayed in menu */
enum MENU_code (*Fct_Init) ( void ); /*!< First function launched if item is selected. */
enum MENU_code (*Fct_Manage)( void ); /*!< Second function launched after a "return MENU_CONTINU_COMMAND" in the first function */
int fRemoveMenu; /*!< Flag to know if remove menu at end */
} tMenuItem;
/**
* @struct tMenu
* @brief Menu description.
**/
typedef struct
{
unsigned fdispTitle: 1; /*!< Display title is set. */
const char* Title; /*!< Menu title. */
int NbItems; /*!< Number of items in the menu ( must be <= MENU_MAXITEM ) */
int LgMax; /*!< Unused. */
int XPos; /*!< X position of menu bottom-left corner. */
int YPos; /*!< Y position of menu bottom-left corner. */
int XSize; /*!< Unused. */
int YSize; /*!< Unused. */
unsigned int SelectedItem; /*!< ID of selected item (0 for first item, 1 for second item, ...) */
tMenuItem Items[MENU_MAXITEM]; /*!< Items of menu. */
} tMenu;
/**
* @enum MENU_code
* @brief Application return values.
*
* List of all the codes available for CircleOS application return values.
**/
enum MENU_code
{
MENU_LEAVE = 0, /*!< Leave application. */
MENU_CONTINUE = 1, /*!< Continue application. */
MENU_REFRESH = 2, /*!< Refresh current menu. */
MENU_CHANGE = 3, /*!< Change current menu. */
MENU_CONTINUE_COMMAND = 4 /*!< Sent by Ini functions.*/
};
/// @cond Internal
/* Exported defines ----------------------------------------------------------*/
// MENU functions definition
#define MENU_SET_ID (MENU_ID + 0) // Display a menu
#define MENU_REMOVE_ID (MENU_ID + 1) // Remove the current menu, DRAW_Clear and set pointer mode to "POINTER_ON".
#define MENU_QUESTION_ID (MENU_ID + 2) // Dedicated menu for ask question and yes/no responses
#define MENU_PRINT_ID (MENU_ID + 3) // Display a popup menu with a string.
#define MENU_CLEAR_CURRENT_COMMAND_ID (MENU_ID + 4) // Set CurrentCommand to 0
#define MENU_SET_LEVELTITLE_ID (MENU_ID + 5) // Set the title of level menu managed by MENU_SetLevel_Mgr.
#define MENU_SET_TEXTCOLOR_ID (MENU_ID + 6) // Set the color used for text menu.
#define MENU_GET_TEXTCOLOR_ID (MENU_ID + 7) // Return the color used for text menu.
#define MENU_SET_BGNDCOLOR_ID (MENU_ID + 8) // Set the background color used for menu.
#define MENU_GET_BGNDCOLOR_ID (MENU_ID + 9) // Return the background color used for menu.
#define MENU_QUIT_ID (MENU_ID + 10) // Leave the current menu (stand for "cancel" and do a DRAW_Clear)
#define MENU_SET_LEVELINI_ID (MENU_ID + 11) // Initialise a generic function to set a avalue in the range of [0,4]
#define MENU_CLEAR_CURRENT_MENU_ID (MENU_ID + 12) // Set CurrentMenu to 0
#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)
// Prototypes
#define MENU_Set(a) ((tCircleFunc1)(Circle_API [MENU_SET_ID])) ((u32)(a)) //void MENU_Set ( tMenu *mptr );
#define MENU_Remove() ((tCircleFunc0)(Circle_API [MENU_REMOVE_ID])) () //void MENU_Remove ( void ) ;
#define MENU_Question(a,b) ((tCircleFunc2)(Circle_API [MENU_QUESTION_ID])) ((u32)(a),(u32)(b)) //void MENU_Question ( char *str, int *answer );
#define MENU_Print(a) ((tCircleFunc1)(Circle_API [MENU_PRINT_ID])) ((u32)(a)) //void MENU_Print ( char *str );
#define MENU_ClearCurrentCommand() ((tCircleFunc0)(Circle_API [MENU_CLEAR_CURRENT_COMMAND_ID])) () //void MENU_ClearCurrentCommand(void)
#define MENU_SetLevelTitle(a) ((tCircleFunc1)(Circle_API [MENU_SET_LEVELTITLE_ID])) ((u32)(a)) //void MENU_SetLevelTitle(u8* title)
#define MENU_SetTextColor(a) ((tCircleFunc1)(Circle_API [MENU_SET_TEXTCOLOR_ID])) ((u32)(a)) //void MENU_SetTextColor ( int TextColor )
#define MENU_GetTextColor() (u32) (((tCircleFunc0)(Circle_API [MENU_GET_TEXTCOLOR_ID])) ()) //int MENU_GetTextColor ( void )
#define MENU_SetBGndColor(a) ((tCircleFunc1)(Circle_API [MENU_SET_BGNDCOLOR_ID])) ((u32)(a)) //void MENU_SetBGndColor ( int BGndColor )
#define MENU_GetBGndColor() (u32) (((tCircleFunc0)(Circle_API [MENU_GET_BGNDCOLOR_ID])) ()) //int MENU_GetBGndColor ( void )
#define MENU_Quit() (enum MENU_code) (((tCircleFunc0)(Circle_API [MENU_QUIT_ID])) ()) //enum MENU_code MENU_Quit ( void )
#define MENU_SetLevel_Ini() (enum MENU_code) (((tCircleFunc0)(Circle_API [MENU_SET_LEVELINI_ID])) ()) //enum MENU_code MENU_SetLevel_Ini ( void )
#define MENU_ClearCurrentMenu() ((tCircleFunc0)(Circle_API [MENU_CLEAR_CURRENT_MENU_ID])) () //void MENU_ClearCurrentMenu(void)
#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 [] )
/// @endcond
//---------------------------------- LED -------------------------------------
/* Exported types ------------------------------------------------------------*/
/**
* @enum LED_mode
* @brief LED modes.
*
* LEDs may be on, off or blinking slowly or fastly!
**/
enum LED_mode
{
LED_UNDEF = -1, /*!< Undefined led mode. */
LED_OFF = 0, /*!< Put off the led. */
LED_ON = 1, /*!< Put on the led. */
LED_BLINKING_LF = 2, /*!< Slow blinking led mode. */
LED_BLINKING_HF = 3 /*!< Fast blinking led mode. */
};
/**
* @enum LED_id
* @brief Available LEDs.
*
* List of all the available LEDs.
**/
enum LED_id
{
LED_GREEN = 0, /*!< Green led id. */
LED_RED = 1 /*!< Red led id. */
};
/// @cond Internal
/* Exported defines ----------------------------------------------------------*/
// LED functions definition
#define LED_SET_ID (LED_ID + 0) // Set a specified LED in a specified mode.
// Prototypes
#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 );
/// @endcond
//-------------------------------- RTC --------------------------------------
/* Exported defines ----------------------------------------------------------*/
// Backup registers
#define BKP_SYS1 1 /*!< Backup register reserved for OS */
#define BKP_SYS2 2 /*!< Backup register reserved for OS */
#define BKP_SYS3 3 /*!< Backup register reserved for OS */
#define BKP_SYS4 4 /*!< Backup register reserved for OS */
#define BKP_SYS5 5 /*!< Backup register reserved for OS */
#define BKP_SYS6 6 /*!< Backup register reserved for OS */
#define BKP_USER1 7 /*!< Backup available for users application */
#define BKP_USER2 8 /*!< Backup available for users application */
#define BKP_USER3 9 /*!< Backup available for users application */
#define BKP_USER4 10 /*!< Backup available for users application */
/// @cond Internal
//RTC functions definition
#define RTC_SET_TIME_ID (RTC_ID + 0) // Set current time.
#define RTC_GET_TIME_ID (RTC_ID + 1) // Return current time.
#define RTC_DISPLAY_TIME_ID (RTC_ID + 2) // Display current time on the 6th line at column 0.
// Prototypes
#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);
#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);
#define RTC_DisplayTime() ((tCircleFunc0)(Circle_API [RTC_DISPLAY_TIME_ID])) () //void RTC_DisplayTime ( void );
/// @endcond
//--------------------------------- Application -------------------------------
typedef void (*tAppPtrMgr) ( int , int );
#endif /*__CIRCLE_API_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -