The AtomVM gpio interface returns bare error atoms in error conditions, which can make it difficult to diagnose why an error occurred.
We need to change the return type of these operations from error to {error, Reason :: term()}, where Reason is an appropriate term that can be used for logging or even for a program to take action.
The following functions need to be modified:
gpio:close/0
gpio:stop/0
gpio:set_direction/3
gpio:set_level/3
gpio:set_int/3
gpio:remove_int/2
gpio:set_pin_mode/2
gpio:set_pull_mode/2
gpio:hold_en/1
gpio:hold_dis/1
gpio:digital_write/2
gpio:attach_interrupt/2
gpio:detach_interrupt/1
The AtomVM
gpiointerface returns bareerroratoms in error conditions, which can make it difficult to diagnose why an error occurred.We need to change the return type of these operations from
errorto{error, Reason :: term()}, whereReasonis an appropriate term that can be used for logging or even for a program to take action.The following functions need to be modified:
gpio:close/0gpio:stop/0gpio:set_direction/3gpio:set_level/3gpio:set_int/3gpio:remove_int/2gpio:set_pin_mode/2gpio:set_pull_mode/2gpio:hold_en/1gpio:hold_dis/1gpio:digital_write/2gpio:attach_interrupt/2gpio:detach_interrupt/1