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

📄 cyan_base_driver.h.bak

📁 使用CYAN单片机的ECOG1开发板连接SIM300C的GSM模块开发的短信收发程序.供UART和AT指令编程者参考
💻 BAK
字号:
/******************************************************************************
MODE:		AML--#GPS+accelerator+compass
MCU:		Cyan eCOG1k
COMPILER:	CyanIDE v1.41
FILE NAME:	cyan_base_driver head files
******************************************************************************/
#ifndef	cyan_base_driver_h
#define cyan_base_driver_h

//----------------------------------------------------------------------------
#ifndef cyan_base_driver_code
	#define cyan_base_driver_ext extern
#else
	#define cyan_base_driver_ext
#endif	//cyan_base_driver_code

/******************************************************************************
include all head files
******************************************************************************/
#include <ecog.h>
#include <ecog1.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include "accelerator.h"
#include "GAC_Algorithm.h"
/******************************************************************************
Private constants and types.
******************************************************************************/
#define		TIMER2_ENABLE		fd.tim.ctrl_en.cnt2_cnt
#define 	TIMER2_DISABLE		fd.tim.ctrl_dis.cnt2_cnt		//disable Timer2.
#define		TIMER2_LOADING		fd.tim.cmd.cnt2_ld				//loading value to timer2.
#define		T2_LOAD_VALUE		4999							//int time = 5ms
#define		TIMER2OUT			4
/******************************************************************************
Global variables.
******************************************************************************/

typedef enum			//spi chip select type define.
{
	accelerator_CS,
	compass_CS

	
}spi_CS_type;

struct
{	
	unsigned int	bit3	:	4;
	unsigned int	bit2	:	4;
	unsigned int	bit1	:	4;
	unsigned int	bit0	:	4;
}cyan_base_driver_ext routing_flag; 

#define GPS_RECEIVE_DONE_FLAG		routing_flag.bit3
#define ACC_RECEIVE_DONE_FLAG		routing_flag.bit2
#define COM_RECEIVE_DONE_FLAG		routing_flag.bit1
#define COMPASS_WROK_FLAG			routing_flag.bit0

cyan_base_driver_ext unsigned int usrb_tx_str_poiter;

cyan_base_driver_ext ACC_type			ACC_average_buf;

cyan_base_driver_ext unsigned int		COM_delay_buf[2];

cyan_base_driver_ext unsigned int		COM_average_buf[FIRST_COUNT];

cyan_base_driver_ext float				COM_radian_buf[FIRST_COUNT];

cyan_base_driver_ext unsigned int		ACC_COM_average_read_pointer;

cyan_base_driver_ext ACC_type			ACC_delay_buf[FIRST_COUNT];
cyan_base_driver_ext unsigned int		ACC_delay_write_pointer;
cyan_base_driver_ext unsigned int		ACC_delay_read_pointer;


cyan_base_driver_ext ACC_type			ACC_data_buf;
cyan_base_driver_ext XYZ_type 			gps;
cyan_base_driver_ext XYZ_type 			gps_o;
cyan_base_driver_ext GPS_DATA 			gps_i;

cyan_base_driver_ext ROLL_PITCH 		r_p_data_buf;

cyan_base_driver_ext float				roll_save;
cyan_base_driver_ext float				pitch_save;

cyan_base_driver_ext float				cos_com_hd;
cyan_base_driver_ext float				sin_com_hd;


cyan_base_driver_ext XYZ_type			GS[BUF_LENGTH];			//GPS_distance_buffer
cyan_base_driver_ext unsigned int		GS_write_pointer;
cyan_base_driver_ext unsigned int		GS_read_pointer;

cyan_base_driver_ext XYZ_type			AV[BUF_LENGTH];

cyan_base_driver_ext XYZ_type			An_1;

cyan_base_driver_ext XYZ_type			Vn;
cyan_base_driver_ext XYZ_type			Vn_1;

cyan_base_driver_ext XYZ_type			Sn;
cyan_base_driver_ext XYZ_type			Sn_1;


cyan_base_driver_ext XYZ_type			AS[BUF_LENGTH];			//ACC_distance_buffer

cyan_base_driver_ext unsigned int		AS_write_pointer;
cyan_base_driver_ext unsigned int		AS_read_pointer;

cyan_base_driver_ext float				LSE_VXYZ0;
cyan_base_driver_ext float				LSE_XYZ0;
cyan_base_driver_ext float				earth_Xn;
cyan_base_driver_ext float				earth_Yn;
cyan_base_driver_ext float				earth_Zn;
cyan_base_driver_ext float				X_distance_accumulator;
cyan_base_driver_ext float				Y_distance_accumulator;


/******************************************************************************
Extern function define.
******************************************************************************/
cyan_base_driver_ext void delay_2us(unsigned int us_reg);
cyan_base_driver_ext void delay_ms(unsigned int ms_reg);
cyan_base_driver_ext unsigned int cyan_spi_transfer_byte(unsigned int mosi);
cyan_base_driver_ext void cyan_spi_assert_CS(spi_CS_type _CS_);
cyan_base_driver_ext void cyan_spi_deassert_CS(spi_CS_type _CS_);
cyan_base_driver_ext int putchar(int c);
cyan_base_driver_ext void uart_initialization(void);
cyan_base_driver_ext void timer_initialization(void);
cyan_base_driver_ext char *_fcvt_(char *str_save,double float_data);

/******************************************************************************
end
******************************************************************************/
#endif //cyan_base_driver_h

⌨️ 快捷键说明

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