Skip to content

Commit

Permalink
Make I2C pullups and overclocking configurable for generic targets
Browse files Browse the repository at this point in the history
Update generic targets config files for I2C pullups
  • Loading branch information
MJ666 committed Dec 22, 2018
1 parent 131e32c commit 41390fd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/interface/settings.c
Expand Up @@ -69,6 +69,7 @@
#include "pg/adc.h"
#include "pg/beeper.h"
#include "pg/beeper_dev.h"
#include "pg/bus_i2c.h"
#include "pg/dashboard.h"
#include "pg/flash.h"
#include "pg/gyrodev.h"
Expand Down Expand Up @@ -1259,6 +1260,24 @@ const clivalue_t valueTable[] = {
{ "gyro_2_i2c_address", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, I2C_ADDR7_MAX }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_ELEMENT_OFFSET(gyroDeviceConfig_t, 1, i2cAddress) },
{ "gyro_2_sensor_align", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_ALIGNMENT }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_ELEMENT_OFFSET(gyroDeviceConfig_t, 1, align) },
#endif
#ifdef I2C_FULL_RECONFIGURABILITY
#ifdef USE_I2C_DEVICE_1
{ "i2c1_pullup", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_I2C_CONFIG, PG_ARRAY_ELEMENT_OFFSET(i2cConfig_t, 0, pullUp) },
{ "i2c1_overclock", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_I2C_CONFIG, PG_ARRAY_ELEMENT_OFFSET(i2cConfig_t, 0, overClock) },
#endif
#ifdef USE_I2C_DEVICE_2
{ "i2c2_pullup", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_I2C_CONFIG, PG_ARRAY_ELEMENT_OFFSET(i2cConfig_t, 1, pullUp) },
{ "i2c2_overclock", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_I2C_CONFIG, PG_ARRAY_ELEMENT_OFFSET(i2cConfig_t, 1, overClock) },
#endif
#ifdef USE_I2C_DEVICE_3
{ "i2c3_pullup", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_I2C_CONFIG, PG_ARRAY_ELEMENT_OFFSET(i2cConfig_t, 2, pullUp) },
{ "i2c3_overclock", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_I2C_CONFIG, PG_ARRAY_ELEMENT_OFFSET(i2cConfig_t, 2, overClock) },
#endif
#ifdef USE_I2C_DEVICE_4
{ "i2c4_pullup", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_I2C_CONFIG, PG_ARRAY_ELEMENT_OFFSET(i2cConfig_t, 3, pullUp) },
{ "i2c4_overclock", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_I2C_CONFIG, PG_ARRAY_ELEMENT_OFFSET(i2cConfig_t, 3, overClock) },
#endif
#endif
#ifdef USE_MCO
{ "mco2_on_pc9", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MCO_CONFIG, offsetof(mcoConfig_t, enabled[1]) },
#endif
Expand Down
1 change: 1 addition & 0 deletions src/main/target/STM32F405/config/ALIENFLIGHTNGF4.config
Expand Up @@ -13,6 +13,7 @@ set beeper_od = OFF
# Buses
resource I2C_SCL 1 B06
resource I2C_SDA 1 B07
set i2c1_pullup = ON

resource SPI_SCK 1 A05
resource SPI_MISO 1 A06
Expand Down
1 change: 1 addition & 0 deletions src/main/target/STM32F7X2/config/ALIENFLIGHTNGF7.config
Expand Up @@ -13,6 +13,7 @@ set beeper_od = OFF
# Buses
resource I2C_SCL 1 B06
resource I2C_SDA 1 B07
set i2c1_pullup = ON

resource SPI_SCK 1 A05
resource SPI_MISO 1 A06
Expand Down
Expand Up @@ -13,6 +13,7 @@ set beeper_od = OFF
# Buses
resource I2C_SCL 1 B06
resource I2C_SDA 1 B07
set i2c1_pullup = ON

resource SPI_SCK 1 A05
resource SPI_MISO 1 A06
Expand Down

0 comments on commit 41390fd

Please sign in to comment.