資源簡介
本文件是匿名飛控 的源碼,因為匿名本身就是開源的,所以在此將匿名的代碼上傳上來,以便理解自己的代碼解讀
代碼片段和文件信息
/********************?(C)?COPYRIGHT?2017?ANO?Tech?********************************
?*?作者????:匿名科創
?*?官網????:www.anotc.com
?*?淘寶????:anotc.taobao.com
?*?技術Q群?:190169595
?*?描述????:數據傳輸
**********************************************************************************/
#include?“Ano_DT.h“
#include?“Drv_Uart.h“
#include?“ano_usb.h“
#include?“Ano_RC.h“
#include?“Ano_Sensor_Basic.h“
#include?“Drv_gps.h“
#include?“Ano_Parameter.h“
#include?“ANO_IMU.h“
#include?“Drv_icm20602.h“
#include?“Ano_MagProcess.h“
#include?“Ano_MotorCtrl.h“
#include?“Ano_Power.h“
#include?“Ano_FlightCtrl.h“
#include?“Ano_MotionCal.h“
#include?“Ano_FlightDataCal.h“
#include?“Ano_LocCtrl.h“
#include?“Ano_FlyCtrl.h“
/////////////////////////////////////////////////////////////////////////////////////
//數據拆分宏定義,在發送大于1字節的數據類型時,比如int16、float等,需要把數據拆分成單獨字節進行發送
#define?BYTE0(dwTemp)???????(?*(?(char?*)(&dwTemp) )?)
#define?BYTE1(dwTemp)???????(?*(?(char?*)(&dwTemp)?+?1)?)
#define?BYTE2(dwTemp)???????(?*(?(char?*)(&dwTemp)?+?2)?)
#define?BYTE3(dwTemp)???????(?*(?(char?*)(&dwTemp)?+?3)?)
#define?MYHWADDR 0x05
#define?SWJADDR 0xAF
#define?PARNUM 100
s32?ParValList[100]; //參數列表
dt_flag_t?f; //需要發送數據的標志
u8?data_to_send[50]; //發送數據緩存
u8?checkdata_to_sendchecksum_to_send;
/////////////////////////////////////////////////////////////////////////////////////
//Send_Data函數是協議中所有發送數據功能使用到的發送函數
//移植時,用戶應根據自身應用的情況,根據使用的通信方式,實現此函數
void?ANO_DT_Send_Data(u8?*dataToSend??u8?length)
{
#ifdef?ANO_DT_USE_USB
AnoUsbCdcSend(?dataToSend??length?);;//USB數據發送
#endif
#ifdef?ANO_DT_USE_USART2
Drv_Uart2SendBuf(data_to_send?length);
#endif
}
/////////////////////////////////////////////////////////////////////////////////////
//Data_Exchange函數處理各種數據發送請求,比如想實現每5ms發送一次傳感器數據至上位機,即在此函數內實現
//此函數應由用戶每1ms調用一次
extern?float?ultra_dis_lpf;
void?ANO_DT_Data_Exchange(void)
{
static?u16?cnt?=?0;
static?u16?senser_cnt? =?10;
static?u16?senser2_cnt? =?50;
static?u16?user_cnt? =?10;
static?u16?status_cnt? =?15;
static?u16?rcdata_cnt? =?20;
static?u16?motopwm_cnt =?20;
static?u16?power_cnt =?50;
static?u16?speed_cnt??? =?50;
static?u16?location_cnt?=?500;
if((cnt?%?senser_cnt)?==?(senser_cnt-1))
f.send_senser?=?1;
if((cnt?%?senser2_cnt)?==?(senser2_cnt-1))
f.send_senser2?=?1;
if((cnt?%?user_cnt)?==?(user_cnt-2))
f.send_user?=?1;
if((cnt?%?status_cnt)?==?(status_cnt-1))
f.send_status?=?1;
if((cnt?%?rcdata_cnt)?==?(rcdata_cnt-1))
f.send_rcdata?=?1;
if((cnt?%?motopwm_cnt)?==?(motopwm_cnt-2))
f.send_motopwm?=?1;
if((cnt?%?power_cnt)?==?(power_cnt-2))
f.send_power?=?1;
if((cnt?%?speed_cnt)?==?(speed_cnt-3))
f.send_speed?=?1;
if((cnt?%?location_cnt)?==?(location_cnt-3))
{
f.send_location?=?1;
}
if(++cnt>1000)?cnt?=?0;
/////////////////////////////////////////////////////////////////////////////////////
if(f.send_version)
{
f.send_version
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????.......?????98377??2019-07-19?11:59??飛控源碼\ANO_PioneerPro_Ti\ANO_PioneerPro_Ti.uvguix.Toughguy
????.......?????47621??2019-07-17?14:23??飛控源碼\ANO_PioneerPro_Ti\ANO_PioneerPro_Ti.uvoptx
????.......?????31751??2019-07-12?10:34??飛控源碼\ANO_PioneerPro_Ti\ANO_PioneerPro_Ti.uvprojx
????.......?????34270??2019-07-09?18:50??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_DT.c
????.......??????3757??2019-05-22?20:32??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_DT.h
????.......??????9286??2019-01-19?16:21??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_FlyCtrl.c
????.......???????487??2019-05-22?20:31??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_FlyCtrl.h
????.......??????5430??2019-07-09?11:00??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_LED.c
????.......???????956??2019-05-22?23:28??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_LED.h
????.......??????7873??2019-07-10?19:19??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_OPMV_CBTracking_Ctrl.c
????.......???????821??2019-07-08?15:01??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_OPMV_CBTracking_Ctrl.h
????.......??????7430??2019-06-05?22:31??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_Parameter.c
????.......??????1782??2019-05-23?18:34??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_Parameter.h
????.......??????2264??2019-06-17?20:54??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_ProgramCtrl_User.c
????.......???????598??2019-07-04?13:45??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_ProgramCtrl_User.h
?????文件??????10703??2019-07-17?14:23??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_RC.c
?????文件????????753??2019-07-17?14:23??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_RC.h
?????文件???????5831??2019-07-17?14:23??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_Scheduler.c
????.......???????770??2019-05-21?13:45??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_Scheduler.h
????.......??????8864??2019-06-04?12:31??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_Usb.c
????.......???????237??2019-05-24?20:24??飛控源碼\ANO_PioneerPro_Ti\Application\Ano_Usb.h
????.......???????224??2019-05-23?11:54??飛控源碼\ANO_PioneerPro_Ti\Application\main.c
????.......??????5292??2019-06-10?21:53??飛控源碼\ANO_PioneerPro_Ti\Application\sysconfig.h
????.......??????5222??2019-05-23?22:25??飛控源碼\ANO_PioneerPro_Ti\Application\sysconfig_DESKTOP-0ARSAJT_5月-25-183255-2019_Conflict.h
?????文件?????234091??2019-07-11?09:53??飛控源碼\ANO_PioneerPro_Ti\build\ano_altctrl.crf
?????文件???????1852??2019-07-11?09:53??飛控源碼\ANO_PioneerPro_Ti\build\ano_altctrl.d
?????文件?????238812??2019-07-11?09:53??飛控源碼\ANO_PioneerPro_Ti\build\ano_altctrl.o
?????文件?????237860??2019-07-11?09:53??飛控源碼\ANO_PioneerPro_Ti\build\ano_attctrl.crf
?????文件???????1971??2019-07-11?09:53??飛控源碼\ANO_PioneerPro_Ti\build\ano_attctrl.d
?????文件?????246032??2019-07-11?09:53??飛控源碼\ANO_PioneerPro_Ti\build\ano_attctrl.o
............此處省略626個文件信息
- 上一篇:圖書管理系統源碼
- 下一篇:項目綜合:stm32機械臂完整程序
評論
共有 條評論