1 Star 1 Fork 1

非啊飞啊/Location

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.c 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
/**
* 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" );
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/frame0224/Location.git
git@gitee.com:frame0224/Location.git
frame0224
Location
Location
master

搜索帮助