Subversion Repositories group.electronics

Rev

Rev 42 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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