AJMansfield / TriacDimmer

An arduino library for controlling a triac dimmer.
Apache License 2.0
23 stars 7 forks source link

Support for more chips/boards. #17

Open AJMansfield opened 5 years ago

AJMansfield commented 5 years ago

This library at present only supports 16MHz ATMega 328p boards like the arduino uno, and only on timer/counter 1, but in theory the exact same code could support a much wider range of cpus that have the same peripheral available.

JAndrassy commented 5 years ago

Hi. me again. with this one, because I have this ATmega1284 board

the Arduino.h has digitalPinToTimer(P) it returns one of these constants so by making a for cycle for (uint8_t i = 0; i < NUM_DIGITAL_PINS; i++) { you can test if it is a TIMER1 output pin. And your library doesn't need the number of the input capture pin.

on ATmega 2560 ICP1 is PD 4 and Arduino doesn't have it as pin. Timer 4 and 5 have ICP pins on Mega