-
Notifications
You must be signed in to change notification settings - Fork 1.3k
applications: nrf5340_audio: Ensure button names are printed in a standard manner #22459
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
applications: nrf5340_audio: Ensure button names are printed in a standard manner #22459
Conversation
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 277e447130f61649440b5b5ad67679ffeab10dca more detailssdk-nrf:
Github labels
List of changed files detected by CI (2)
Outputs:ToolchainVersion: 4aa3467a6d Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
You can find the documentation preview for this PR here. |
.name = STRINGIFY(BUTTON_##button_node_id), \ | ||
.gpio = GPIO_DT_SPEC_GET(button_node_id, gpios), \ | ||
}, | ||
.name = BUTTON_NAME(DT_GPIO_PIN(button_node_id, gpios)), \ |
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.
I don't see what this change does. It seems to me that line 53-60 does the same as stringify would do?
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.
The STRINGIFY does not expand the enclosed macro. In the above the replacement happens before the STRINGIFY but I need to select a string at the preprocessor stage that matches the required name. Therefore the BUTTON_NAME macro compares the pin number of the button with the node being parsed. This will then detect the correct string for the name.
The pins for each button are different for each DK and hence I need a way to select which button does what. This approach also allows the action of the button to be changed in the assignment file (e.g. sw0 volume down could be sw2 instead).
* | ||
* @return 0 if success, an error code otherwise. | ||
*/ | ||
int button_handler_pin_to_name(gpio_pin_t button_pin, char **button_name); |
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.
Nice, but this is not called anywhere.
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.
I did have this as a helper function, but removed as no longer needed.
47fec87
to
191151f
Compare
2e00bc9
to
de86161
Compare
Assign the button names dependent on the GPIO pin, so as to match the button correctly to it's name across multiple boards. Signed-off-by: Graham Wacey <[email protected]>
de86161
to
277e447
Compare
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.
Prints the button-names correctly on nRF5340 audio devkit now
OCT-3382
Assign the button names dependent on the GPIO pin, so as to match the button correctly to it's name across multiple boards.
Included a new API to convert a pin number to it's name string.