⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 circle_api.h

📁 FreeRTOS is a portable, open source, mini Real Time Kernel - a free to download and royalty free RTO
💻 H
📖 第 1 页 / 共 4 页
字号:
#define BUTTON_GETMODE_ID                    (BUTTON_ID + 2)         // Return button mode
#define BUTTON_WAITFORRELEASE_ID             (BUTTON_ID + 3)         // Disable temporarily any new button event

// Prototypes
#define BUTTON_GetState()       (enum BUTTON_state)   (((tCircleFunc0)(Circle_API [BUTTON_GETSTATE_ID])) ())        // enum BUTTON_state BUTTON_GetState(void);
#define BUTTON_SetMode(a);                            ((tCircleFunc1)(Circle_API [BUTTON_SETMODE_ID])) ((u32)(a))   // void BUTTON_SetMode( enum BUTTON_mode mode);
#define BUTTON_GetMode();       (enum BUTTON_mode)    (((tCircleFunc0)(Circle_API [BUTTON_GETMODE_ID])) ())         // enum BUTTON_mode BUTTON_GetMode ( void ) ;
#define BUTTON_WaitForRelease()                       ((tCircleFunc0)(Circle_API [BUTTON_WAITFORRELEASE_ID])) ()    // void BUTTON_WaitForRelease(void);

/// @endcond

//----------------------------------   LCD   -----------------------------------

/* Exported defines ----------------------------------------------------------*/

// RGB is 16-bit coded as    G2G1G0B4 B3B2B1B0 R4R3R2R1 R0G5G4G3
#define RGB_MAKE(xR,xG,xB)    ( ( (xG&0x07)<<13 ) + ( (xG)>>5 )  +      \
                                ( ((xB)>>3) << 8 )          +      \
                                ( ((xR)>>3) << 3 ) )                    /*!< Macro to make a LCD compatible color format from RGB.  */

#define RGB_RED         0x00F8                  /*!<  Predefined color.       */
#define RGB_BLACK       0x0000                  /*!<  Predefined color.       */
#define RGB_WHITE       0xffff                  /*!<  Predefined color.       */
#define RGB_BLUE        0x1F00                  /*!<  Predefined color.       */
#define RGB_GREEN       0xE007                  /*!<  Predefined color.       */
#define RGB_YELLOW      (RGB_GREEN|RGB_RED)     /*!<  Predefined color.       */
#define RGB_MAGENTA     (RGB_BLUE|RGB_RED)      /*!<  Predefined color.       */
#define RGB_LIGHTBLUE   (RGB_BLUE|RGB_GREEN)    /*!<  Predefined color.       */
#define RGB_ORANGE      (RGB_RED | 0xE001)      /*!<  Predefined color ( Green/2 + red ).  */
#define RGB_PINK        (RGB_MAGENTA | 0xE001)  /*!<  Predefined color ( Green/2 + magenta ). */

// PWM rates.
#define BACKLIGHTMIN                0x1000   /*!< Minimal PWM rate.           */
#define DEFAULT_CCR_BACKLIGHTSTART  0x8000   /*!< Default PWM rate.           */

// SCREEN Infos
#define SCREEN_WIDTH          128         /*!< Width of visible screen in pixels.   */
#define SCREEN_HEIGHT         128         /*!< Height of visible screen in pixels.  */
#define CHIP_SCREEN_WIDTH     132         /*!< Width of screen driven by LCD controller in pixels.  */
#define CHIP_SCREEN_HEIGHT    132         /*!< Height of screen driven by LCD controller in pixels.  */

// Characters Infos
#define CHAR_WIDTH            7           /*!< Width of a character.   */
#define CHAR_HEIGHT           14          /*!< Height of a character.   */

/// @cond Internal

// LCD functions definition
#define LCD_SETRECTFORCMD_ID                   (LCD_ID + 0)          // Define the rectangle (for the next command to be applied)
#define LCD_GETPIXEL_ID                        (LCD_ID + 1)          // Read the value of one pixel
#define LCD_DRAWPIXEL_ID                       (LCD_ID + 2)          // Draw a Graphic image on slave LCD.
#define LCD_SENDLCDCMD_ID                      (LCD_ID + 3)          // Send one byte command to LCD LCD.
#define LCD_SENDLCDDATA_ID                     (LCD_ID + 4)          // Display one byte data to LCD LCD.
#define LCD_READLCDDATA_ID                     (LCD_ID + 5)          // Read LCD byte data displayed on LCD LCD.
#define LCD_FILLRECT_ID                        (LCD_ID + 6)          // Fill a rectangle with one color
#define LCD_DRAWRECT_ID                        (LCD_ID + 7)          // Draw a rectangle with one color
#define LCD_DISPLAYCHAR_ID                     (LCD_ID + 8)          // Display one character
#define LCD_RECTREAD_ID                        (LCD_ID + 9)          // Save a rectangle of the monitor RAM
#define LCD_SETBACKLIGHT_ID                    (LCD_ID + 10)         // Modify the PWM rate
#define LCD_GETBACKLIGHT_ID                    (LCD_ID + 11)         // Return the PWM rate
#define LCD_SETROTATESCREEN_ID                 (LCD_ID + 12)         // Enable/Disable screen rotation
#define LCD_GETROTATESCREEN_ID                 (LCD_ID + 13)         // Return screen rotation mode
#define LCD_SETSCREENORIENTATION_ID            (LCD_ID + 14)         // Set screen orientation
#define LCD_GETSCREENORIENTATION_ID            (LCD_ID + 15)         // Return screen orientation
#define LCD_SETBACKLIGHT_OFF_ID                (LCD_ID + 16)         // Switch the LCD back light off.
#define LCD_SETBACKLIGHT_ON_ID                 (LCD_ID + 17)         // Switch the LCD back light on.

// Prototypes
#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)
#define LCD_GetPixel(a,b)                 (u16)      (((tCircleFunc2)(Circle_API [LCD_GETPIXEL_ID])) ((u32)(a),(u32)(b)))                                       //u16   LCD_GetPixel (u8 x, u8 y)
#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) ;
#define LCD_SendLCDCmd(a)                            ((tCircleFunc1)(Circle_API [LCD_SENDLCDCMD_ID])) ((u32)(a))                                                //void  LCD_SendLCDCmd(u8 Cmd);
#define LCD_SendLCDData(a)                           ((tCircleFunc1)(Circle_API [LCD_SENDLCDDATA_ID])) ((u32)(a))                                               //void  LCD_SendLCDData(u8 Data);
#define LCD_ReadLCDData()                 (u32)      (((tCircleFunc0)(Circle_API [LCD_READLCDDATA_ID])) ())                                                     //u32   LCD_ReadLCDData(void);
#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 );
#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 );
#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);
#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 );
#define LCD_SetBackLight(a)                          ((tCircleFunc1)(Circle_API [LCD_SETBACKLIGHT_ID])) ((u32)(a))                                              //void  LCD_SetBackLight(u32 newBaclightStart);
#define LCD_GetBackLight()                (u32)      (((tCircleFunc0)(Circle_API [LCD_GETBACKLIGHT_ID])) ())                                                    //u32   LCD_GetBackLight(void);
#define LCD_SetRotateScreen(a)                       ((tCircleFunc1)(Circle_API [LCD_SETROTATESCREEN_ID])) ((u32)(a))                                           //void  LCD_SetRotateScreen ( u8 RotateScreen)
#define LCD_GetRotateScreen()             (u32)      (((tCircleFunc0)(Circle_API [LCD_GETROTATESCREEN_ID])) ())                                                 //u8    LCD_GetRotateScreen (void)
#define LCD_SetScreenOrientation(a)                  ((tCircleFunc1)(Circle_API [LCD_SETSCREENORIENTATION_ID])) ((u32)(a))                                      //void LCD_SetScreenOrientation (Rotate_H12_V_Match_TypeDef ScreenOrientation)
#define LCD_GetScreenOrientation()        (u32)      (((tCircleFunc0)(Circle_API [LCD_GETSCREENORIENTATION_ID])) ())                                            //Rotate_H12_V_Match_TypeDef LCD_GetScreenOrientation (void)
#define LCD_SetBackLightOff()                        ((tCircleFunc0)(Circle_API [LCD_SETBACKLIGHT_OFF_ID])) ()
#define LCD_SetBackLightOn()                         ((tCircleFunc0)(Circle_API [LCD_SETBACKLIGHT_ON_ID])) ()

/// @endcond

//----------------------------------   DRAW   ----------------------------------

/// @cond Internal

/* Exported defines ----------------------------------------------------------*/

// DRAW functions definition
#define DRAW_SETDEFAULTCOLOR_ID                   (DRAW_ID + 0)         // Reset colors (bgnd + text)
#define DRAW_CLEAR_ID                             (DRAW_ID + 1)         // Clear the LCD display
#define DRAW_SETIMAGE_ID                          (DRAW_ID + 2)         // Draw a colored image
#define DRAW_SETIMAGEBW_ID                        (DRAW_ID + 3)         // Draw a black and white image
#define DRAW_SETLOGOBW_ID                         (DRAW_ID + 4)         // Draw logo
#define DRAW_DISPLAYVBAT_ID                       (DRAW_ID + 5)         // Display the voltage of battery in ascii
#define DRAW_DISPLAYTIME_ID                       (DRAW_ID + 6)         // Display time in ascii
#define DRAW_DISPLAYSTRING_ID                     (DRAW_ID + 7)         // Display a 17char max string of characters
#define DRAW_DISPLAYSTRINGINVERTED_ID             (DRAW_ID + 8)         // Display a 17char max string of characters with inverted colors
#define DRAW_GETCHARMAGNICOEFF_ID                 (DRAW_ID + 9)         // Return the magnifying value for the characters
#define DRAW_SETCHARMAGNICOEFF_ID                 (DRAW_ID + 10)        // Set the magnifying value for the characters
#define DRAW_GETTEXTCOLOR_ID                      (DRAW_ID + 11)        // Return the current text color
#define DRAW_SETTEXTCOLOR_ID                      (DRAW_ID + 12)        // Set the current text color
#define DRAW_GETBGNDCOLOR_ID                      (DRAW_ID + 13)        // Return the current background color
#define DRAW_SETBGNDCOLOR_ID                      (DRAW_ID + 14)        // Set the current background color
#define DRAW_LINE_ID                              (DRAW_ID + 15)        // Draw a Line between (using Bresenham algorithm) 

//Prototypes
#define DRAW_SetDefaultColor()                      ((tCircleFunc0)(Circle_API [DRAW_SETDEFAULTCOLOR_ID])) ()                                                 //void  DRAW_SetDefaultColor (void);
#define DRAW_Clear()                                ((tCircleFunc0)(Circle_API [DRAW_CLEAR_ID])) ()                                                           //void  DRAW_Clear(void);
#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);
#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);
#define DRAW_SetLogoBW()                            ((tCircleFunc0)(Circle_API [DRAW_SETLOGOBW_ID])) ()                                                       //void  DRAW_SetLogoBW(void);
#define DRAW_DisplayVbat(a,b)                       ((tCircleFunc2)(Circle_API [DRAW_DISPLAYVBAT_ID])) ((u32)(a),(u32)(b))                                    //void  DRAW_DisplayVbat(u8 x, u8 y);
#define DRAW_DisplayTime(a,b)                       ((tCircleFunc2)(Circle_API [DRAW_DISPLAYTIME_ID])) ((u32)(a),(u32)(b))                                    //void  DRAW_DisplayTime(u8 x, u8 y);
#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 );
#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 );
#define DRAW_GetCharMagniCoeff()              (u16) (((tCircleFunc0)(Circle_API [DRAW_GETCHARMAGNICOEFF_ID])) ())                                             //u16   DRAW_GetCharMagniCoeff(void);
#define DRAW_SetCharMagniCoeff(a)                   ((tCircleFunc1)(Circle_API [DRAW_SETCHARMAGNICOEFF_ID])) ((u32)(a))                                       //void  DRAW_SetCharMagniCoeff(u16 Coeff);
#define DRAW_GetTextColor()                   (u16) (((tCircleFunc0)(Circle_API [DRAW_GETTEXTCOLOR_ID])) ())                                                  //u16   DRAW_GetTextColor(void);
#define DRAW_SetTextColor(a)                        ((tCircleFunc1)(Circle_API [DRAW_SETTEXTCOLOR_ID])) ((u32)(a))                                            //void  DRAW_SetTextColor(u16 Color);
#define DRAW_GetBGndColor()                   (u16) (((tCircleFunc0)(Circle_API [DRAW_GETBGNDCOLOR_ID])) ())                                                  //u16   DRAW_GetBGndColor(void);
#define DRAW_SetBGndColor(a)                        ((tCircleFunc1)(Circle_API [DRAW_SETBGNDCOLOR_ID])) ((u32)(a))                                            //void  DRAW_SetBGndColor(u16 Color);
#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 );
/// @endcond

//--------------------------------   BUZZER  -----------------------------------

/* Exported type def ---------------------------------------------------------*/

/**
* @enum  BUZZER_mode
* @brief CircleOS buzzer modes.
*
* Without the undefined mode, the CircleOS provides 5 modes for its buzzer.
**/
enum BUZZER_mode
   {
   BUZZER_UNDEF      = -1,         /*!<  undefined mode for buzzer            */
   BUZZER_OFF        =  0,         /*!<  The buzzer is put off.               */
   BUZZER_ON         =  1,         /*!<  The buzzer is put on.                */
   BUZZER_SHORTBEEP  =  2,         /*!<  Make buzzer to bip for a short time  */
   BUZZER_LONGBEEP   =  3,         /*!<  Make buzzer to bip for a long time   */
   BUZZER_PLAYMUSIC  =  4          /*!<  Make buzzer to play a music          */
   };

/// @cond Internal

/* Exported defines ----------------------------------------------------------*/
#define BUZZER_BEEP  BUZZER_SHORTBEEP

// BUZZER functions definition
#define BUZZER_SETMODE_ID                       (BUZZER_ID + 0)   // Set new buzzer mode
#define BUZZER_GETMODE_ID                       (BUZZER_ID + 1)   // Get the current buzzer mode.
#define BUZZER_PLAY_MUSIC_ID                    (BUZZER_ID + 2)   // Plays the provided melody that follows the RTTTL Format.

// Prototypes
#define BUZZER_SetMode(a)                            ((tCircleFunc1)(Circle_API [BUZZER_SETMODE_ID])) ((u32)(a))               //void  BUZZER_SetMode( enum BUZZER_mode mode);
#define BUZZER_GetMode()      (enum  BUZZER_mode)    (((tCircleFunc0)(Circle_API [BUZZER_GETMODE_ID])) ())                     //enum  BUZZER_mode BUZZER_GetMode( void );
#define BUZZER_PlayMusic(a)                          ((tCircleFunc1)(Circle_API [BUZZER_PLAY_MUSIC_ID])) ((u32)(a))            //void BUZZER_PlayMusic (const u8 *melody );

/// @endcond

//---------------------------------   MENU   -----------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -