![]() |
Fraise
2.1
FRAmework for Interfacing Software and Electronics
|
8 channels AC dimmer More...
8 channels AC dimmer
Example :
main.c
config.h
Settings to put in config.h | |
You must define the pin used to trig the interrupt (sensing the AC zero-crossing): #define DIMMER_INTPIN K9 (replace K9 by the pin used by your dimmer)
The following parameters can be overloaded: | |
#define | DIMMER_INTEDGE |
Edge of the interrupt (0:falling edge ; 1:rising edge) ; default: 1(rising edge). | |
#define | DIMMER_TIMER |
Timer to be used by the dimmer module (only 1, 3 or 5 ; default: 5). | |
#define | DIMMER_K0 |
output pin for channel 0. | |
#define | DIMMER_K1 |
output pin for channel 1. | |
#define | DIMMER_K2 |
output pin for channel 2. | |
#define | DIMMER_K3 |
output pin for channel 3. | |
#define | DIMMER_K4 |
output pin for channel 4. | |
#define | DIMMER_K5 |
output pin for channel 5. | |
#define | DIMMER_K6 |
output pin for channel 6. | |
#define | DIMMER_K7 |
output pin for channel 7. | |
#define | DIMMER_TMIN |
#define | DIMMER_INTPRI |
Initialization | |
void | dimmerInit (void) |
Init the module in setup() | |
Main loop functions | |
void | dimmerService (void) |
Module service routine, to be called by the main loop(). | |
Utilities | |
void | dimmerSet (unsigned char num, unsigned int val) |
Set the value of a dimmer channel. More... | |
Interrupt routine | |
void | dimmerHighInterrupt (void) |
Module high interrupt routine, must be called by the highInterrupts() user defined function. | |
void | dimmerLowInterrupt (void) |
Module low interrupt routine, must be called by the lowInterrupts() user defined function. | |
Receive function | |
void | dimmerReceive () |
Module receive function, to be called by the fraiseReceive() user defined function. More... | |
void | dimmerPrintDebug () |
void dimmerSet | ( | unsigned char | num, |
unsigned int | val | ||
) |
Set the value of a dimmer channel.
num | Dimmer channel (0 to 7) |
val | New 16 bit value for this channel, between 0 and 65535 |
void dimmerReceive | ( | ) |
Module receive function, to be called by the fraiseReceive() user defined function.
The first byte of the message represents the channel (0-7), the 2 next bytes are the 16 bit new position value. If the first byte is 8 then the next char sets the AC frequency : 0=50Hz, 1=60Hz