GPIO16 support.
This commit is contained in:
parent
c9851e9253
commit
c52890eed7
2 changed files with 27 additions and 4 deletions
|
|
@ -5,9 +5,26 @@
|
|||
* BSD Licensed as described in the file LICENSE
|
||||
*/
|
||||
#include <esp/gpio.h>
|
||||
#include <esp/rtc_regs.h>
|
||||
|
||||
void gpio_enable(const uint8_t gpio_num, const gpio_direction_t direction)
|
||||
{
|
||||
if (gpio_num == 16) {
|
||||
RTC.GPIO_CFG[3] = (RTC.GPIO_CFG[3] & 0xffffffbc) | 1;
|
||||
RTC.GPIO_CONF = (RTC.GPIO_CONF & 0xfffffffe) | 0;
|
||||
switch (direction) {
|
||||
case GPIO_INPUT:
|
||||
RTC.GPIO_ENABLE = (RTC.GPIO_OUT & 0xfffffffe);
|
||||
break;
|
||||
case GPIO_OUTPUT:
|
||||
case GPIO_OUT_OPEN_DRAIN:
|
||||
/* TODO open drain? */
|
||||
RTC.GPIO_ENABLE = (RTC.GPIO_OUT & 0xfffffffe) | 1;
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
switch (direction) {
|
||||
case GPIO_INPUT:
|
||||
GPIO.ENABLE_OUT_CLEAR = BIT(gpio_num);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue