Rev 239 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#ifndef DEFINES_H#define DEFINES_H#include <xc.h>#include <stdint.h>// <editor-fold defaultstate="collapsed" desc="I/O Pins">#define BTN_L_N_TRIS TRISAbits.TRISA1#define BTN_L_N_PORT PORTAbits.RA1#define BTN_L_N_WPU WPUAbits.WPUA1#define BTN_L_S_TRIS TRISAbits.TRISA0#define BTN_L_S_PORT PORTAbits.RA0#define BTN_L_S_WPU WPUAbits.WPUA0#define BTN_R_N_TRIS TRISCbits.TRISC2#define BTN_R_N_PORT PORTCbits.RC2#define BTN_R_N_WPU WPUCbits.WPUC2#define BTN_R_E_TRIS TRISAbits.TRISA3#define BTN_R_E_PORT PORTAbits.RA3#define BTN_R_E_WPU WPUAbits.WPUA3#define BTN_R_S_TRIS TRISAbits.TRISA5#define BTN_R_S_PORT PORTAbits.RA5#define BTN_R_S_WPU WPUAbits.WPUA5#define BTN_R_W_TRIS TRISAbits.TRISA2#define BTN_R_W_PORT PORTAbits.RA2#define BTN_R_W_WPU WPUAbits.WPUA2#define LED_4_TRIS TRISCbits.TRISC3#define LED_4_LAT LATCbits.LATC3#define LED_3_TRIS TRISCbits.TRISC4#define LED_3_LAT LATCbits.LATC4#define LED_2_TRIS TRISCbits.TRISC5#define LED_2_LAT LATCbits.LATC5#define LED_1_TRIS TRISAbits.TRISA4#define LED_1_LAT LATAbits.LATA4#define I2C_CLK_TRIS TRISCbits.TRISC0#define I2C_DAT_TRIS TRISCbits.TRISC1// </editor-fold>#define _XTAL_FREQ 32000000#define CMD_QUERY_BTN 0x0A#define CMD_SET_LEDS 0x0Btypedef union {struct {unsigned BTN_L_N :1;unsigned BTN_L_S :1;unsigned BTN_R_N :1;unsigned BTN_R_E :1;unsigned BTN_R_S :1;unsigned BTN_R_W :1;unsigned :2;};uint8_t value;} BTN_STATUS;typedef union {struct {unsigned LED_1 :1;unsigned LED_2 :1;unsigned LED_3 :1;unsigned LED_4 :1;};uint8_t value;} LED_STATUS;void Pins_Read(BTN_STATUS *btns);void Leds_Write(LED_STATUS *leds);#endif /* DEFINES_H */