Chaitanya Viswa
/
xmasterv2
v2i2c master receiving 4 bit data from slave
Fork of xmaster by
master.h@0:e96ddb4b964e, 2014-07-05 (annotated)
- Committer:
- viswachaitanya
- Date:
- Sat Jul 05 06:40:06 2014 +0000
- Revision:
- 0:e96ddb4b964e
- Child:
- 1:35dee3eff0ab
i2cmaster receiving 4 bit data from slave
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
viswachaitanya | 0:e96ddb4b964e | 1 | #include "mbed.h" //library // |
viswachaitanya | 0:e96ddb4b964e | 2 | #define get_hk_data 1 //sample telecommands |
viswachaitanya | 0:e96ddb4b964e | 3 | #define telecommand2 2 |
viswachaitanya | 0:e96ddb4b964e | 4 | #define telecommand3 3 |
viswachaitanya | 0:e96ddb4b964e | 5 | #define telecommand4 4 |
viswachaitanya | 0:e96ddb4b964e | 6 | #define telecommand5 5 |
viswachaitanya | 0:e96ddb4b964e | 7 | #define telecommand6 6 |
viswachaitanya | 0:e96ddb4b964e | 8 | #define telecommand7 7 |
viswachaitanya | 0:e96ddb4b964e | 9 | #define telecommand8 8 |
viswachaitanya | 0:e96ddb4b964e | 10 | #define telecommand9 9 |
viswachaitanya | 0:e96ddb4b964e | 11 | #define telecommand10 10 |
viswachaitanya | 0:e96ddb4b964e | 12 | I2C master (p28,p27); //configure pins p27,p28 as I2C master |
viswachaitanya | 0:e96ddb4b964e | 13 | Serial pc (USBTX,USBRX); |
viswachaitanya | 0:e96ddb4b964e | 14 | |
viswachaitanya | 0:e96ddb4b964e | 15 | //const int addr = 0x20; //slave address |
viswachaitanya | 0:e96ddb4b964e | 16 | char receive_byte(); //funtion to receive float data |
viswachaitanya | 0:e96ddb4b964e | 17 | |
viswachaitanya | 0:e96ddb4b964e | 18 | |
viswachaitanya | 0:e96ddb4b964e | 19 | struct SensorData //HK_data_structure |
viswachaitanya | 0:e96ddb4b964e | 20 | { |
viswachaitanya | 0:e96ddb4b964e | 21 | char voltage[5]; |
viswachaitanya | 0:e96ddb4b964e | 22 | char current[5]; |
viswachaitanya | 0:e96ddb4b964e | 23 | char temp[5]; |
viswachaitanya | 0:e96ddb4b964e | 24 | } Sensor; |
viswachaitanya | 0:e96ddb4b964e | 25 | void FUNC_I2C_MASTER_MAIN(int command, int slave_address, int iterations); |