Subversion Repositories Code-Repo

Rev

Rev 312 | Blame | Last modification | View Log | RSS feed

#ifndef DEFINES_H
#define DEFINES_H

#include <xc.h>
#include <stdint.h>

//#define CONTROL_FROM_CONTROLLER
#define CONTROL_FROM_UART

// <editor-fold defaultstate="collapsed" desc="I/O Pins">
#define STEP_TRIS   TRISAbits.TRISA5
#define STEP_LAT    LATAbits.LATA5

#define DIR_TRIS    TRISAbits.TRISA2
#define DIR_LAT     LATAbits.LATA2

#define M2_TRIS     TRISCbits.TRISC3
#define M2_LAT      LATCbits.LATC3

#define M1_TRIS     TRISCbits.TRISC4
#define M1_LAT      LATCbits.LATC4

#define M0_TRIS     TRISCbits.TRISC5
#define M0_LAT      LATCbits.LATC5

#define SW_2_TRIS   TRISAbits.TRISA4
#define SW_2_PORT   PORTAbits.RA4
#define SW_1_TRIS   TRISAbits.TRISA3
#define SW_1_PORT   PORTAbits.RA3

#define STEP_CURRENT_TRIS   TRISAbits.TRISA1
#define POT_CURRENT_TRIS    TRISAbits.TRISA0

#define SPI_MOSI_TRIS    TRISCbits.TRISC2
#define SPI_D_C_TRIS     TRISCbits.TRISC1
#define SPI_CLK_TRIS     TRISCbits.TRISC0
// </editor-fold>

#define _XTAL_FREQ      32000000

typedef enum {
    SINGLE_STEP,
    AUTO_STEP,
    SET_MICROSTEP
} OPERATING_MODE;

void Set_Next_Mode(void);
OPERATING_MODE Get_Cur_Mode(void);
void Set_Next_Step(void);

#endif  /* DEFINES_H */