Description
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
I had to use the register to change my pin state because of my timing requirement. I have most of it working but I can not get the input to release the state of the pin.
my goal is something like
set to output so I can hold pins high or low
set to input so I can read the start of an external pin.
I got the output working and my input is not, these are my defines.
#define PINPULLUP(p) asm volatile ("ee.setbitgpioout %0" : : "I"(p) : );
#define PIN_PULLDOWN(p) __asm __volatile ("ee.clr_bit_gpio_out %0" : : "I"(p) : );
#define PIN_MODE_OUTPUT(p) do { GPIO.enable_w1ts = (uint32_t)(1 << p); WRITE_PERI_REG((REG_IO_MUX_BASE + ( (p+1) * 4) ), (READ_PERI_REG(REG_IO_MUX_BASE + ( (p+1) * 4))|(1<<9))); } while (0);
#define PIN_MODE_INPUT(p) do { GPIO.enable_w1tc = (uint32_t)(1 << p); WRITE_PERI_REG((REG_IO_MUX_BASE + ( (p+1) * 4) ), (READ_PERI_REG(REG_IO_MUX_BASE + ( (p+1) * 4)) & ~(1<<9))); } while (0);
to write a pin state I do this
PIN_MODE_OUTPUT(1<<1);
then I can use either PIN_PULLDOWN or PIN_PULLUP
This works
to read I do
PIN_MODE_INPUT(1<<1);
but my wires stay low. and my external resister can not pull up. did I miss something?