I started playing around with Arduino for work about two years ago and have quite enjoyed it. It was my first exposure to a C style language so there was quite a learning curve at the beginning. I've reached the stage where I used direct manipulation of the registers to control some things- for instance I built a controller for a 3 axis touch probe machine, in which I wrote directly to the registers related to three of the Timers, along with setting up interrupts for the timers, to drive the three stepper motors. As an example the code looked something like this:
Code: Select all
TCCR0A = 0x102; //Timer0 CTC mode, A clear on match
TCCR0B = 0x1; //Timer0 clock = no prescaler
OCR0A = 0xF8; //Timer0 count up to value
I stumbled on the ESP32 recently and it looks great. I love the speed, connectivity options and the RMT module. I also like the fact that it can be programmed from the Arduino IDE. I've bought a Heltec WifiKit32 and have successfully gotten it working and had a bit of a play with it, writing to the onboard OLED etc. So far, so good.
The trouble comes when I try to use the RMT. I've read through the Technical Reference and the Datasheet and feel that I've got a reasonable understanding of how to make the RMT work. The trouble is, if I try to set one of the configuration registers I get an error. For example here I'll use the RMT_TX_START_CH0 register, which is set to 1 to start the RMT module channel 0 to start transmitting:
Code: Select all
RMT_TX_START_CH1 = 1;
If I try to compile a sketch with this it gives the following error:
lvalue required as left operand of assignment
This is where I get a bit lost. Since all that I've learned of C comes from Arduino I know that I've got holes in my knowledge and this is one of them. Is there some other syntax I should be using to write the configuration registers? Do I have to do something else since the registers here are 32bit rather than 8?
I'm pretty lost at sea here, any help would be greatly appreciated.