Skip to content

Commit 00f4456

Browse files
pennamsoburi
authored andcommitted
core: pinmux: wrap peripheral init and deinit operations with CONFIG ifdefs
Co-Authored-by: pennam <m.pennasilico@arduino.cc> Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
1 parent 6627a2c commit 00f4456

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

cores/arduino/zephyrSerial.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ class ZephyrSerial : public HardwareSerial {
7676
}
7777

7878
void end() {
79+
#ifdef CONFIG_DEVICE_DEINIT_SUPPORT
7980
if (uart->ops.deinit) {
8081
uart->ops.deinit(uart);
8182
}
83+
#endif
8284
}
8385

8486
size_t write(const uint8_t *buffer, size_t size);

libraries/SPI/SPI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ void arduino::ZephyrSPI::begin() {
122122
}
123123

124124
void arduino::ZephyrSPI::end() {
125+
#ifdef CONFIG_DEVICE_DEINIT_SUPPORT
125126
if (spi_dev->ops.deinit) {
126127
spi_dev->ops.deinit(spi_dev);
127128
}
129+
#endif
128130
}
129131

130132
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), spis)

libraries/Wire/Wire.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ void arduino::ZephyrI2C::begin(uint8_t slaveAddr) {
2222
}
2323

2424
void arduino::ZephyrI2C::end() {
25+
#ifdef CONFIG_DEVICE_DEINIT_SUPPORT
2526
if (i2c_dev->ops.deinit) {
2627
i2c_dev->ops.deinit(i2c_dev);
2728
}
29+
#endif
2830
}
2931

3032
void arduino::ZephyrI2C::setClock(uint32_t freq) {

0 commit comments

Comments
 (0)