-
-
Notifications
You must be signed in to change notification settings - Fork 104
pbio/sys: Add Build HAT HMI that starts the status light animation. #499
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
Open
davelongdev
wants to merge
1
commit into
pybricks:master
Choose a base branch
from
davelongdev:buildhat-hmi-led
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+56
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| // Copyright (c) 2018-2026 The Pybricks Authors | ||
|
|
||
| // Provides the Human Machine Interface (HMI) for the Build HAT. | ||
| // There is nothing to select, so the REPL starts right after boot. | ||
|
|
||
| #include <pbsys/config.h> | ||
|
|
||
| #if PBSYS_CONFIG_HMI_BUILDHAT | ||
|
|
||
| #include <stdbool.h> | ||
| #include <stddef.h> | ||
| #include <stdint.h> | ||
|
|
||
| #include <pbio/button.h> | ||
| #include <pbio/light.h> | ||
| #include <pbio/os.h> | ||
| #include <pbsys/light.h> | ||
| #include <pbsys/main.h> | ||
| #include <pbsys/status.h> | ||
|
|
||
| void pbsys_hmi_init(void) { | ||
| } | ||
|
|
||
| void pbsys_hmi_deinit(void) { | ||
| } | ||
|
|
||
| void pbsys_hmi_stop_animation(void) { | ||
| } | ||
|
|
||
| void pbsys_hmi_connection_changed_handler(void) { | ||
| } | ||
|
|
||
| pbio_error_t pbsys_hmi_await_program_selection(void) { | ||
|
|
||
| do { | ||
| if (pbsys_status_test(PBIO_PYBRICKS_STATUS_SHUTDOWN_REQUEST)) { | ||
| return PBIO_ERROR_CANCELED; | ||
| } | ||
| pbio_os_run_processes_and_wait_for_event(); | ||
| } while (pbdrv_button_get_pressed()); | ||
|
|
||
| // Start the "ready" animation, same as hmi_pup.c does after program | ||
| // selection. | ||
| #if PBSYS_CONFIG_STATUS_LIGHT_STATE_ANIMATIONS | ||
| pbio_color_light_start_breathe_animation(pbsys_status_light_main, PBSYS_CONFIG_STATUS_LIGHT_STATE_ANIMATIONS_HUE); | ||
| #elif PBSYS_CONFIG_STATUS_LIGHT | ||
| pbio_color_light_off(pbsys_status_light_main); | ||
| #endif | ||
|
|
||
| return pbsys_main_program_request_start(PBIO_PYBRICKS_USER_PROGRAM_ID_REPL, PBSYS_MAIN_PROGRAM_START_REQUEST_TYPE_BOOT); | ||
| } | ||
|
|
||
| #endif // PBSYS_CONFIG_HMI_BUILDHAT | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Laurens said, we don't have a button on this hub, so we should be able to drop this loop.