Where can I find more information about timer1 and timer2?
Posted: Tue Mar 27, 2018 9:48 am
It was told, that PWM and tone don't work at the same time. It was told also, that tone can only make sound for one pin. But I implemented an example for PWM and tone at the same time and tone with several channels in stereo. I could offer a library with functions for PWM and tone at the same time and tone with several channels. But another solution could be to do a very small change in the core libraries. PWM uses timer1 and tone uses timer1, which causes a problem. But why shouldn't timer2 be used for tone? My question is, what for is timer2 used, because it does exist seemingly. Ich found these registers:
see: https://gitlab.com/alfredynho/AgroSis/b ... 266_peri.h
But it wouldn't matter, if timer2 would be reserved for internal functionalities und shouldn't be used for implementation purposes. My thought is, to implement virtual timers, which are based on only one hardware timer. So PWM could use the virtual timer timer1 and tone the vitual timer timer2. For doing so, I would like to get more information about the timers and the registers. Does somebody know, where I may find more information?
Code: Select all
//Timer 1 Registers (23bit CountDown Timer)
#define T1L ESP8266_REG(0x600) //Load Value (Starting Value of Counter) 23bit (0-8388607)
#define T1V ESP8266_REG(0x604) //(RO) Current Value
#define T1C ESP8266_REG(0x608) //Control Register
#define T1I ESP8266_REG(0x60C) //Interrupt Status Register (1bit) write to clear
//edge interrupt enable register
#define TEIE ESP8266_DREG(0x04)
#define TEIE1 0x02 //bit for timer 1
//Timer 2 Registers (32bit CountUp Timer)
#define T2L ESP8266_REG(0x620) //Load Value (Starting Value of Counter)
#define T2V ESP8266_REG(0x624) //(RO) Current Value
#define T2C ESP8266_REG(0x628) //Control Register
#define T2I ESP8266_REG(0x62C) //Interrupt Status Register (1bit) write to clear
#define T2A ESP8266_REG(0x630) //Alarm Value
see: https://gitlab.com/alfredynho/AgroSis/b ... 266_peri.h
But it wouldn't matter, if timer2 would be reserved for internal functionalities und shouldn't be used for implementation purposes. My thought is, to implement virtual timers, which are based on only one hardware timer. So PWM could use the virtual timer timer1 and tone the vitual timer timer2. For doing so, I would like to get more information about the timers and the registers. Does somebody know, where I may find more information?