Fixes and improvements (#534)
This commit is contained in:
committed by
GitHub
parent
a35c88c8fd
commit
e8b9a1f2a9
@@ -7,14 +7,14 @@ properties:
|
||||
type: int
|
||||
required: true
|
||||
description: "One of enum Esp32GroveMode"
|
||||
pinSdaRx:
|
||||
pinSdaTx:
|
||||
type: phandle-array
|
||||
required: true
|
||||
description: SDA (I2C) or RX (UART) pin
|
||||
pinSclTx:
|
||||
description: SDA (I2C) or TX (UART) pin
|
||||
pinSclRx:
|
||||
type: phandle-array
|
||||
required: true
|
||||
description: SCL (I2C) or TX (UART) pin
|
||||
description: SCL (I2C) or RX (UART) pin
|
||||
uartPort:
|
||||
type: int
|
||||
required: true
|
||||
|
||||
@@ -12,8 +12,8 @@ extern "C" {
|
||||
|
||||
struct Esp32GroveConfig {
|
||||
enum GroveMode defaultMode;
|
||||
struct GpioPinSpec pinSdaRx;
|
||||
struct GpioPinSpec pinSclTx;
|
||||
struct GpioPinSpec pinSdaTx;
|
||||
struct GpioPinSpec pinSclRx;
|
||||
uart_port_t uartPort;
|
||||
i2c_port_t i2cPort;
|
||||
uint32_t i2cClockFrequency;
|
||||
|
||||
@@ -108,8 +108,8 @@ static error_t start_child(Device* device, GroveMode mode) {
|
||||
}
|
||||
std::memset(uart_cfg, 0, sizeof(Esp32UartConfig));
|
||||
uart_cfg->port = config->uartPort;
|
||||
uart_cfg->pin_tx = config->pinSclTx;
|
||||
uart_cfg->pin_rx = config->pinSdaRx;
|
||||
uart_cfg->pin_rx = config->pinSclRx;
|
||||
uart_cfg->pin_tx = config->pinSdaTx;
|
||||
uart_cfg->pin_cts = GPIO_PIN_SPEC_NONE;
|
||||
uart_cfg->pin_rts = GPIO_PIN_SPEC_NONE;
|
||||
data->child_config = uart_cfg;
|
||||
@@ -131,8 +131,8 @@ static error_t start_child(Device* device, GroveMode mode) {
|
||||
std::memset(i2c_cfg, 0, sizeof(Esp32I2cMasterConfig));
|
||||
i2c_cfg->port = static_cast<i2c_port_num_t>(config->i2cPort);
|
||||
i2c_cfg->clockFrequency = config->i2cClockFrequency;
|
||||
i2c_cfg->pinSda = config->pinSdaRx;
|
||||
i2c_cfg->pinScl = config->pinSclTx;
|
||||
i2c_cfg->pinSda = config->pinSdaTx;
|
||||
i2c_cfg->pinScl = config->pinSclRx;
|
||||
// New driver seems to require pull-up setting
|
||||
i2c_cfg->pinSda.flags |= GPIO_FLAG_PULL_UP;
|
||||
i2c_cfg->pinScl.flags |= GPIO_FLAG_PULL_UP;
|
||||
|
||||
Reference in New Issue
Block a user