Update ESP32 GPIO driver errors to match other MCU platforms
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.
Adds gpio driver tests to the Wokwi sim to test driver functionality and error return correctness for invalid parameters.
With #1448 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
do we need to remove RISING_ATOM_INDEX et al in platform_defaultatoms.h ?https://github.com/atomvm/AtomVM/blob/63ba9663df3908e72bef8039f018b41ee465e568/src/platforms/esp32/components/avm_sys/include/platform_defaultatoms.h#L28
do we need to remove RISING_ATOM_INDEX et al in platform_defaultatoms.h ?
https://github.com/atomvm/AtomVM/blob/63ba9663df3908e72bef8039f018b41ee465e568/src/platforms/esp32/components/avm_sys/include/platform_defaultatoms.h#L28
This is done in commit bede918
My mistake, you are correct! Those changes should have been included in the commit I mentioned, but were not added. Correction has been pushed.
LGTM, but assume it needs rebasing to new defaultatoms setup.
Indeed. I also realized that I should be using port_create_error_tuple, and remove the unnecessary error_tuple_maybe_gc and update/remove the usage of create_pair as well.
All fixed. This should be ready now. We needed to keep create_pair, because we need to preserve a root, if gc is necessary.
Please, see also #1442
Please, see also #1442
I believe I have followed the guidelines you laid out in #1442, and the comments you made above about atom creation and fixed all of the atoms used by the driver to insure they are created in a safe way. I also used ATOM_STR() inline, removing the const char* declarations.