-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return {error, Reason} from gpio
operations in error conditions
#894
Comments
Complete rewrite of the stm32 gpio driver using updated APIs. Moves all GPIO related atoms from `platform_defaultatoms.{c,h}` into `gpio_driver.c` Improved input validation. Adds read support port driver. Adds nif functions to support read and write. Adds cmake configuration options to disable nifs and/or port driver when building the VM. Closes atomvm#571 Addresses atomvm#894 on STM32 platform. Signed-off-by: Winford <[email protected]>
Complete rewrite of the stm32 gpio driver using updated APIs. Moves all GPIO related atoms from `platform_defaultatoms.{c,h}` into `gpio_driver.c` Improved input validation. Adds read support port driver. Adds nif functions to support read and write. Adds cmake configuration options to disable nifs and/or port driver when building the VM. Closes atomvm#571 Addresses atomvm#894 on STM32 platform. Signed-off-by: Winford <[email protected]>
Complete rewrite of the stm32 gpio driver using updated APIs. Moves all GPIO related atoms from `platform_defaultatoms.{c,h}` into `gpio_driver.c` Improved input validation. Adds read support port driver. Adds nif functions to support read and write. Adds cmake configuration options to disable nifs and/or port driver when building the VM. Closes atomvm#571 Addresses atomvm#894 on STM32 platform. Signed-off-by: Winford <[email protected]>
Complete rewrite of the stm32 gpio driver using updated APIs. Moves all GPIO related atoms from `platform_defaultatoms.{c,h}` into `gpio_driver.c` Improved input validation. Adds read support port driver. Adds nif functions to support read and write. Adds cmake configuration options to disable nifs and/or port driver when building the VM. Closes atomvm#571 Addresses atomvm#894 on STM32 platform. Signed-off-by: Winford <[email protected]>
Update error returns from the gpio driver to return {error, Reason} rather than just an uninformative `error`. This will complete rp2040 platform requiremments to satisfy the ongoing meta issue atomvm#894. Signed-off-by: Winford <[email protected]>
Update error returns from the gpio driver to return {error, Reason} rather than just an uninformative `error`. This will complete rp2040 platform requiremments to satisfy the ongoing meta issue atomvm#894. Signed-off-by: Winford <[email protected]>
Update error returns from the gpio driver to return {error, Reason} rather than just an uninformative `error`. This will complete rp2040 platform requiremments to satisfy the ongoing meta issue atomvm#894. Signed-off-by: Winford <[email protected]>
We definitely need to align semantics of gpio module across platforms. |
I agree on badarg errors as well. Let’s take a look at patterns in OTP for guidance on expected behavior. |
In almost all cases |
Changes error returns to match the spec and ofther platforms. Nifs now raise any errors, and port function errors return `{error, Reason}`. Closes atomvm#894 Signed-off-by: Winford <[email protected]>
Changes error returns to match the spec and ofther platforms. Nifs now raise any errors, and port function errors return `{error, Reason}`. Closes atomvm#894 Signed-off-by: Winford <[email protected]>
Changes error returns to match the spec and ofther platforms. Nifs now raise any errors, and port function errors return `{error, Reason}`. Closes atomvm#894 Signed-off-by: Winford <[email protected]>
Changes error returns to match the spec and ofther platforms. Nifs now raise any errors, and port function errors return `{error, Reason}`. Updates gpio.erl to reflect the correct returns, and make it more clear that errors for nifs will be raised. Closes atomvm#894 Signed-off-by: Winford <[email protected]>
Changes error returns to match the spec and ofther platforms. Nifs now raise any errors, and port function errors return `{error, Reason}`. Updates gpio.erl to reflect the correct returns, and make it more clear that errors for nifs will be raised. Closes atomvm#894 Signed-off-by: Winford <[email protected]>
Changes error returns to match the spec and ofther platforms. Nifs now raise any errors, and port function errors return `{error, Reason}`. Updates gpio.erl to reflect the correct returns, and make it more clear that errors for nifs will be raised. Closes atomvm#894 Signed-off-by: Winford <[email protected]>
The AtomVM
gpio
interface returns bareerror
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()}
, whereReason
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 text was updated successfully, but these errors were encountered: