mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 03:20:00 +03:00
implemented cli (press # in serial to enter it). no commands except exit/version yet. added uartPrint fixed bug in task switching with missing breaks - was failing baro and perhaps mag readings dynamic yaw direction, camtilt feature, camtrig feature. ported some of 2.0-pre1 features: * gyro smoothing * baro/althold cleanup git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@102 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
69 lines
2 KiB
C
Executable file
69 lines
2 KiB
C
Executable file
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <math.h>
|
|
#include <string.h>
|
|
|
|
#include "stm32f10x_conf.h"
|
|
#include "core_cm3.h"
|
|
|
|
#include "drv_system.h" // timers, delays, etc
|
|
#include "drv_adc.h"
|
|
#include "drv_adxl345.h"
|
|
#include "drv_bmp085.h"
|
|
#include "drv_hmc5883l.h"
|
|
#include "drv_i2c.h"
|
|
#include "drv_mpu3050.h"
|
|
#include "drv_pwm.h"
|
|
#include "drv_uart.h"
|
|
|
|
typedef enum {
|
|
SENSOR_ACC = 1 << 0,
|
|
SENSOR_BARO = 1 << 1,
|
|
SENSOR_MAG = 1 << 2,
|
|
SENSOR_SONAR = 1 << 3,
|
|
SENSOR_GPS = 1 << 4,
|
|
} AvailableSensors;
|
|
|
|
typedef enum {
|
|
FEATURE_PPM = 1 << 0,
|
|
FEATURE_VBAT = 1 << 1,
|
|
FEATURE_SERVO = 1 << 2,
|
|
FEATURE_DIGITAL_SERVO = 1 << 3,
|
|
FEATURE_MOTOR_STOP = 1 << 4,
|
|
FEATURE_SERVO_TILT = 1 << 5,
|
|
FEATURE_CAMTRIG = 1 << 6,
|
|
FEATURE_GYRO_SMOOTHING = 1 << 7,
|
|
} AvailableFeatures;
|
|
|
|
#define digitalHi(p, i) { p->BSRR = i; }
|
|
#define digitalLo(p, i) { p->BRR = i; }
|
|
#define digitalToggle(p, i) { p->ODR ^= i; }
|
|
|
|
// Hardware GPIO
|
|
#define LED0_GPIO GPIOB
|
|
#define LED0_PIN GPIO_Pin_3
|
|
#define LED1_GPIO GPIOB
|
|
#define LED1_PIN GPIO_Pin_4
|
|
#define BEEP_GPIO GPIOA
|
|
#define BEEP_PIN GPIO_Pin_12
|
|
#define BARO_GPIO GPIOC
|
|
#define BARO_PIN GPIO_Pin_13
|
|
|
|
// Helpful macros
|
|
#define LED0_TOGGLE digitalToggle(LED0_GPIO, LED0_PIN);
|
|
#define LED0_OFF digitalHi(LED0_GPIO, LED0_PIN);
|
|
#define LED0_ON digitalLo(LED0_GPIO, LED0_PIN);
|
|
|
|
#define LED1_TOGGLE digitalToggle(LED1_GPIO, LED1_PIN);
|
|
#define LED1_OFF digitalHi(LED1_GPIO, LED1_PIN);
|
|
#define LED1_ON digitalLo(LED1_GPIO, LED1_PIN);
|
|
|
|
#define BEEP_TOGGLE digitalToggle(BEEP_GPIO, BEEP_PIN);
|
|
#define BEEP_OFF digitalHi(BEEP_GPIO, BEEP_PIN);
|
|
#define BEEP_ON digitalLo(BEEP_GPIO, BEEP_PIN);
|
|
|
|
#define BARO_OFF digitalLo(BARO_GPIO, BARO_PIN);
|
|
#define BARO_ON digitalHi(BARO_GPIO, BARO_PIN);
|