mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Merge pull request #5118 from jflyper/bfdev-pg-for-dashboard
DASHBOARD Separate pg related to pg directory
This commit is contained in:
commit
c42d5707c0
7 changed files with 66 additions and 26 deletions
|
@ -66,6 +66,7 @@ COMMON_SRC = \
|
||||||
pg/bus_i2c.c \
|
pg/bus_i2c.c \
|
||||||
pg/bus_spi.c \
|
pg/bus_spi.c \
|
||||||
pg/camera_control.c \
|
pg/camera_control.c \
|
||||||
|
pg/dashboard.c \
|
||||||
pg/max7456.c \
|
pg/max7456.c \
|
||||||
pg/pg.c \
|
pg/pg.c \
|
||||||
pg/rx_pwm.c \
|
pg/rx_pwm.c \
|
||||||
|
|
|
@ -28,14 +28,6 @@
|
||||||
|
|
||||||
#ifdef USE_I2C_OLED_DISPLAY
|
#ifdef USE_I2C_OLED_DISPLAY
|
||||||
|
|
||||||
#if !defined(OLED_I2C_INSTANCE)
|
|
||||||
#if defined(I2C_DEVICE)
|
|
||||||
#define OLED_I2C_INSTANCE I2C_DEVICE
|
|
||||||
#else
|
|
||||||
#define OLED_I2C_INSTANCE I2C_NONE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define INVERSE_CHAR_FORMAT 0x7f // 0b01111111
|
#define INVERSE_CHAR_FORMAT 0x7f // 0b01111111
|
||||||
#define NORMAL_CHAR_FORMAT 0x00 // 0b00000000
|
#define NORMAL_CHAR_FORMAT 0x00 // 0b00000000
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
#include "pg/adc.h"
|
#include "pg/adc.h"
|
||||||
#include "pg/beeper.h"
|
#include "pg/beeper.h"
|
||||||
#include "pg/beeper_dev.h"
|
#include "pg/beeper_dev.h"
|
||||||
|
#include "pg/dashboard.h"
|
||||||
#include "pg/max7456.h"
|
#include "pg/max7456.h"
|
||||||
#include "pg/pg.h"
|
#include "pg/pg.h"
|
||||||
#include "pg/pg_ids.h"
|
#include "pg/pg_ids.h"
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "config/feature.h"
|
#include "config/feature.h"
|
||||||
#include "pg/pg.h"
|
#include "pg/pg.h"
|
||||||
#include "pg/pg_ids.h"
|
#include "pg/pg_ids.h"
|
||||||
|
#include "pg/dashboard.h"
|
||||||
|
|
||||||
#include "fc/config.h"
|
#include "fc/config.h"
|
||||||
#include "fc/controlrate_profile.h"
|
#include "fc/controlrate_profile.h"
|
||||||
|
@ -71,14 +72,6 @@
|
||||||
#include "sensors/gyro.h"
|
#include "sensors/gyro.h"
|
||||||
#include "sensors/sensors.h"
|
#include "sensors/sensors.h"
|
||||||
|
|
||||||
|
|
||||||
PG_REGISTER_WITH_RESET_TEMPLATE(dashboardConfig_t, dashboardConfig, PG_DASHBOARD_CONFIG, 0);
|
|
||||||
|
|
||||||
PG_RESET_TEMPLATE(dashboardConfig_t, dashboardConfig,
|
|
||||||
.device = I2C_DEV_TO_CFG(DASHBOARD_I2C_INSTANCE),
|
|
||||||
.address = DASHBOARD_I2C_ADDRESS,
|
|
||||||
);
|
|
||||||
|
|
||||||
#define MICROSECONDS_IN_A_SECOND (1000 * 1000)
|
#define MICROSECONDS_IN_A_SECOND (1000 * 1000)
|
||||||
|
|
||||||
#define DISPLAY_UPDATE_FREQUENCY (MICROSECONDS_IN_A_SECOND / 5)
|
#define DISPLAY_UPDATE_FREQUENCY (MICROSECONDS_IN_A_SECOND / 5)
|
||||||
|
|
|
@ -23,21 +23,16 @@
|
||||||
|
|
||||||
#define ENABLE_DEBUG_DASHBOARD_PAGE
|
#define ENABLE_DEBUG_DASHBOARD_PAGE
|
||||||
|
|
||||||
#ifdef OLED_I2C_INSTANCE
|
#if !defined(DASHBOARD_I2C_INSTANCE)
|
||||||
#define DASHBOARD_I2C_INSTANCE OLED_I2C_INSTANCE
|
#if defined(I2C_DEVICE)
|
||||||
|
#define DASHBOARD_I2C_INSTANCE I2C_DEVICE
|
||||||
#else
|
#else
|
||||||
#define DASHBOARD_I2C_INSTANCE I2CDEV_1
|
#define DASHBOARD_I2C_INSTANCE I2C_NONE
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DASHBOARD_I2C_ADDRESS 0x3C // OLED at address 0x3C in 7bit
|
#define DASHBOARD_I2C_ADDRESS 0x3C // OLED at address 0x3C in 7bit
|
||||||
|
|
||||||
typedef struct dashboardConfig_s {
|
|
||||||
I2CDevice device;
|
|
||||||
uint8_t address;
|
|
||||||
} dashboardConfig_t;
|
|
||||||
|
|
||||||
PG_DECLARE(dashboardConfig_t, dashboardConfig);
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PAGE_WELCOME,
|
PAGE_WELCOME,
|
||||||
PAGE_ARMED,
|
PAGE_ARMED,
|
||||||
|
|
35
src/main/pg/dashboard.c
Normal file
35
src/main/pg/dashboard.c
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Cleanflight.
|
||||||
|
*
|
||||||
|
* Cleanflight is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Cleanflight is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#ifdef USE_DASHBOARD
|
||||||
|
|
||||||
|
#include "pg/pg.h"
|
||||||
|
#include "pg/pg_ids.h"
|
||||||
|
|
||||||
|
#include "io/dashboard.h"
|
||||||
|
|
||||||
|
#include "dashboard.h"
|
||||||
|
|
||||||
|
PG_REGISTER_WITH_RESET_TEMPLATE(dashboardConfig_t, dashboardConfig, PG_DASHBOARD_CONFIG, 0);
|
||||||
|
|
||||||
|
PG_RESET_TEMPLATE(dashboardConfig_t, dashboardConfig,
|
||||||
|
.device = I2C_DEV_TO_CFG(DASHBOARD_I2C_INSTANCE),
|
||||||
|
.address = DASHBOARD_I2C_ADDRESS,
|
||||||
|
);
|
||||||
|
#endif
|
23
src/main/pg/dashboard.h
Normal file
23
src/main/pg/dashboard.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Cleanflight.
|
||||||
|
*
|
||||||
|
* Cleanflight is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Cleanflight is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct dashboardConfig_s {
|
||||||
|
I2CDevice device;
|
||||||
|
uint8_t address;
|
||||||
|
} dashboardConfig_t;
|
||||||
|
|
||||||
|
PG_DECLARE(dashboardConfig_t, dashboardConfig);
|
Loading…
Add table
Add a link
Reference in a new issue