Subversion Repositories Code-Repo

Rev

Rev 314 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 314 Rev 315
Line 1... Line 1...
1
#ifndef DEFINES_H
1
#ifndef DEFINES_H
2
#define	DEFINES_H
2
#define	DEFINES_H
3
 
3
 
4
#include <xc.h>
4
#include <xc.h>
5
#include <stdint.h>
5
#include <stdint.h>
-
 
6
#include "STEPPER.h"
6
 
7
 
7
//#define CONTROL_FROM_CONTROLLER
8
//#define CONTROL_FROM_CONTROLLER
8
#define CONTROL_FROM_UART
9
#define CONTROL_FROM_UART
9
 
10
 
10
// <editor-fold defaultstate="collapsed" desc="I/O Pins">
11
// <editor-fold defaultstate="collapsed" desc="I/O Pins">
11
#define STEP_TRIS   TRISAbits.TRISA5
12
#define STEP_TRIS   TRISAbits.TRISA5
12
#define STEP_LAT    LATAbits.LATA5
13
#define STEP_LAT    LATAbits.LATA5
13
 
14
 
14
#define DIR_TRIS    TRISAbits.TRISA2
-
 
15
#define DIR_LAT     LATAbits.LATA2
-
 
16
 
-
 
17
#define M2_TRIS     TRISCbits.TRISC3
15
#define M2_TRIS     TRISCbits.TRISC3
18
#define M2_LAT      LATCbits.LATC3
16
#define M2_LAT      LATCbits.LATC3
19
 
17
 
20
#define M1_TRIS     TRISCbits.TRISC4
18
#define M1_TRIS     TRISCbits.TRISC4
21
#define M1_LAT      LATCbits.LATC4
19
#define M1_LAT      LATCbits.LATC4
Line 23... Line 21...
23
#define M0_TRIS     TRISCbits.TRISC5
21
#define M0_TRIS     TRISCbits.TRISC5
24
#define M0_LAT      LATCbits.LATC5
22
#define M0_LAT      LATCbits.LATC5
25
 
23
 
26
#define SW_2_TRIS   TRISAbits.TRISA4
24
#define SW_2_TRIS   TRISAbits.TRISA4
27
#define SW_2_PORT   PORTAbits.RA4
25
#define SW_2_PORT   PORTAbits.RA4
-
 
26
#define SW_2_INLVL  INLVLAbits.INLVLA4
-
 
27
 
28
#define SW_1_TRIS   TRISAbits.TRISA3
28
#define SW_1_TRIS   TRISAbits.TRISA3
29
#define SW_1_PORT   PORTAbits.RA3
29
#define SW_1_PORT   PORTAbits.RA3
-
 
30
#define SW_1_INLVL  INLVLAbits.INLVLA3
30
 
31
 
31
#define STEP_CURRENT_TRIS   TRISAbits.TRISA1
32
#define STEP_CURRENT_TRIS   TRISAbits.TRISA1
32
#define POT_CURRENT_TRIS    TRISAbits.TRISA0
33
#define POT_CURRENT_TRIS    TRISAbits.TRISA0
33
 
34
 
34
#define SPI_MOSI_TRIS    TRISCbits.TRISC2
35
#define SPI_MOSI_TRIS    TRISCbits.TRISC2
35
#define SPI_D_C_TRIS     TRISCbits.TRISC1
36
#define SPI_MOSI_LAT    LATCbits.LATC2
36
#define SPI_CLK_TRIS     TRISCbits.TRISC0
37
#define SPI_CLK_TRIS     TRISCbits.TRISC0
-
 
38
#define SPI_CLK_LAT     LATCbits.LATC0
-
 
39
#define SPI_DC_SELECT_TRIS      TRISCbits.TRISC1
-
 
40
#define SPI_DC_SELECT_LAT       LATCbits.LATC1
-
 
41
#define SPI_RESET_TRIS    TRISAbits.TRISA2
-
 
42
#define SPI_RESET_LAT     LATAbits.LATA2
-
 
43
 
37
// </editor-fold>
44
// </editor-fold>
38
 
45
 
39
#define _XTAL_FREQ      32000000
46
#define _XTAL_FREQ      32000000
40
 
47
 
41
typedef enum {
48
typedef enum {
42
    SINGLE_STEP,
49
    SINGLE_STEP,
43
    AUTO_STEP,
50
    AUTO_STEP,
-
 
51
    SET_DELAY,
44
    SET_MICROSTEP
52
    SET_MICROSTEP
45
} OPERATING_MODE;
53
} OPERATING_MODE;
46
 
54
 
47
void Set_Next_Mode(void);
55
void Set_Next_Mode(void);
48
OPERATING_MODE Get_Cur_Mode(void);
56
OPERATING_MODE Get_Cur_Mode(void);
-
 
57
 
49
void Set_Next_Step(void);
58
void Update_OLED(void);
-
 
59
void Draw_Manual_Text(uint8_t selected);
-
 
60
void Draw_Auto_Text(uint8_t selected);
-
 
61
void Draw_Speed_Text(STEPPER_SPEED speed, uint8_t selected);
-
 
62
void Draw_Step_Text(STEPPER_MICROSTEP step, uint8_t selected);
50
 
63
 
51
#endif	/* DEFINES_H */
64
#endif	/* DEFINES_H */