Separate pg related to pg directory

This commit is contained in:
jflyper 2018-02-05 00:35:51 +09:00
parent 1c3a3229ad
commit 93ce6e542a
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);