Fraise  2.1
FRAmework for Interfacing Software and Electronics
softpwm.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software PWM library for Fraise pic18f device
4  *
5  *
6  *********************************************************************
7  * Author Date Comment
8  *********************************************************************
9  * Antoine Rousseau april 2017 Original.
10  ********************************************************************/
11 /*
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14 # as published by the Free Software Foundation; either version 2
15 # of the License, or (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25 # MA 02110-1301, USA.
26 */
27 #ifndef _SOFTPWM__H_
28 #define _SOFTPWM__H_
29 
43 #include <fruit.h>
44 
45 
57 #ifndef SOFTPWM_TIMER
58 
59 #define SOFTPWM_TIMER 5
60 #endif
61 
62 #ifndef SOFTPWM_MAX_VALUE
63 #define SOFTPWM_MAX_VALUE 1023
64 #endif
65 
66 #ifndef SOFTPWM_TICK_US
67 #define SOFTPWM_TICK_US 5
68 #endif
69 
70 #ifndef SOFTPWM_INTPRI
71 #define SOFTPWM_INTPRI 1
72 #endif
73 
75 
80 void softpwmInit();
82 
86 
87 
88 
92 void softpwmSet(unsigned char chan, unsigned int val);
95 unsigned int softpwmGet(unsigned char chan);
96 
98 
102 void softpwmHighInterrupt(void);
103 
104 
105 void softpwmLowInterrupt(void);
106 
107 
115 void softpwmReceive();
117 
118 
122 #endif
fruit.h
softpwmGet
unsigned int softpwmGet(unsigned char chan)
Get the current value of a channel.
softpwmInit
void softpwmInit()
Init the module in setup()
softpwmLowInterrupt
void softpwmLowInterrupt(void)
Module low interrupt routine, must be called by the lowInterrupts() user defined function.
softpwmHighInterrupt
void softpwmHighInterrupt(void)
Module high interrupt routine, must be called by the highInterrupts() user defined function.
softpwmReceive
void softpwmReceive()
Module receive function, to be called by the fraiseReceive() user defined function.
softpwmSet
void softpwmSet(unsigned char chan, unsigned int val)
Set the value of a channel.