Initial commit for stepper controller
[radiotelescope.git] / stepper_controller / arduino / stepper / bsp.h
1 //
2 // Product: Radiotelescope - Stepper Motor Controller
3 // Version: 0.1
4 // Date:    11 November 2010
5 //
6 //                                          +-----------------------+
7 //                      |   d e c i s i o n s   |
8 //                                          +-----------------------+
9 //                                          | a n d   d e s i g n s |
10 //                      +-----------------------+
11 //
12 // Copyright (C) 2010 Decisions and Designs Pty Ltd. All rights reserved.
13 //
14 // This software may be distributed and modified under the terms of the GNU
15 // General Public License version 2 (GPL) as published by the Free Software
16 // Foundation and appearing in the file GPL.TXT included in the packaging of
17 // this file. Please note that GPL Section 2[b] requires that all works based
18 // on this software must also be made publicly available under the terms of
19 // the GPL ("Copyleft").
20 //
21 // Contact information:
22 // Decisions and Designs Web site: http://www.decisions-and-designs.com.au
23 // e-mail:                         [email protected]
24 //
25
26 #ifndef bsp_h
27 #define bsp_h
28
29 #include "qpn_port.h" /* for QActive */
30
31 #define F_CPU              16000000UL                     /* CPU clock [Hz] */
32
33 #define BSP_TICKS_PER_SEC    50               /* Sys timer tick per seconds */
34
35 #define STEP_PERIOD(P) ((P) * F_CPU / 1000000)      /* P is in microseconds */
36
37 #define AZIMUTH_CLOCK_DBL ((double)16000000.0)
38 #define NEXT_AZIMUTH_STEP_SIG NEXT_COUNT3_SIG
39 #define ELEVATION_CLOCK_DBL ((double)16000000.0)
40 #define NEXT_ELEVATION_STEP_SIG NEXT_COUNT4_SIG
41 \r
42 /* Port A pins */\r
43 #define EL_DIR_PIN              0\r
44 #define AZ_DIR_PIN              2 \r
45 #define EL_CURR_PIN             4\r
46 #define AZ_CURR_PIN             6\r
47 \r
48 /* Port C pins */\r
49 #define EL_FAULT_PIN    7\r
50 #define AZ_FAULT_PIN    5\r
51
52 void    BSP_init(void);
53 void    BSP_initStepTimer3(QActive *me);
54 uint8_t BSP_nextStepTimer3(uint32_t count);
55 void    BSP_initStepTimer4(QActive *me);
56 uint8_t BSP_nextStepTimer4(uint32_t count);
57 \r
58 void BSP_initAzimuthFault(QActive *me);\r
59 void BSP_initElevationFault(QActive *me);\r
60
61 void BSP_azimuthDirection(int8_t direction);
62 void BSP_elevationDirection(int8_t direction);\r
63 \r
64 /* Current reduction should be implemented automatically using FC jumper on\r
65    the GDM stepper driver board. See warning, GDM Manual, 6.5 Bridges \r
66    (Jumpers) function, page 11. The services and hardware are provided in\r
67    case explicit current control is necessary or for Current Off control. */\r
68 void BSP_azimuthCurrent(uint8_t full);
69 void BSP_elevationCurrent(uint8_t full);
70
71 #endif                                                             /* bsp_h */
72

UCC git Repository :: git.ucc.asn.au