#include <stdint.h>

#define KEY_X0_TRIS TRISCbits.TRISC2
#define KEY_X0_LAT LATCbits.LATC2
#define KEY_X1_TRIS TRISCbits.TRISC3
#define KEY_X1_LAT LATCbits.LATC3
#define KEY_X2_TRIS TRISCbits.TRISC4
#define KEY_X2_LAT LATCbits.LATC4
#define KEY_X3_TRIS TRISCbits.TRISC5
#define KEY_X3_LAT LATCbits.LATC5
#define KEY_Y0_TRIS TRISCbits.TRISC6
#define KEY_Y0_PORT PORTCbits.RC6
#define KEY_Y1_TRIS TRISCbits.TRISC7
#define KEY_Y1_PORT PORTCbits.RC7
#define PEXP_LATCH_TRIS TRISCbits.TRISC0
#define PEXP_LATCH_LAT LATCbits.LATC0
#define PEXP_OE_TRIS TRISCbits.TRISC1
#define PEXP_OE_LAT LATCbits.LATC1
#define PEXP_DATA_TRIS TRISAbits.TRISA4
#define PEXP_DATA_LAT LATAbits.LATA4
#define PEXP_CLK_TRIS TRISAbits.TRISA5
#define PEXP_CLK_LAT LATAbits.LATA5
#define INT_TRIS TRISAbits.TRISA2
#define INT_LAT LATAbits.LATA2


void init(struct config *config);
void get_result(struct results *results);
void send_config(struct config *config);
void calibration(void);
double get_res_double(void);
void leds_disp_format(int8_t disp_format);
void leds_fq_sel(uint8_t fq_sel);
void leds_amp_sel(uint8_t amp_sel);
void leds_shift(void);
