Skip to content

Commit 1283290

Browse files
authored
Merge pull request #394 from pillo79/remove-dynamic-pinctrl
loader: remove unnecessary PINCTRL_DYNAMIC
2 parents 84f52df + b7c0850 commit 1283290

6 files changed

Lines changed: 1 addition & 19 deletions

File tree

cores/arduino/zephyrCommon.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <Arduino.h>
88
#include "zephyrInternal.h"
99

10-
#ifdef CONFIG_PINCTRL_DYNAMIC
1110
// create an array of arduino_pins with functions to reinitialize pins if needed
1211
static const struct device *pinmux_array[DT_PROP_LEN(DT_PATH(zephyr_user), digital_pin_gpios)] = {
1312
nullptr};
@@ -20,7 +19,6 @@ void _reinit_peripheral_if_needed(pin_size_t pin, const struct device *dev) {
2019
}
2120
}
2221
}
23-
#endif
2422

2523
static const struct gpio_dt_spec arduino_pins[] = {
2624
DT_FOREACH_PROP_ELEM_SEP(
@@ -224,9 +222,7 @@ void yield(void) {
224222
* A high physical level will be interpreted as value 1
225223
*/
226224
void pinMode(pin_size_t pinNumber, PinMode pinMode) {
227-
#ifdef CONFIG_PINCTRL_DYNAMIC
228225
_reinit_peripheral_if_needed(pinNumber, NULL);
229-
#endif
230226
if (pinMode == INPUT) { // input mode
231227
gpio_pin_configure_dt(&arduino_pins[pinNumber], GPIO_INPUT | GPIO_ACTIVE_HIGH);
232228
} else if (pinMode == INPUT_PULLUP) { // input with internal pull-up
@@ -330,9 +326,7 @@ void analogWrite(pin_size_t pinNumber, int value) {
330326
return;
331327
}
332328

333-
#ifdef CONFIG_PINCTRL_DYNAMIC
334329
_reinit_peripheral_if_needed(pinNumber, arduino_pwm[idx].dev);
335-
#endif
336330
value = map(value, 0, 1 << _analog_write_resolution, 0, arduino_pwm[idx].period);
337331

338332
if (((uint32_t)value) > arduino_pwm[idx].period) {
@@ -358,9 +352,7 @@ void analogWrite(enum dacPins dacName, int value) {
358352

359353
// TODO: add reverse map to find pin name from DAC* define
360354
// In the meantime, consider A0 == DAC0
361-
#ifdef CONFIG_PINCTRL_DYNAMIC
362355
_reinit_peripheral_if_needed((pin_size_t)(dacName + A0), dac_dev);
363-
#endif
364356
dac_channel_setup(dac_dev, &dac_ch_cfg[dacName]);
365357

366358
const int max_dac_value = 1U << dac_ch_cfg[dacName].resolution;
@@ -411,9 +403,8 @@ int analogRead(pin_size_t pinNumber) {
411403
return -ENOTSUP;
412404
}
413405

414-
#ifdef CONFIG_PINCTRL_DYNAMIC
415406
_reinit_peripheral_if_needed(pinNumber, arduino_adc[idx].dev);
416-
#endif
407+
417408
err = adc_channel_setup(arduino_adc[idx].dev, &arduino_adc[idx].channel_cfg);
418409
if (err < 0) {
419410
return err;

cores/arduino/zephyrInternal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ extern "C" {
1414

1515
void enableInterrupt(pin_size_t);
1616
void disableInterrupt(pin_size_t);
17-
#ifdef CONFIG_PINCTRL_DYNAMIC
1817
void _reinit_peripheral_if_needed(pin_size_t pin, const struct device *dev);
19-
#endif
2018

2119
#ifdef __cplusplus
2220
} // extern "C"

cores/arduino/zephyrSerial.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ void arduino::ZephyrSerial::begin(unsigned long baud, uint16_t conf) {
5959
.flow_ctrl = UART_CFG_FLOW_CTRL_NONE,
6060
};
6161

62-
#ifdef CONFIG_PINCTRL_DYNAMIC
6362
uart->ops.init(uart);
64-
#endif
6563

6664
uart_configure(uart, &config);
6765
uart_irq_callback_user_data_set(uart, arduino::ZephyrSerial::IrqDispatch, this);

libraries/SPI/SPI.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ void arduino::ZephyrSPI::detachInterrupt() {
115115
}
116116

117117
void arduino::ZephyrSPI::begin() {
118-
#ifdef CONFIG_PINCTRL_DYNAMIC
119118
spi_dev->ops.init(spi_dev);
120-
#endif
121119
}
122120

123121
void arduino::ZephyrSPI::end() {

libraries/Wire/Wire.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ arduino::ZephyrI2C::ZephyrI2C(const struct device *i2c) : i2c_cfg({0}), i2c_dev(
5757
}
5858

5959
void arduino::ZephyrI2C::begin() {
60-
#ifdef CONFIG_PINCTRL_DYNAMIC
6160
i2c_dev->ops.init(i2c_dev);
62-
#endif
6361
}
6462

6563
void arduino::ZephyrI2C::begin(uint8_t slaveAddr) {

loader/prj.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ CONFIG_LLEXT_EDK_FORMAT_TAR_ZSTD=y
2727
CONFIG_GPIO=y
2828
CONFIG_GPIO_GET_DIRECTION=y
2929
CONFIG_PINCTRL=y
30-
CONFIG_PINCTRL_DYNAMIC=y
3130
CONFIG_DEVICE_DEINIT_SUPPORT=y
3231
CONFIG_I2C=y
3332
CONFIG_SPI=y

0 commit comments

Comments
 (0)