diff --git a/README.md b/README.md index af5460e..4cec916 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,15 @@ Set input clock divider and Turbo Mode (which uses a 96MHz instead of a 48Mhz in ```pwm.setClockDivider([1-255], [true, false]);``` -**Initialise timer x, with prescaler, with steps (resolution), with fast aka single-slope PWM (or not -> double-slope PWM):** +**Initialize timer x, with prescaler, with steps (resolution), with fast aka single-slope PWM (or not -> double-slope PWM):** ```pwm.timer([0, 1, 2], [1, 2, 4, 8, 16, 64, 256, 1024], [2-MaxSteps], [true, false]);``` -* For the Arduino Nano 33 IoT, you need to initialise timer 1 for pins 4 and 7, timer 0 for pins 5, 6, 8, and 12, and timer 2 for pins 11 and 13; -* For the Arduino Zero (untested), Adafruit Feather M0 (untested), and Adafruit Itsy Bitsy M0 you need to initialise timer 0 for pins 3, 4, 10 and 12, timer 1 for pins 8 and 9, and timer 2 for pins 11 and 13; -* For the Arduino MKR series (untested), you need to initialise timer 1 for pins 2 and 3, timer 0 for pins 4, 5, 6 and 7, and timer 2 for pins 8 and 9; -* For the Adafruit Trinket M0, you need to initialise timer 0 for pins 0 and 2, and timer 1 for pins 3 and 4. +* For the Arduino Nano 33 IoT, you need to initialize timer 1 for pins 4 and 7, timer 0 for pins 5, 6, 8, and 12, and timer 2 for pins 11 and 13; +* For the Arduino Zero (untested), Adafruit Feather M0 (untested), and Adafruit Itsy Bitsy M0 you need to initialize timer 0 for pins 3, 4, 10 and 12, timer 1 for pins 8 and 9, and timer 2 for pins 11 and 13; +* For the Arduino MKR series (untested), you need to initialize timer 1 for pins 2 and 3, timer 0 for pins 4, 5, 6 and 7, and timer 2 for pins 8 and 9; +* For the Adafruit Trinket M0, you need to initialize timer 0 for pins 0 and 2, and timer 1 for pins 3 and 4. +* For the Adafruit QtPy M0, you need to initialize timer 0 for pins 2, 3, 8, and 10. Timer 1 for pins 6, 7, and 9. Timer 2 for pins 4 and 5. **Note** that pins 7 & 9 share a capture and compare buffer (CCB1) so you can't get different PWM duty cycles from them at the same time. MaxSteps is 0xFFFFFF for (24-bits) timers 0 and 1, and 0xFFFF for (16 bits) timer 2. diff --git a/src/SAMD21turboPWM.h b/src/SAMD21turboPWM.h index 528b782..2f6996c 100644 --- a/src/SAMD21turboPWM.h +++ b/src/SAMD21turboPWM.h @@ -116,6 +116,21 @@ static const PinLookup pinTable[] = { { 4, PORTA, 6, 1, ®_TCC1_CCB0, PORT_PMUX_PMUXE_E} //Table end +#elif defined (ADAFRUIT_QTPY_M0) +//Table begin +{-1, 0, 0, 0, 0, 0}, +{-1, 0, 0, 0, 0, 0}, +{ 2, PORTA, 4, 0, ®_TCC0_CCB0, PORT_PMUX_PMUXE_E}, +{ 3, PORTA, 5, 0, ®_TCC0_CCB1, PORT_PMUX_PMUXO_E}, +{ 4, PORTA, 16, 2, ®_TCC2_CCB0, PORT_PMUX_PMUXE_E}, +{ 5, PORTA, 17, 2, ®_TCC2_CCB1, PORT_PMUX_PMUXO_E}, +{ 6, PORTA, 6, 1, ®_TCC1_CCB0, PORT_PMUX_PMUXE_E}, +{ 7, PORTA, 7, 1, ®_TCC1_CCB1, PORT_PMUX_PMUXO_E}, +{ 8, PORTA, 11, 0, ®_TCC0_CCB3, PORT_PMUX_PMUXO_F}, // alt timer +{ 9, PORTA, 9, 1, ®_TCC1_CCB1, PORT_PMUX_PMUXO_F}, // alt timer +{10, PORTA, 10, 0, ®_TCC0_CCB2, PORT_PMUX_PMUXE_F} // alt timer +//Table end + #else #error Board not supported by Turbo PWM Library #endif