Subversion Repositories group.electronics

Rev

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

Rev 56 Rev 58
Line 14... Line 14...
14
void i2c_onReceive( void(*function)(uint8_t));
14
void i2c_onReceive( void(*function)(uint8_t));
15
void i2c_onRequest( void(*function)(void));
15
void i2c_onRequest( void(*function)(void));
16
 
16
 
17
 
17
 
18
struct {
18
struct {
19
        uint8_t rxBuffer[MAX_BUFFER];
19
	uint8_t rxBuffer[MAX_BUFFER];
20
        //uint8_t rxBufferIndex;
-
 
21
        //uint8_t rxBufferLength;
-
 
22
 
20
 
23
	// Save 8 bytes. Maximum buffer size is 15
21
	// Save 8 bytes. Maximum buffer size is 15
24
        union {
22
	union {
25
                uint8_t rxMeta;
23
		uint8_t rxMeta;
26
                struct {
24
		struct {
27
                        uint8_t rxBufferIndex:4;
25
			uint8_t rxBufferIndex:4;
28
                        uint8_t rxBufferLength:4;
26
			uint8_t rxBufferLength:4;
29
                };
27
		};
30
        };
28
	};
31
 
29
 
32
        uint8_t txAddress;
30
	uint8_t txAddress;
33
        uint8_t txBuffer[MAX_BUFFER];
31
	uint8_t txBuffer[MAX_BUFFER];
34
        //uint8_t txBufferIndex;
-
 
35
        //uint8_t txBufferLength;
-
 
36
 
32
 
37
	union {
33
	union {
38
		uint8_t txMeta;
34
		uint8_t txMeta;
39
		struct {
35
		struct {
40
			uint8_t txBufferIndex:4;
36
			uint8_t txBufferIndex:4;
41
			uint8_t txBufferLength:4;
37
			uint8_t txBufferLength:4;
42
		};
38
		};
43
	};
39
	};
44
 
40
 
45
        void    (*user_onRequest)(void);
41
	void    (*user_onRequest)(void);
46
        void    (*user_onReceive)(uint8_t);
42
	void    (*user_onReceive)(uint8_t);
47
 
43
 
48
        union {
44
	union {
49
                uint8_t internal;
45
		uint8_t internal;
50
                struct {
46
		struct {
51
                        uint8_t transmitting:1;
47
			uint8_t transmitting:1;
52
                        uint8_t reserved:7;
48
			uint8_t reserved:7;
53
                };
49
		};
54
        };
50
	};
55
} wire;
51
} wire;
56
 
52
 
57
#endif
53
#endif