Fraise  2.1
FRAmework for Interfacing Software and Electronics
servo.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Servo library for Fraise pic18f device
4  * Uses TIMER5 !
5  *
6  *********************************************************************
7  * Author Date Comment
8  *********************************************************************
9  * Antoine Rousseau jan 2013 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 _Servo__H_
28 #define _Servo__H_
29 
41 #include <fruit.h>
42 
47 void servoInit(void);
48 
53 #define servoSelect(num,conn) do { \
54  digitalClear(conn);\
55  pinModeDigitalOut(conn);\
56  CALL_FUN3(SERVO_SELECT_,num,KPORT(conn),KBIT(conn));\
57  } while(0)
58 
59 
60 
64 void servoService(void);
65 
66 
74 void servoSet(unsigned char num,unsigned int val);
76 
77 
81 void servoHighInterrupt(void);
82 
83 
92 void servoReceive();
94 
95 void servoSetPort(unsigned char num,unsigned char *port,unsigned char mask);
96 
97 #define SERVO_SELECT_(num,connport,connbit) servoSetPort(num,&LAT##connport,1<<connbit)
98 
102 #endif //
servoInit
void servoInit(void)
Init the module in setup()
servoReceive
void servoReceive()
Module receive function, to be called by the fraiseReceive() user defined function.
servoHighInterrupt
void servoHighInterrupt(void)
Module interrupt routine, must be called by the highInterrupts() user defined function.
fruit.h
servoService
void servoService(void)
Module service routine, to be called by the main loop().
servoSet
void servoSet(unsigned char num, unsigned int val)
Set position of a servomotor.