📄 circle.h
字号:
/********************* (C) COPYRIGHT 2007 RAISONANCE S.A.S. *******************/
/**
*
* @file circle.h
* @brief General header for the CircleOS project.
* @author FL
* @date 07/2007
* @version 1.5
*
* It contains the list of the utilities functions organized by sections
* (MEMS, LCD, POINTER, ...)
*
* @date 10/2007
* @version 1.5 types of OutX_F64 and OutX_F256 changed to u32 (same for Y and Z)
**/
/******************************************************************************/
#include "scheduler.h"
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CIRCLE_H
#define __CIRCLE_H
//-------------------------------- General -------------------------------------
/* Defines ------------------------------------------------------------------*/
#define VDD_VOLTAGE_MV 3300 //Voltage (mV) of the STM32
#define FA_TABLE 0x8006000
#define TIM2 ((TIM_TypeDef *) TIM2_BASE)
#define CIRCLEOS_RAM_BASE 0x20004000
/* Variables ----------------------------------------------------------------*/
extern GPIO_InitTypeDef GPIO_InitStructure;
/* Utilities -----------------------------------------------------------------*/
void UTIL_uint2str( char *ptr , u32 X, u16 digit, int fillwithzero );
void UTIL_int2str( char *ptr , s32 X, u16 digit, int fillwithzero );
u16 UTIL_ReadBackupRegister( u16 BKP_DR );
void UTIL_WriteBackupRegister( u16 BKP_DR, u16 Data );
u16 UTIL_GetBat( void );
u8 UTIL_GetUsb( void );
u16 UTIL_GetTemp ( void ) ;
void UTIL_SetTempMode ( int mode );
//typedef void (*tHandler) ( void );
void UTIL_SetIrqHandler ( int , tHandler );
tHandler UTIL_GetIrqHandler ( int );
extern u16 ADC_ConvertedValue[17];
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
} dummy_var ; //for doxygen
void UTIL_SetSchHandler ( enum eSchHandler , tHandler );
tHandler UTIL_GetSchHandler ( enum eSchHandler );
#define NULL_SCHHDL (0)
#define LAST_SCHHDL ((tHandler)(-1))
void UTIL_SetPll( enum eSpeed speed );
const char* UTIL_GetVersion( void );
enum eSpeed UTIL_GetPll( void );
extern RCC_ClocksTypeDef RCC_ClockFreq;
extern u8 fTemperatureInFahrenheit; /*!< 1 : Fahrenheit, 0 : Celcius (default). */
//--------------------------------- MEMS ------------------------------------
/* Exported types ------------------------------------------------------------*/
typedef enum
{
V12=0,
V3=1,
V6=2,
V9=3
} Rotate_H12_V_Match_TypeDef;
typedef struct
{
s16 OutX ;
s16 OutX_F4 ;
s16 OutX_F16 ;
s32 OutX_F64 ;
s32 OutX_F256 ;
s16 OutY ;
s16 OutY_F4 ;
s16 OutY_F16 ;
s32 OutY_F64 ;
s32 OutY_F256 ;
s16 OutZ ;
s16 OutZ_F4 ;
s16 OutZ_F16 ;
s32 OutZ_F64 ;
s32 OutZ_F256 ;
s16 Shocked ;
s16 RELATIVE_X ;
s16 RELATIVE_Y ;
s16 DoubleClick ;
} tMEMS_Info;
extern tMEMS_Info MEMS_Info;
/* Exported functions --------------------------------------------------------*/
void MEMS_Init(void);
void MEMS_Handler(void);
void MEMS_GetPosition(s16 * pX, s16* pY);
void MEMS_SetNeutral( void );
void MEMS_GetRotation(Rotate_H12_V_Match_TypeDef * H12);
tMEMS_Info* MEMS_GetInfo (void);
u8 MEMS_ReadID(void);
//---------------------------------- LED -------------------------------------
/* Exported types ------------------------------------------------------------*/
enum LED_mode { LED_UNDEF = -1, LED_OFF = 0, LED_ON = 1, LED_BLINKING_LF = 2, LED_BLINKING_HF = 3 };
enum LED_id { LED_GREEN = 0, LED_RED = 1};
/* Exported functions --------------------------------------------------------*/
void LED_Init (void);
void LED_Handler_hw ( enum LED_id id );
void LED_Handler ( void );
void LED_Set ( enum LED_id id, enum LED_mode mode );
//-------------------------------- ADC --------------------------------------
/* Exported functions --------------------------------------------------------*/
void ADConverter_Init (void);
//==============================================================================
//-------------------------------- SHUTDOWN ---------------------------------
/* Exported functions --------------------------------------------------------*/
void SHUTDOWN_Action (void);
//-------------------------------- BUTTON -----------------------------------
/* Exported types ------------------------------------------------------------*/
enum BUTTON_mode { BUTTON_DISABLED = -1, BUTTON_ONOFF = 0,
BUTTON_ONOFF_FORMAIN = 1, BUTTON_WITHCLICK = 2 };
enum BUTTON_state { BUTTON_UNDEF = -1, BUTTON_RELEASED = 0, BUTTON_PUSHED = 1,
BUTTON_PUSHED_FORMAIN = 2 , BUTTON_CLICK = 3, BUTTON_DBLCLICK = 4 };
/* Exported functions -------------------------------------------------------*/
void BUTTON_Init (void);
void BUTTON_Handler(void);
enum BUTTON_state BUTTON_GetState();
void BUTTON_SetMode( enum BUTTON_mode mode);
enum BUTTON_mode BUTTON_GetMode ( void ) ;
void BUTTON_WaitForRelease();
//-------------------------------- POINTER ----------------------------------
/* Exported types ------------------------------------------------------------*/
enum POINTER_mode { POINTER_UNDEF = -1, POINTER_OFF = 0, POINTER_ON = 1, POINTER_MENU = 2, POINTER_APPLICATION = 3, POINTER_RESTORE_LESS = 4 };
enum POINTER_state { POINTER_S_UNDEF = -1, POINTER_S_DISABLED = 0, POINTER_S_ENABLED = 1 };
/* Exported defines ----------------------------------------------------------*/
#define POINTER_WIDTH 7
typedef struct
{
s16 xPos ;
s16 yPos ;
s16 shift_PosX ;
s16 shift_PosY ;
s16 X_PosMin ;
s16 Y_PosMin ;
s16 X_PosMax ;
s16 Y_PosMax ;
} tPointer_Info;
extern tPointer_Info POINTER_Info ;
/* Exported vars -------------------------------------------------------------*/
extern unsigned char *BallPointerBmpSize;
extern unsigned char BallPointerBmp [POINTER_WIDTH], *CurrentPointerBmp,*CurrentPointerSize;
extern u16 CurrentPointerColor;
extern u16 BallColor;
extern s16 POINTER_X_PosMin;
extern s16 POINTER_Y_PosMin;
extern s16 POINTER_X_PosMax;
extern s16 POINTER_Y_PosMax;
extern unsigned char PointerAreaStore [2*POINTER_WIDTH*POINTER_WIDTH];
/* Exported functions --------------------------------------------------------*/
extern void POINTER_Init ( void ) ;
void POINTER_Handler(void);
u16 POINTER_GetCurrentAngleStart ( void );
void POINTER_SetCurrentAngleStart ( u16 );
u16 POINTER_GetCurrentSpeedOnAngle ( void );
void POINTER_SetCurrentSpeedOnAngle ( u16 newspeed );
void POINTER_SetMode( enum POINTER_mode mode);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -