Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```
Expand All @@ -32,7 +32,7 @@ $ ln -s /<your>/<location>/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)
Expand Down
14 changes: 9 additions & 5 deletions cores/arduino/zephyrCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down