Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
238 Kevin 1
#ifndef CONTROLLERS_H
2
#define	CONTROLLERS_H
3
 
4
#define CONTROLLER_READ     0xA
5
#define CONTROLLER_WRITE    0xB
6
 
7
#define CONTROLLER_BTN_DEFAULT  0xC0
8
#define CONTROLLER_LED_DEFAULT  0x00
9
 
10
#define CONTROLLER_1_ADDRESS    0x24
11
#define CONTROLLER_2_ADDRESS    0x25
12
 
13
typedef struct {
14
    void (*btn_change_callback)(uint8_t ctrl_1, uint8_t ctrl_2);
15
 
16
    uint8_t ctrl_1_connected;
17
    uint8_t ctrl_1_buttons_prev;
18
    uint8_t ctrl_1_leds;
19
    uint8_t ctrl_1_active;
20
 
21
    uint8_t ctrl_2_connected;
22
    uint8_t ctrl_2_buttons_prev;
23
    uint8_t ctrl_2_leds;
24
    uint8_t ctrl_2_active;
25
} CONTROLLER_DATA;
26
 
240 Kevin 27
void Controller_Init(CONTROLLER_DATA *data, 
238 Kevin 28
        void (*btn_change_callback)(uint8_t, uint8_t));
29
void Controller_Update(void);
30
void Controller_Set_Leds(uint8_t ctrl_1, uint8_t ctrl_2);
31
void Controller_Btn_Change(void (*callback)(uint8_t, uint8_t));
240 Kevin 32
uint8_t Controller_Query(void);
238 Kevin 33
 
34
#endif	/* CONTROLLERS_H */
35