Skip to content

Return {error, Reason} from gpio operations in error conditions #894

Open
@fadushin

Description

@fadushin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change has the potential to break existing applicationslib:eavmlibErlang AtomVM library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions