mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(gpio): add function allowing switching input source from GPIO back to IOMUX
This commit is contained in:
parent
bb1f3ae264
commit
1f085b1a3b
@ -547,3 +547,16 @@ esp_err_t gpio_hold_dis(gpio_num_t gpio_num)
|
||||
}
|
||||
return r == ESP_OK ? ESP_OK : ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
void gpio_iomux_in(uint32_t gpio, uint32_t signal_idx)
|
||||
{
|
||||
GPIO.func_in_sel_cfg[signal_idx].sig_in_sel = 0;
|
||||
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio]);
|
||||
}
|
||||
|
||||
void gpio_iomux_out(uint8_t gpio_num, int func, bool oen_inv)
|
||||
{
|
||||
GPIO.func_out_sel_cfg[gpio_num].oen_sel = 0;
|
||||
GPIO.func_out_sel_cfg[gpio_num].oen_inv_sel = oen_inv;
|
||||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], func);
|
||||
}
|
||||
|
@ -550,6 +550,22 @@ esp_err_t gpio_hold_en(gpio_num_t gpio_num);
|
||||
*/
|
||||
esp_err_t gpio_hold_dis(gpio_num_t gpio_num);
|
||||
|
||||
/**
|
||||
* @brief Set pad input to a peripheral signal through the IOMUX.
|
||||
* @param gpio_num GPIO number of the pad.
|
||||
* @param signal_idx Peripheral signal id to input. One of the ``*_IN_IDX`` signals in ``soc/gpio_sig_map.h``.
|
||||
*/
|
||||
void gpio_iomux_in(uint32_t gpio_num, uint32_t signal_idx);
|
||||
|
||||
/**
|
||||
* @brief Set peripheral output to an GPIO pad through the IOMUX.
|
||||
* @param gpio_num gpio_num GPIO number of the pad.
|
||||
* @param func The function number of the peripheral pin to output pin.
|
||||
* One of the ``FUNC_X_*`` of specified pin (X) in ``soc/io_mux_reg.h``.
|
||||
* @param oen_inv True if the output enable needs to be inversed, otherwise False.
|
||||
*/
|
||||
void gpio_iomux_out(uint8_t gpio_num, int func, bool oen_inv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user