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 RG_GPIO_LED_ACTIVE_LOW option #149

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add RG_GPIO_LED_ACTIVE_LOW option
On the Fri3d Camp 2024 badge, the RG_GPIO_LED is active low,
meaning it is on when the output is 0/low and off when the output
is 3V3/high.

Therefore, we need a way to invert the regular RG_GPIO_LED.

At first I used RG_GPIO_LED_INVERT but that is less descriptive
than RG_GPIO_LED_ACTIVE_LOW.
tomvanbraeckel committed Aug 4, 2024
commit 9d9028979c6614df6026b837f4decb7ad9678511
4 changes: 4 additions & 0 deletions components/retro-go/rg_system.c
Original file line number Diff line number Diff line change
@@ -887,7 +887,11 @@ void rg_system_set_led(int value)
{
#if defined(ESP_PLATFORM) && defined(RG_GPIO_LED)
if (app.ledValue != value)
#ifndef RG_GPIO_LED_ACTIVE_LOW
gpio_set_level(RG_GPIO_LED, value);
#else
gpio_set_level(RG_GPIO_LED, !value);
#endif
#endif
app.ledValue = value;
}
1 change: 1 addition & 0 deletions components/retro-go/targets/fri3d-2024/config.h
Original file line number Diff line number Diff line change
@@ -86,6 +86,7 @@

// Status LED
#define RG_GPIO_LED GPIO_NUM_21
#define RG_GPIO_LED_ACTIVE_LOW // setting RG_GPIO_LED low turns on the LED, while high turns it off

// Battery
#define RG_BATTERY_DRIVER 1