Fraise  2.1
FRAmework for Interfacing Software and Electronics
dimmer.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * 8 channels AC dimmer library for Fraise pic18f device
4  *
5  *********************************************************************
6  * Author Date Comment
7  *********************************************************************
8  * Antoine Rousseau apr 2016 Original.
9  ********************************************************************/
10 /*
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 # MA 02110-1301, USA.
25 */
26 #ifndef _DIMMER__H_
27 #define _DIMMER__H_
28 
42 #include <fruit.h>
52 
53 #ifndef DIMMER_INTPIN
54 #error you must define DIMMER_INTPIN before calling dimmer.h
55 #endif
56 
57 #ifndef DIMMER_INTEDGE
58 
59 #define DIMMER_INTEDGE 1
60 #endif
61 
62 #ifndef DIMMER_TIMER
63 
64 #define DIMMER_TIMER 5
65 #endif
66 
67 #ifndef DIMMER_K0
68 #define DIMMER_K0 KZ2
69 #endif
70 #ifndef DIMMER_K1
71 #define DIMMER_K1 KZ2
72 #endif
73 #ifndef DIMMER_K2
74 #define DIMMER_K2 KZ2
75 #endif
76 #ifndef DIMMER_K3
77 #define DIMMER_K3 KZ2
78 #endif
79 #ifndef DIMMER_K4
80 #define DIMMER_K4 KZ2
81 #endif
82 #ifndef DIMMER_K5
83 #define DIMMER_K5 KZ2
84 #endif
85 #ifndef DIMMER_K6
86 #define DIMMER_K6 KZ2
87 #endif
88 #ifndef DIMMER_K7
89 #define DIMMER_K7 KZ2
90 #endif
91 
92 #ifndef DIMMER_TMIN
93 #define DIMMER_TMIN 9000UL
94 #endif
95 
96 #ifndef DIMMER_INTPRI
97 #define DIMMER_INTPRI 1
98 #endif
99 
101 
106 void dimmerInit(void);
107 
109 
113 void dimmerService(void);
114 
115 
123 void dimmerSet(unsigned char num,unsigned int val);
125 
126 
130 void dimmerHighInterrupt(void);
131 
132 
133 void dimmerLowInterrupt(void);
134 
135 
144 void dimmerReceive();
146 
147 void dimmerPrintDebug();
148 
152 #endif // DIMMER
dimmerSet
void dimmerSet(unsigned char num, unsigned int val)
Set the value of a dimmer channel.
dimmerReceive
void dimmerReceive()
Module receive function, to be called by the fraiseReceive() user defined function.
dimmerInit
void dimmerInit(void)
Init the module in setup()
dimmerHighInterrupt
void dimmerHighInterrupt(void)
Module high interrupt routine, must be called by the highInterrupts() user defined function.
fruit.h
dimmerLowInterrupt
void dimmerLowInterrupt(void)
Module low interrupt routine, must be called by the lowInterrupts() user defined function.
dimmerService
void dimmerService(void)
Module service routine, to be called by the main loop().