Added the repository from the odin svn
[educational.data.git] / fag / speciale / nodes / src / libs / linear_actuator / s02V2.h
blob35dff70b9a8b1d4f1cb7acceb2b5a2f3918f4e47
1 /*
2 * s02V2.h
3 *
5 * Created by Andreas Lyder on 31/03/08.
6 * Copyright 2008 __MyCompanyName__. All rights reserved.
8 */
9 #ifndef s02V2_h
10 #define s02V2_h
12 #include "common.h"
13 #include <cyg/kernel/kapi.h> /* All the kernel specific stuff */
16 /* DEFINES */
17 #define CYGNUM_HAL_PRI_0 0
18 #define CYGNUM_HAL_PRI_1 1
19 #define CYGNUM_HAL_PRI_2 2
20 #define CYGNUM_HAL_PRI_3 3
21 #define CYGNUM_HAL_PRI_4 4
22 #define CYGNUM_HAL_PRI_5 5
23 #define CYGNUM_HAL_PRI_6 6
24 #define CYGNUM_HAL_PRI_7 7
26 /* PIO & PA PB PIN */
27 #define S02V2_ENABLE (1<<12) /* PA12 & MISO PWM1 27 */
28 #define S02V2_DIRECTION (1<<13) /* PA13 & MOSI PWM2 22 */
29 #define S02V2_PWM (1<<11) /* PA11 & NPCS0 PWM0 28 */
30 #define S02V2_BRAKE (1<<14) /* PA14 & SPCK PWM3 21 */
31 #define S02V2_TACHO (1<<20) /* PA20 / AD3 & RF IRQ0 16 */
32 #define S02V2_CURRENT (1<<17) /* PA17 / AD0 & TD PCK1 9 */
33 #define S02V2_VOLTAGE (1<<18) /* PA18 / AD1 & RD PCK2 10 */
34 #define S02V2_GRADIENT (1<<19) /* PA19 / AD2 & RK FIQ 13 */
35 #define S02V2_CONTROL_MASK (S02V2_ENABLE|S02V2_DIRECTION|S02V2_BRAKE)
36 #define S02V2_FEEDBACK_MASK (S02V2_CURRENT|S02V2_VOLTAGE|S02V2_GRADIENT)
38 #define S02V2_PWM_HZ 24000
40 #define CURRENT_OFFSET 7
41 #define MAX_DUTYCYCLE 767
43 BEGIN_CSPEC
45 /* INTERFACE */
46 int s02V2_initialize(void); //Initialize linear actuator - Return status
47 int s02V2_reset(void); //Reset linear actuator - Return status
48 int s02V2_calibrate(void); //Calibrate linear actuator - Return status
49 int s02V2_setPosition(signed int); //Go to position in mm - Return status
50 int s02V2_setPositionTime(double,double); //Go to position in mm within i given time in mm/sec - Return status
51 double s02V2_getPosition(void); // Returns position in mm
52 void s02V2_printDebug(void); // Print Debug parameters on debug port
54 END_CSPEC
55 #endif // s02V2_h