Add gpio_set_function_mask function (#1462)

This commit is contained in:
George Peppard 2024-07-24 12:47:59 +01:00 committed by GitHub
parent af9b47c668
commit 7c5b426a0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -270,3 +270,11 @@ void gpio_init_mask(uint gpio_mask) {
}
}
void gpio_set_function_mask(uint gpio_mask, enum gpio_function fn) {
for (uint i = 0; i < NUM_BANK0_GPIOS; i++) {
if (gpio_mask & 1) {
gpio_set_function(i, fn);
}
gpio_mask >>= 1;
}
}

View File

@ -185,6 +185,15 @@ static inline void check_gpio_param(__unused uint gpio) {
*/
void gpio_set_function(uint gpio, enum gpio_function fn);
/*! \brief Select the function for multiple GPIOs
* \ingroup hardware_gpio
*
* \sa gpio_set_function
* \param gpio_mask Mask with 1 bit per GPIO number to set the function for
* \param fn Which GPIO function select to use from list \ref gpio_function
*/
void gpio_set_function_mask(uint gpio_mask, enum gpio_function fn);
/*! \brief Determine current GPIO function
* \ingroup hardware_gpio
*