Fraise
2.1
FRAmework for Interfacing Software and Electronics
Main Page
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Typedefs
Groups
servo.h
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
30
void
Servo_Init(
void
);
31
32
void
Servo_SetPort(
unsigned
char
num,
unsigned
char
*port,
unsigned
char
mask);
33
void
Servo_Set(
unsigned
char
num,
unsigned
int
val);
34
35
void
Servo_Service(
void
);
36
void
Servo_Rewind(
void
);
//to be called every 20ms
37
38
void
Servo_ISR(
void
);
39
40
void
Servo_Input();
//unsigned char fraddress);
41
42
#define SERVO_SET_PORT_(num,connport,connbit) do {\
43
LAT##connport##bits.LAT##connport##connbit = 0;
/*set out latch to 0*/
\
44
TRIS##connport##bits.TRIS##connport##connbit = 0;
/*configure Kconn pin as an output*/
\
45
Servo_SetPort(num,&LAT##connport,1<<connbit); } while(0)
46
47
// use next macro like this : SERVO_SET_PORT(0,2); to assign Servo_0 to K2 connector.
48
#define SERVO_SET_PORT(num,conn) CALL_FUN3(SERVO_SET_PORT_,num,KPORT(conn),KBIT(conn))
49
50
#endif //
servo
servo.h
Generated on Mon Jan 18 2016 00:28:53 for Fraise by
1.8.6