Add gpio_deinit (#793)

This commit is contained in:
bruelltuete 2022-05-03 17:46:27 +01:00 committed by GitHub
parent c66a2c1c3b
commit 76c1830aeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -217,6 +217,10 @@ void gpio_init(uint gpio) {
gpio_set_function(gpio, GPIO_FUNC_SIO);
}
void gpio_deinit(uint gpio) {
gpio_set_function(gpio, GPIO_FUNC_NULL);
}
void gpio_init_mask(uint gpio_mask) {
for(uint i=0;i<32;i++) {
if (gpio_mask & 1) {

View File

@ -414,6 +414,13 @@ void gpio_acknowledge_irq(uint gpio, uint32_t events);
*/
void gpio_init(uint gpio);
/*! \brief Resets a GPIO back to the NULL function, i.e. disables it.
* \ingroup hardware_gpio
*
* \param gpio GPIO number
*/
void gpio_deinit(uint gpio);
/*! \brief Initialise multiple GPIOs (enabled I/O and set func to GPIO_FUNC_SIO)
* \ingroup hardware_gpio
*