This repository was archived by the owner on Aug 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 77#include " Arduino.h"
88
99/*
10- * We have initialised all pins by default to pull down
11- * inorder to not have random floating voltages in pins
1210 * The ACTIVE_HIGH flag is set so that A low physical
1311 * level on the pin will be interpreted as value 0.
1412 * A high physical level will be interpreted as value 1
1513 */
1614void pinMode (pin_size_t pinNumber, PinMode pinMode) {
17- if (pinMode == INPUT || pinMode == INPUT_PULLDOWN) { // input mode
15+ if (pinMode == INPUT) { // input mode
16+ gpio_pin_configure_dt (arduino_pins[pinNumber],
17+ GPIO_INPUT | GPIO_ACTIVE_HIGH);
18+ } else if (pinMode == INPUT_PULLUP) { // input with internal pull-up
19+ gpio_pin_configure_dt (arduino_pins[pinNumber],
20+ GPIO_INPUT | GPIO_PULL_UP | GPIO_ACTIVE_HIGH);
21+ } else if (pinMode == INPUT_PULLDOWN) { // input with internal pull-down
1822 gpio_pin_configure_dt (arduino_pins[pinNumber],
1923 GPIO_INPUT | GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH);
20- } else { // output mode
24+ } else if (pinMode == OUTPUT) { // output mode
2125 gpio_pin_configure_dt (arduino_pins[pinNumber],
2226 GPIO_OUTPUT_LOW | GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH);
2327 }
You can’t perform that action at this time.
0 commit comments