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

Add gpio:set_int/4 for ESP32 and STM32 #837

Merged
merged 1 commit into from
Dec 23, 2023

Conversation

UncleGrumpy
Copy link
Collaborator

@UncleGrumpy UncleGrumpy commented Oct 4, 2023

Allows setting the pid() or registered name of the process to receive gpio_interrupt messages as the fourth parameter of gpio:set_int/4, with both ESP32 and STM32 GPIO port drivers.

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

@UncleGrumpy UncleGrumpy force-pushed the gpio.set_int-4 branch 2 times, most recently from 134e7d7 to c885897 Compare October 14, 2023 06:21
@UncleGrumpy UncleGrumpy force-pushed the gpio.set_int-4 branch 3 times, most recently from 4ff1271 to 76f17c6 Compare October 26, 2023 07:03
@UncleGrumpy UncleGrumpy marked this pull request as ready for review October 26, 2023 10:15
@UncleGrumpy UncleGrumpy marked this pull request as draft October 29, 2023 12:54
@UncleGrumpy UncleGrumpy marked this pull request as ready for review December 4, 2023 00:28
@UncleGrumpy UncleGrumpy force-pushed the gpio.set_int-4 branch 2 times, most recently from 5d0d821 to f5858ae Compare December 4, 2023 01:03
Copy link
Collaborator

@fadushin fadushin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A potential memory issue in the STM32 driver, some trivial indentation changes, and a suggestion for error returns in the ESP32 driver.

src/platforms/stm32/src/lib/gpio_driver.c Show resolved Hide resolved
@@ -581,44 +602,37 @@ static term nif_gpio_digital_read(Context *ctx, int argc, term argv[])
return gpio_digital_read(argv[0]);
}

static const struct Nif gpio_set_pin_mode_nif =
{
static const struct Nif gpio_set_pin_mode_nif = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this an editor doing auto-indent? We should probably restore this to the convention of curly braces on new lines for struct declarations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I had a CI format failure and ran clang-format-16 on the file... this was the result. I hadn't noticed that, I'll fix it.

Copy link
Collaborator

@fadushin fadushin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one request for a TODO in the code, and maybe reference issue #894 in GitHub

@UncleGrumpy UncleGrumpy force-pushed the gpio.set_int-4 branch 2 times, most recently from dd54017 to e23d60d Compare December 8, 2023 16:46
@UncleGrumpy
Copy link
Collaborator Author

Just one request for a TODO in the code, and maybe reference issue #894 in GitHub

Done. And I added a TODO to move the GPIO atoms from platform_defaultatoms into the gpio_driver.

@UncleGrumpy UncleGrumpy force-pushed the gpio.set_int-4 branch 4 times, most recently from 7d0025f to bec6698 Compare December 14, 2023 04:20
Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind squashing all the changes here?

Allows setting the pid() or registered name of the process to receive GPIO
interrupt messages as the fourth parameter of `gpio:set_int/4`, for both
ESP32 and STM32 GPIO port drivers.

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

Not at all. Done.

@bettio bettio merged commit 9839e23 into atomvm:master Dec 23, 2023
77 of 83 checks passed
@UncleGrumpy UncleGrumpy deleted the gpio.set_int-4 branch December 31, 2023 19:37
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.

3 participants