Skip to content

Commit de16cf1

Browse files
committed
Merge pull request atomvm#604 from UncleGrumpy/gpio_bug_fix
Fix esp32 gpio:set_level/3 and gpio:digital_write/2 Fixes a problem in the esp32 gpio driver where if a numeric level is used (`0` or `1`) rather than atoms (`low` or `high`) the numeric input would be silently ignored. Closes issue atomvm#584 These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents c73a877 + f0d895b commit de16cf1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/platforms/esp32/components/avm_builtins/gpio_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static inline term gpio_digital_write(Context *ctx, term gpio_num_term, term lev
192192

193193
int level;
194194
if (term_is_integer(level_term)) {
195-
level = term_from_int(level_term);
195+
level = term_to_int32(level_term);
196196
if (UNLIKELY((level != 0) && (level != 1))) {
197197
return ERROR_ATOM;
198198
}

0 commit comments

Comments
 (0)