Rev 2248 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2248 | - | 1 | /***************************************************************************************************************************** |
2 | * File: twimaster.h |
||
3 | * Purpose: header of twimaster.c |
||
4 | *****************************************************************************************************************************/ |
||
5 | |||
6 | #ifndef _I2C_MASTER_H |
||
7 | #define _I2C_MASTER_H |
||
8 | |||
9 | |||
10 | // ------------------------ definions for I2C --- |
||
11 | #define SCL_CLOCK 200000L |
||
12 | #define I2C_TIMEOUT 30000 |
||
13 | #define I2C_START 0x08 |
||
14 | #define I2C_REPEATED_START 0x10 |
||
15 | #define I2C_TX_SLA_ACK 0x18 |
||
16 | #define I2C_TX_DATA_ACK 0x28 |
||
17 | #define I2C_RX_SLA_ACK 0x40 |
||
18 | #define I2C_RX_DATA_ACK 0x50 |
||
19 | |||
20 | |||
21 | extern volatile unsigned char twi_state; |
||
22 | extern unsigned char motor,MissingMotor; |
||
23 | extern unsigned char motorread; |
||
24 | extern unsigned char motor_rx[]; |
||
25 | extern unsigned char MotorPresent[]; |
||
26 | extern unsigned char MotorError[]; |
||
27 | |||
28 | extern void i2c_init(void); // initialize I2C |
||
29 | extern void i2c_start(void); // start I2C |
||
30 | extern void i2c_stop(void); // stop I2C |
||
31 | extern void i2c_write_byte(char byte); // write 1 Byte |
||
32 | extern void i2c_reset(void); // reset |
||
33 | |||
34 | #endif |
||
35 | // *** EOF: I2C_MASTER_H ****************************************************************************************************** |