代码拉取完成,页面将自动刷新
/**
* File Name:main.c
* Description:本程为定位节点的主程序
*
* @Author: 王非
* @Date: 2018.08.12
* ***************************************
* Function:作为锚节点的程序,等待启动帧和控制帧命令,控制电机旋转,同时利用2.4G信道发送消息
*/
/* Inlcudes--------------------------------------------*/
#include <string.h>
#include "main.h"
#include "function.h"
#include "timer.h"
#include "uart.h"
#include "radio.h"
#include "sx1280.h"
#include "2G4.h"
#include "Anchor.h"
#include "motor.h"
/* defines---------------------------------------------*/
// 定义一个版本号
const uint8_t SystemVersion[] = "V4_1647";
/* Variables-------------------------------------------*/
extern uint16_t CurrentAngle = 0x0000;
/* Main function---------------------------------------*/
void main()
{
#ifdef UART_1
uint8_t angle[2] = {0x00};
#endif
// 硬件初始化
DeviceInit();
#ifdef UART_1
angle[0] = (CurrentAngle >> 8) & 0xff;
angle[1] = CurrentAngle;
SendString(1,"The CurrentAngle is:");
SendHex2Ascills(1,angle,2);
#endif
while(1)
{
Anchor_run();
}
}
/* Related functions---------------------------------------*/
void DeviceInit()
{
// 硬件初始化
M0 = 0;
M1 = 0;
// 串口初始化
Init_Uart();
SendString(1,"\r\nThe System Version:_._.");
SendString(1,SystemVersion);
SendString(1,"._._\r\n\r\n");
SendString(1, "--------------Initing----------\r\n" );
SendString(1, "Uart initialization completed...........\r\n" );
// 定时器初始化
InitTimer0();
SendString(1, "Timer initialization completed...........\r\n" );
// PCA初始化
PCA_init();
SendString(1, "PCA initialization completed...........\r\n" );
// 2.4G射频初始化
Init_2G4();
SendString(1, "2.4G initialization completed...........\r\n" );
SendString(1, "-------------Init finished--------\r\n" );
if(ReadAnchorNumber() == true)
{
SendString(1, "The Device is a Anchor, and the number is:");
send_16_2_str(1, GetAnchorNumber());
SendString(1, "\r\n---------------------\r\n" );
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。