| 312 |
Kevin |
1 |
#ifndef DEFINES_H
|
|
|
2 |
#define DEFINES_H
|
|
|
3 |
|
|
|
4 |
#include <xc.h>
|
|
|
5 |
#include <stdint.h>
|
|
|
6 |
|
|
|
7 |
//#define CONTROL_FROM_CONTROLLER
|
|
|
8 |
#define CONTROL_FROM_UART
|
|
|
9 |
|
|
|
10 |
// <editor-fold defaultstate="collapsed" desc="I/O Pins">
|
|
|
11 |
#define STEP_TRIS TRISAbits.TRISA5
|
|
|
12 |
#define STEP_LAT LATAbits.LATA5
|
|
|
13 |
|
|
|
14 |
#define DIR_TRIS TRISAbits.TRISA2
|
|
|
15 |
#define DIR_LAT LATAbits.LATA2
|
|
|
16 |
|
|
|
17 |
#define M2_TRIS TRISCbits.TRISC5
|
|
|
18 |
#define M2_LAT LATCbits.LATC5
|
|
|
19 |
|
|
|
20 |
#define M1_TRIS TRISCbits.TRISC4
|
|
|
21 |
#define M1_LAT LATCbits.LATC4
|
|
|
22 |
|
|
|
23 |
#define M0_TRIS TRISCbits.TRISC3
|
|
|
24 |
#define M0_LAT LATCbits.LATC3
|
|
|
25 |
|
|
|
26 |
#define SW_2_TRIS TRISAbits.TRISA4
|
|
|
27 |
#define SW_2_PORT PORTAbits.RA4
|
|
|
28 |
#define SW_1_TRIS TRISAbits.TRISA3
|
|
|
29 |
#define SW_1_PORT PORTAbits.RA3
|
|
|
30 |
|
|
|
31 |
#define STEP_CURRENT_TRIS TRISAbits.TRISA1
|
|
|
32 |
#define POT_CURRENT_TRIS TRISAbits.TRISA0
|
|
|
33 |
|
|
|
34 |
#define SPI_MOSI_TRIS TRISCbits.TRISC2
|
|
|
35 |
#define SPI_D_C_TRIS TRISCbits.TRISC1
|
|
|
36 |
#define SPI_CLK_TRIS TRISCbits.TRISC0
|
|
|
37 |
// </editor-fold>
|
|
|
38 |
|
|
|
39 |
#define _XTAL_FREQ 32000000
|
|
|
40 |
|
|
|
41 |
typedef enum {
|
|
|
42 |
SINGLE_STEP,
|
|
|
43 |
AUTO_STEP,
|
|
|
44 |
SET_MICROSTEP
|
|
|
45 |
} OPERATING_MODE;
|
|
|
46 |
|
|
|
47 |
void Set_Next_Mode(void);
|
|
|
48 |
OPERATING_MODE Get_Cur_Mode(void);
|
|
|
49 |
void Set_Next_Step(void);
|
|
|
50 |
|
|
|
51 |
#endif /* DEFINES_H */
|