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

📄 circle_api.h

📁 FreeRTOS is a portable, open source, mini Real Time Kernel - a free to download and royalty free RTO
💻 H
📖 第 1 页 / 共 4 页
字号:
/********************* (C) COPYRIGHT 2007 RAISONANCE S.A.S. *******************/
/**
*
* @file     circle_api.h
* @brief    General header for the STM32-circle projects.
* @author   FL
* @date     07/2007
* @version  1.2
* @date     10/2007
* @version  1.5 types of OutX_F64 and OutX_F256 changed to u32 (same for Y and Z)
* @date     10/2007
* @version  1.6 Add the IRQ handler replacement
*
* It contains the list of the utilities functions organized by sections
* (MEMS, LCD, POINTER, ...)
*
**/
/*******************************************************************************
*
* Use this header with version 1.5 or later of the OS.
*
* For a complete documentation on the CircleOS, please go to:
*  http://www.stm32circle.com
*
*******************************************************************************/

#include "stm32f10x_lib.h"

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CIRCLE_API_H
#define __CIRCLE_API_H

//-------------------------------- General -------------------------------------

/**
* @enum  eSpeed
* @brief Clock speeds.
*
* Available clock speeds.
**/
extern enum eSpeed
   {
   SPEED_VERY_LOW    = 1,
   SPEED_LOW         = 2,
   SPEED_MEDIUM      = 3,
   SPEED_HIGH        = 4,
   SPEED_VERY_HIGH   = 5
   } CurrentSpeed;
enum eSchHandler
   {
   LED_SCHHDL_ID     = 0,
   BUTTON_SCHHDL_ID  = 1,
   BUZZER_SCHHDL_ID  = 2,
   MENU_SCHHDL_ID    = 3,
   POINTER_SCHHDL_ID = 4,
   LCD_SCHHDL_ID     = 5,
   DRAW_SCHHDL_ID    = 6,
   RTC_SCHHDL_ID     = 7,

   UNUSED0_SCHHDL_ID = 8,
   UNUSED1_SCHHDL_ID = 9,
   UNUSED2_SCHHDL_ID = 10,
   UNUSED3_SCHHDL_ID = 11,
   UNUSED4_SCHHDL_ID = 12,
   UNUSED5_SCHHDL_ID = 13,
   UNUSED6_SCHHDL_ID = 14,
   UNUSED7_SCHHDL_ID = 15   
   }; 


/// @cond Internal

extern RCC_ClocksTypeDef RCC_ClockFreq;

/* Typedefs ------------------------------------------------------------------*/
typedef u32 (*tCircleFunc0 ) (void);
typedef u32 (*tCircleFunc1 ) (u32 param1);
typedef u32 (*tCircleFunc2 ) (u32 param1, u32 param2);
typedef u32 (*tCircleFunc3 ) (u32 param1, u32 param2, u32 param3);
typedef u32 (*tCircleFunc4 ) (u32 param1, u32 param2, u32 param3, u32 param4);
typedef u32 (*tCircleFunc5 ) (u32 param1, u32 param2, u32 param3, u32 param4, u32 param5);
typedef u32 (*tCircleFunc6 ) (u32 param1, u32 param2, u32 param3, u32 param4, u32 param5, u32 param6);

extern tCircleFunc0 (*ptrCircle_API) [];

/* Defines -------------------------------------------------------------------*/
#define Circle_API   (*ptrCircle_API)

#define POINTER_ID   0x00
#define DRAW_ID      0x20
#define LCD_ID       0x40
#define LED_ID       0x60
#define MEMS_ID      0x70
#define BUTTON_ID    0x80
#define BUZZER_ID    0x90
#define MENU_ID      0xA0
#define UTIL_ID      0xB0
#define RTC_ID       0xC0

// UTIL functions definition.
#define UTIL_SET_PLL_ID                 (UTIL_ID + 0)    // Set clock frequency.
#define UTIL_GET_PLL_ID                 (UTIL_ID + 1)    // Get clock frequency.
#define UTIL_UINT2STR_ID                (UTIL_ID + 2)    // Convert an unsigned integer into a string.
#define UTIL_INT2STR_ID                 (UTIL_ID + 3)    // Convert a signed integer into a string.
#define UTIL_GET_VERSION_ID             (UTIL_ID + 4)    // Get CircleOS version.
#define UTIL_READ_BACKUPREGISTER_ID     (UTIL_ID + 5)    // Reads data from the specified Data Backup Register.
#define UTIL_WRITE_BACKUPREGISTER_ID    (UTIL_ID + 6)    // Writes data to the specified Data Backup Register.
#define UTIL_GET_BAT_ID                 (UTIL_ID + 7)    // Return the batterie tension in mV.
#define UTIL_GET_USB_ID                 (UTIL_ID + 8)    // Return the USB connexion state.
#define UTIL_SET_IRQ_HANDLER_ID         (UTIL_ID + 9)    // Replace an irq handler
#define UTIL_GET_IRQ_HANDLER_ID         (UTIL_ID + 10)   // Get the current irq handler
#define UTIL_SET_SCH_HANDLER_ID         (UTIL_ID + 11)    // Replace an irq handler
#define UTIL_GET_SCH_HANDLER_ID         (UTIL_ID + 12)   // Get the current irq handler
#define UTIL_GET_TEMP_ID                (UTIL_ID + 13)   // Return the temperature (1/100 C)
#define UTIL_SET_TEMPMODE_ID            (UTIL_ID + 14)   // Set the temperature mode (0: mCelcius, 1: mFahrenheit
typedef void (*tHandler) (void);

// Prototypes.
#define UTIL_SetPll(a)                          ((tCircleFunc1)(Circle_API [UTIL_SET_PLL_ID])) ((u32)(a))                                    // void UTIL_SetPll( enum eSpeed speed );
#define UTIL_GetPll()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_PLL_ID])) ())                                          // enum eSpeed UTIL_GetPll( void );
#define UTIL_uint2str(a,b,c,d)                  ((tCircleFunc4)(Circle_API [UTIL_UINT2STR_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))        // void uint2str( char* ptr , u32 X, u16 digit, int fillwithzero );
#define UTIL_int2str(a,b,c,d)                   ((tCircleFunc4)(Circle_API [UTIL_INT2STR_ID])) ((u32)(a),(u32)(b),(u32)(c),(u32)(d))         // void  int2str( char* ptr , s32 X, u16 digit, int fillwithzero );
#define UTIL_GetVersion()              (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_VERSION_ID])) ())                                      // char* UTIL_GetVersion( void );
#define UTIL_ReadBackupRegister(a)     (u32)    (((tCircleFunc1)(Circle_API [UTIL_READ_BACKUPREGISTER_ID])) ((u32)(a)))                      // u16 UTIL_ReadBackupRegister( u16 BKP_DR );
#define UTIL_WriteBackupRegister(a,b)           ((tCircleFunc2)(Circle_API [UTIL_WRITE_BACKUPREGISTER_ID])) ((u32)(a),(u32)(b))              // void UTIL_WriteBackupRegister( u16 BKP_DR, u16 Data );
#define UTIL_GetBat()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_BAT_ID])) ())                                          // u16 UTIL_GetBat( void );
#define UTIL_GetUsb()                  (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_USB_ID])) ())                                          // u8 UTIL_GetUsb( void );
#define UTIL_SetIrqHandler(a,b)                 (((tCircleFunc2)(Circle_API [UTIL_SET_IRQ_HANDLER_ID])) ((int)a,(tHandler)b))                // void UTIL_SetIrqHandler ( int , tHandler );
#define UTIL_GetIrqHandler(a)          (u32)    (((tCircleFunc1)(Circle_API [UTIL_GET_IRQ_HANDLER_ID])) ((int)a))                            // tHandler* UTIL_GetIrqHandler ( int );
#define UTIL_SetSchHandler(a,b)                 (((tCircleFunc2)(Circle_API [UTIL_SET_SCH_HANDLER_ID])) ((int)a,(tHandler)b))                // void UTIL_SetSchHandler ( int , tHandler );
#define UTIL_GetSchHandler(a)          (u32)    (((tCircleFunc1)(Circle_API [UTIL_GET_SCH_HANDLER_ID])) ((int)a))                            // tHandler* UTIL_GetSchHandler ( int );
#define UTIL_GetTemp()                 (u32)    (((tCircleFunc0)(Circle_API [UTIL_GET_TEMP_ID])) ())                                         // u16 UTIL_GetTemp( void );
#define UTIL_SetTempMode(a)                     (((tCircleFunc1)(Circle_API [UTIL_SET_TEMPMODE_ID])) ((int)a))                               // void UTIL_SetTempMode( int mode );

/// @endcond

//---------------------------------   MEMS  ------------------------------------

/* Exported types ------------------------------------------------------------*/

/**
* @enum  Rotate_H12_V_Match_TypeDef
* @brief The 4 possible rotations.
*
* The 4 possible MEM rotations.
**/
typedef enum
   {
   V12 = 0,                                        /*!< No rotation.          */
   V3  = 1,                                        /*!< Rotation to the right.*/
   V6  = 2,                                        /*!< Rotation to the left. */
   V9  = 3                                         /*!< Half a rotation.      */
   } Rotate_H12_V_Match_TypeDef;

/**
* @struct   tMEMS_Info
* @brief    MEMS state description.
**/
typedef struct
   {
   s16 OutX;                     /*!< MEMS X position.                        */
   s16 OutX_F4;                  /*!< MEMS X position filtered on 4 values.   */
   s16 OutX_F16;                 /*!< MEMS X position filtered on 16 values.  */
   s32 OutX_F64;                 /*!< MEMS X position filtered on 64 values.  */
   s32 OutX_F256;                /*!< MEMS X position filtered on 256 values. */
   s16 OutY;                     /*!< MEMS Y position.                        */
   s16 OutY_F4;                  /*!< MEMS Y position filtered on 4 values.   */
   s16 OutY_F16;                 /*!< MEMS Y position filtered on 16 values.  */
   s32 OutY_F64;                 /*!< MEMS Y position filtered on 64 values.  */
   s32 OutY_F256;                /*!< MEMS Y position filtered on 256 values. */

⌨️ 快捷键说明

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