mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-12 19:10:32 +03:00
git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@86 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
61 lines
1.8 KiB
C
Executable file
61 lines
1.8 KiB
C
Executable file
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <math.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,
|
|
} 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);
|