Added HangmanGame class, but does not work yet
Dependencies: SDFileSystem app epson mbed msp430 pl tests
i2c_utils.cpp
- Committer:
- markpsymonds
- Date:
- 2017-12-04
- Revision:
- 1:a5ec6f9dcf0d
- Parent:
- 0:fa7450a43b99
File content as of revision 1:a5ec6f9dcf0d:
// // Filename: i2c_utils.cpp // // I2C utilities. // #include "i2c_utils.h" uint16_t GetAddressRangeEnd(uint16_t bits) { uint16_t end = 0; switch(bits) { case 7: end = 0x80; break; case 10: end = 0x400; break; default: printf("Bad address range\n"); } return end; } void I2C_Scan(I2C &i2c, uint16_t bits) { printf("Scanning I2C...\n"); const uint16_t end = GetAddressRangeEnd(bits); char data; for(uint16_t address = 0; address < end; address++) { if(i2c.read(address << 1, &data, 1) == 0) printf("Address 0x%02x found\n", address); } }