78 lines
1.0 KiB
C++
78 lines
1.0 KiB
C++
#include <math.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include "stm32g4xx.h"
|
|
|
|
#include "gpio.h"
|
|
#include "led.h"
|
|
#include "ori.h"
|
|
#include "bar.h"
|
|
#include "eep.h"
|
|
#include "tim.h"
|
|
#include "pwm.h"
|
|
#include "tele.h"
|
|
#include "med.h"
|
|
#include "tick.h"
|
|
|
|
#include "sbus.h"
|
|
#include "iwdg.h"
|
|
#include "pid.h"
|
|
#include "uart.h"
|
|
#include "gps.h"
|
|
|
|
#include "laser.h"
|
|
#include "flow.h"
|
|
|
|
#include "imu.h"
|
|
|
|
#include "mot.h"
|
|
#include "move.h"
|
|
|
|
#include "prot.h"
|
|
|
|
|
|
static const float PI = 3.14159265359f;
|
|
static const float TO_RAD = PI/180.0f;
|
|
|
|
#define TELE_TIMER 10 // ms
|
|
#define LED_TIMER 100 // ms
|
|
#define JOY_TIMER 200 // ms
|
|
|
|
#define LOG_TIMER 5 // ms
|
|
|
|
#define PWM_FREQ 100 // Hz
|
|
|
|
#define MAIN_UPDATE_FREQ 100 // Hz
|
|
#define MAIN_UPDATE_PRIORITY 2
|
|
|
|
|
|
|
|
float range = 0;
|
|
|
|
|
|
|
|
int main()
|
|
{
|
|
|
|
|
|
LED_Init();
|
|
|
|
|
|
TICK_Init();
|
|
|
|
Laser_Init_v2();
|
|
|
|
|
|
//174 1811
|
|
while(true)
|
|
{
|
|
if (isRangeReady())
|
|
{
|
|
range = getRange();
|
|
}
|
|
}
|
|
|
|
}
|
|
//------------------------------------------------------------------------------
|
|
|