Update altimeter drivers so they do not include "board.h". It is now
clear what all altimeter drivers need to compile and what was unnecessarily included before. Moved some platform specific configuration from board.h into platform.h
This commit is contained in:
parent
001de4cdf3
commit
ff0f4e66a9
79
src/board.h
79
src/board.h
|
@ -19,6 +19,7 @@
|
|||
#include "drivers/accgyro_common.h"
|
||||
#include "drivers/gpio_common.h"
|
||||
#include "drivers/system_common.h"
|
||||
#include "drivers/altimeter_common.h"
|
||||
#include "sensors_common.h"
|
||||
|
||||
typedef enum {
|
||||
|
@ -113,86 +114,10 @@ typedef struct sensor_data_t
|
|||
int updated;
|
||||
} sensor_data_t;
|
||||
|
||||
typedef void (* baroOpFuncPtr)(void); // baro start operation
|
||||
typedef void (* baroCalculateFuncPtr)(int32_t *pressure, int32_t *temperature); // baro calculation (filled params are pressure and temperature)
|
||||
typedef uint16_t (* rcReadRawDataPtr)(uint8_t chan); // used by receiver driver to return channel data
|
||||
typedef void (* pidControllerFuncPtr)(void); // pid controller function prototype
|
||||
|
||||
typedef struct baro_t
|
||||
{
|
||||
uint16_t ut_delay;
|
||||
uint16_t up_delay;
|
||||
baroOpFuncPtr start_ut;
|
||||
baroOpFuncPtr get_ut;
|
||||
baroOpFuncPtr start_up;
|
||||
baroOpFuncPtr get_up;
|
||||
baroCalculateFuncPtr calculate;
|
||||
} baro_t;
|
||||
|
||||
// Hardware definitions and GPIO
|
||||
#ifdef FY90Q
|
||||
// FY90Q
|
||||
#define LED0_GPIO GPIOC
|
||||
#define LED0_PIN Pin_12
|
||||
#define LED1_GPIO GPIOA
|
||||
#define LED1_PIN Pin_15
|
||||
|
||||
#define GYRO
|
||||
#define ACC
|
||||
#define LED0
|
||||
#define LED1
|
||||
|
||||
#define SENSORS_SET (SENSOR_ACC)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef OLIMEXINO
|
||||
// OLIMEXINO
|
||||
|
||||
#ifdef OLIMEXINO_UNCUT_LED2_E_JUMPER
|
||||
// LED2 is using one of the pwm pins (PWM2), so we must not use PWM2. @See pwmInit()
|
||||
#define LED0_GPIO GPIOA
|
||||
#define LED0_PIN Pin_1 // D3, PA1/USART2_RTS/ADC1/TIM2_CH3 - "LED2" on silkscreen, Yellow
|
||||
#define LED0
|
||||
#endif
|
||||
|
||||
#ifdef OLIMEXINO_UNCUT_LED1_E_JUMPER
|
||||
#define LED1_GPIO GPIOA
|
||||
#define LED1_PIN Pin_5 // D13, PA5/SPI1_SCK/ADC5 - "LED1" on silkscreen, Green
|
||||
#define LED1
|
||||
#endif
|
||||
|
||||
#define GYRO
|
||||
#define ACC
|
||||
|
||||
#define SENSORS_SET (SENSOR_ACC)
|
||||
|
||||
#else
|
||||
// Afroflight32
|
||||
|
||||
#define LED0_GPIO GPIOB
|
||||
#define LED0_PIN Pin_3 // PB3 (LED)
|
||||
#define LED1_GPIO GPIOB
|
||||
#define LED1_PIN Pin_4 // PB4 (LED)
|
||||
#define BEEP_GPIO GPIOA
|
||||
#define BEEP_PIN Pin_12 // PA12 (Buzzer)
|
||||
#define BARO_GPIO GPIOC
|
||||
#define BARO_PIN Pin_13
|
||||
|
||||
#define GYRO
|
||||
#define ACC
|
||||
#define MAG
|
||||
#define BARO
|
||||
#define LEDRING
|
||||
#define SONAR
|
||||
#define BUZZER
|
||||
#define LED0
|
||||
#define LED1
|
||||
|
||||
#define SENSORS_SET (SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#include "platform.h"
|
||||
|
||||
// Helpful macros
|
||||
#ifdef LED0
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
#include "board.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <platform.h>
|
||||
|
||||
#include "altimeter_common.h"
|
||||
|
||||
#include "gpio_common.h"
|
||||
#include "system_common.h"
|
||||
#include "bus_i2c.h"
|
||||
|
||||
// BMP085, Standard address 0x77
|
||||
static bool convDone = false;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
typedef void (* baroOpFuncPtr)(void); // baro start operation
|
||||
typedef void (* baroCalculateFuncPtr)(int32_t *pressure, int32_t *temperature); // baro calculation (filled params are pressure and temperature)
|
||||
|
||||
typedef struct baro_t
|
||||
{
|
||||
uint16_t ut_delay;
|
||||
uint16_t up_delay;
|
||||
baroOpFuncPtr start_ut;
|
||||
baroOpFuncPtr get_ut;
|
||||
baroOpFuncPtr start_up;
|
||||
baroOpFuncPtr get_up;
|
||||
baroCalculateFuncPtr calculate;
|
||||
} baro_t;
|
|
@ -1,4 +1,13 @@
|
|||
#include "board.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <platform.h>
|
||||
|
||||
#include "altimeter_common.h"
|
||||
|
||||
#include "gpio_common.h"
|
||||
#include "system_common.h"
|
||||
#include "bus_i2c.h"
|
||||
|
||||
// MS5611, Standard address 0x77
|
||||
#define MS5611_ADDR 0x77
|
||||
|
|
|
@ -8,3 +8,69 @@
|
|||
#define U_ID_0 (*(uint32_t*)0x1FFFF7E8)
|
||||
#define U_ID_1 (*(uint32_t*)0x1FFFF7EC)
|
||||
#define U_ID_2 (*(uint32_t*)0x1FFFF7F0)
|
||||
|
||||
|
||||
// Hardware definitions and GPIO
|
||||
#ifdef FY90Q
|
||||
// FY90Q
|
||||
#define LED0_GPIO GPIOC
|
||||
#define LED0_PIN Pin_12
|
||||
#define LED1_GPIO GPIOA
|
||||
#define LED1_PIN Pin_15
|
||||
|
||||
#define GYRO
|
||||
#define ACC
|
||||
#define LED0
|
||||
#define LED1
|
||||
|
||||
#define SENSORS_SET (SENSOR_ACC)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef OLIMEXINO
|
||||
// OLIMEXINO
|
||||
|
||||
#ifdef OLIMEXINO_UNCUT_LED2_E_JUMPER
|
||||
// LED2 is using one of the pwm pins (PWM2), so we must not use PWM2. @See pwmInit()
|
||||
#define LED0_GPIO GPIOA
|
||||
#define LED0_PIN Pin_1 // D3, PA1/USART2_RTS/ADC1/TIM2_CH3 - "LED2" on silkscreen, Yellow
|
||||
#define LED0
|
||||
#endif
|
||||
|
||||
#ifdef OLIMEXINO_UNCUT_LED1_E_JUMPER
|
||||
#define LED1_GPIO GPIOA
|
||||
#define LED1_PIN Pin_5 // D13, PA5/SPI1_SCK/ADC5 - "LED1" on silkscreen, Green
|
||||
#define LED1
|
||||
#endif
|
||||
|
||||
#define GYRO
|
||||
#define ACC
|
||||
|
||||
#define SENSORS_SET (SENSOR_ACC)
|
||||
|
||||
#else
|
||||
// Afroflight32
|
||||
|
||||
#define LED0_GPIO GPIOB
|
||||
#define LED0_PIN Pin_3 // PB3 (LED)
|
||||
#define LED1_GPIO GPIOB
|
||||
#define LED1_PIN Pin_4 // PB4 (LED)
|
||||
#define BEEP_GPIO GPIOA
|
||||
#define BEEP_PIN Pin_12 // PA12 (Buzzer)
|
||||
#define BARO_GPIO GPIOC
|
||||
#define BARO_PIN Pin_13
|
||||
|
||||
#define GYRO
|
||||
#define ACC
|
||||
#define MAG
|
||||
#define BARO
|
||||
#define LEDRING
|
||||
#define SONAR
|
||||
#define BUZZER
|
||||
#define LED0
|
||||
#define LED1
|
||||
|
||||
#define SENSORS_SET (SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue