1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Merge pull request #5118 from jflyper/bfdev-pg-for-dashboard

DASHBOARD Separate pg related to pg directory
This commit is contained in:
Michael Keller 2018-02-11 02:41:37 +13:00 committed by GitHub
commit c42d5707c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 26 deletions

View file

@ -66,6 +66,7 @@ COMMON_SRC = \
pg/bus_i2c.c \
pg/bus_spi.c \
pg/camera_control.c \
pg/dashboard.c \
pg/max7456.c \
pg/pg.c \
pg/rx_pwm.c \

View file

@ -28,14 +28,6 @@
#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 NORMAL_CHAR_FORMAT 0x00 // 0b00000000

View file

@ -64,6 +64,7 @@
#include "pg/adc.h"
#include "pg/beeper.h"
#include "pg/beeper_dev.h"
#include "pg/dashboard.h"
#include "pg/max7456.h"
#include "pg/pg.h"
#include "pg/pg_ids.h"

View file

@ -46,6 +46,7 @@
#include "config/feature.h"
#include "pg/pg.h"
#include "pg/pg_ids.h"
#include "pg/dashboard.h"
#include "fc/config.h"
#include "fc/controlrate_profile.h"
@ -71,14 +72,6 @@
#include "sensors/gyro.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 DISPLAY_UPDATE_FREQUENCY (MICROSECONDS_IN_A_SECOND / 5)

View file

@ -23,21 +23,16 @@
#define ENABLE_DEBUG_DASHBOARD_PAGE
#ifdef OLED_I2C_INSTANCE
#define DASHBOARD_I2C_INSTANCE OLED_I2C_INSTANCE
#if !defined(DASHBOARD_I2C_INSTANCE)
#if defined(I2C_DEVICE)
#define DASHBOARD_I2C_INSTANCE I2C_DEVICE
#else
#define DASHBOARD_I2C_INSTANCE I2CDEV_1
#define DASHBOARD_I2C_INSTANCE I2C_NONE
#endif
#endif
#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 {
PAGE_WELCOME,
PAGE_ARMED,

35
src/main/pg/dashboard.c Normal file
View 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
View 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);