diff --git a/README.md b/README.md index 77f596268..cfc9830e4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Arduino Core API module for zephyr leverages the power of Zephyr under an Arduin ## Adding Arduino Core API to Zephyr -* **Pre requisites:** It is assumed that you have zephyrproject configured and installed on your system as per the official [Get Started Guide](https://docs.zephyrproject.org/latest/develop/getting_started/index.html). The recommended path to install is `~/zephyrproject` as specified in the guide. You may face path issues if you have zephyr installed in a custom path. +* **Pre requisites:** It is assumed that you have zephyrproject configured and installed on your system as per the official [Get Started Guide](https://docs.zephyrproject.org/latest/develop/getting_started/index.html). The recommended path to install is `~/zephyrproject` as specified in the guide. If you have zephyr installed in a custom path you may need to make changes to the CMakeLists.txt file in the sample code directory when building these samples. * Add following entry to `west.yml` file in `manifest/projects` subtree of Zephyr: ``` @@ -32,7 +32,7 @@ $ ln -s ///ArduinoCore-API/api cores/arduino/. ``` **Known Bug(s):** -* While compiling with the ArduinoCore-API `WCharacter.h` produces many errors. It needs to be deleted from ArduinoAPI.h (it is unused in this port.) We are looking into resolving the issue. +* While compiling with the ArduinoCore-API `WCharacter.h` produces many errors. The include of that file needs to be deleted from `cores/arduino/api/ArduinoAPI.h` (it is unused in this port.) We are looking into resolving the issue. **Maintainers**: - [beriberikix](https://github.com/beriberikix) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index da32a5201..a9c053b1e 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -7,19 +7,23 @@ #include "Arduino.h" /* - * We have initialised all pins by default to pull down - * inorder to not have random floating voltages in pins * The ACTIVE_HIGH flag is set so that A low physical * level on the pin will be interpreted as value 0. * A high physical level will be interpreted as value 1 */ void pinMode(pin_size_t pinNumber, PinMode pinMode) { - if (pinMode == INPUT || pinMode == INPUT_PULLDOWN) { // input mode + if (pinMode == INPUT) { // input mode + gpio_pin_configure_dt(arduino_pins[pinNumber], + GPIO_INPUT | GPIO_ACTIVE_HIGH); + } else if (pinMode == INPUT_PULLUP) { // input with internal pull-up + gpio_pin_configure_dt(arduino_pins[pinNumber], + GPIO_INPUT | GPIO_PULL_UP | GPIO_ACTIVE_HIGH); + } else if (pinMode == INPUT_PULLDOWN) { // input with internal pull-down gpio_pin_configure_dt(arduino_pins[pinNumber], GPIO_INPUT | GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH); - } else { // output mode + } else if (pinMode == OUTPUT) { // output mode gpio_pin_configure_dt(arduino_pins[pinNumber], - GPIO_OUTPUT_LOW | GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH); + GPIO_OUTPUT_LOW | GPIO_ACTIVE_HIGH); } }