PORTS
Posted: Wed Mar 11, 2015 12:30 pm
I am having the most immense difficulty with PORTS - no doubt due to an utter mis-understanding.
I'm using the ESP-12 which has most of the ports brought out - including 3,4,12,13,14
I need to use the MACRO version of the port on-off control as I need precise speed for controlling serial LEDS
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(WSGPIO), 1 );
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(WSGPIO), 0 );
Assuming WSGPIO is 0 - I can turn GPIO0 on and off no problem - but I want to control GPIO12.
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(12), 1 );
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(12), 0 );
That DOESN'T WORK
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR, 0x1000 );
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR , 0 );
THat DOES work but it messes the OTHER port bits up.
I've also tried
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(12), 0x1000 );
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(12), 0 );
That doesn't work.
So can someone tell me - what the correct values are to control port GPIO12 - without messing up the other ports?
(all assuming the ports are set up as outputs in the first place and tested as outputs - which they are).
Pete.
I'm using the ESP-12 which has most of the ports brought out - including 3,4,12,13,14
I need to use the MACRO version of the port on-off control as I need precise speed for controlling serial LEDS
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(WSGPIO), 1 );
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(WSGPIO), 0 );
Assuming WSGPIO is 0 - I can turn GPIO0 on and off no problem - but I want to control GPIO12.
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(12), 1 );
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(12), 0 );
That DOESN'T WORK
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR, 0x1000 );
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR , 0 );
THat DOES work but it messes the OTHER port bits up.
I've also tried
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(12), 0x1000 );
WRITE_PERI_REG( PERIPHS_GPIO_BASEADDR + GPIO_ID_PIN(12), 0 );
That doesn't work.
So can someone tell me - what the correct values are to control port GPIO12 - without messing up the other ports?
(all assuming the ports are set up as outputs in the first place and tested as outputs - which they are).
Pete.