SDK: 2.6.1
I needed to add a single wire support to our device recently and I did that by using two pins TX/RX shorted and UART. It works, but current consumption sky rockets because of the UART. After some googling I decided that putting uart to suspended state should be the correct thing to do to fix that.
// single wire communication is done const struct device* const dev = DEVICE_DT_GET(DT_NODELABEL(uart1)); ... int err = pm_device_action_run(dev, on ? PM_DEVICE_ACTION_RESUME : PM_DEVICE_ACTION_SUSPEND); ...
&pinctrl { ... uart1_default: uart1_default { group1 { psels = <NRF_PSEL(UART_RX, 0, 0)>; bias-pull-up; }; group2 { psels = <NRF_PSEL(UART_TX, 0, 3)>; /* max. 5mA drive strength: */ /*nordic,drive-mode = <NRF_DRIVE_H0D1>;*/ }; }; }; &arduino_serial { status = "okay"; w1_0: w1-zephyr-serial-0 { compatible = "zephyr,w1-serial"; #address-cells = <1>; #size-cells = <0>; status = "okay"; ds18b20 { compatible = "maxim,ds18b20"; family-code = <0x28>; resolution = <12>; status = "okay"; }; }; };
#define ENABLE_GAS_PIN 28 ... gpio_dev = DEVICE_DT_GET(DT_NODELABEL(gpio0)); err = gpio_pin_configure(gpio_dev, ENABLE_GAS_PIN, GPIO_OUTPUT_LOW | GPIO_ACTIVE_HIGH); ... err = gpio_pin_set(gpio_dev, ENABLE_GAS_PIN, 1);