Skip to content

Commit f0d895b

Browse files
committed
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 Signed-off-by: Winford <[email protected]>
1 parent c73a877 commit f0d895b

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)