mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2024-09-29 03:28:49 +08:00
Add gpio_set_function_mask function (#1462)
This commit is contained in:
parent
af9b47c668
commit
7c5b426a0f
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -185,6 +185,15 @@ static inline void check_gpio_param(__unused uint gpio) {
|
||||||
*/
|
*/
|
||||||
void gpio_set_function(uint gpio, enum gpio_function fn);
|
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
|
/*! \brief Determine current GPIO function
|
||||||
* \ingroup hardware_gpio
|
* \ingroup hardware_gpio
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user