Skip to content
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

Updates to ESP32 GPIO driver to match other MCU platforms #1408

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

UncleGrumpy
Copy link
Collaborator

@UncleGrumpy UncleGrumpy commented Dec 21, 2024

These changes move the GPIO specific atoms out of the ESP32 platform default atoms (created at boot) into the GPIO driver where they are only created as needed.

Breaking changes update the error returns to match the spec. Nifs raise Error, and port functions return {error, Reason} when errors are encountered.

Closes #894

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

@petermm
Copy link
Contributor

petermm commented Dec 21, 2024

do we need to remove RISING_ATOM_INDEX et al in platform_defaultatoms.h ?

#define RISING_ATOM_INDEX (PLATFORM_ATOMS_BASE_INDEX + 2)

@UncleGrumpy
Copy link
Collaborator Author

do we need to remove RISING_ATOM_INDEX et al in platform_defaultatoms.h ?

#define RISING_ATOM_INDEX (PLATFORM_ATOMS_BASE_INDEX + 2)

This is done in commit bede918

…river.c

Moves the atoms only needed by the GPIO driver out of ESP32 platform_defaultatoms.h and into the
gpio driver, where they are created as needed at runtime.

Signed-off-by: Winford <[email protected]>
@UncleGrumpy
Copy link
Collaborator Author

My mistake, you are correct! Those changes should have been included in the commit I mentioned, but were not added. Correction has been pushed.

@UncleGrumpy UncleGrumpy marked this pull request as ready for review December 21, 2024 23:32
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return {error, Reason} from gpio operations in error conditions
2 participants