Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: YKNCT_I2C.cpp
- Revision:
- 7:5b22492a5a13
- Parent:
- 6:329e7b9d8cfc
- Child:
- 8:f7779710d64a
--- a/YKNCT_I2C.cpp Sat Apr 06 01:48:55 2019 +0000 +++ b/YKNCT_I2C.cpp Mon Apr 15 10:42:16 2019 +0000 @@ -5,10 +5,19 @@ i2c.frequency(100000); } -void Y_I2C::Out(int address, char data) -{ - i2c.write(address<<1, &data, 1, false); +void Y_I2C::Out_Set(OUT_I2C_Data_TypeDef *OUT_I2C_Data, uint8_t num, uint8_t value, uint8_t shift) +{ + if(value==1) + (OUT_I2C_Data+num) -> out_data |= 1<<shift; + else + (OUT_I2C_Data+num) -> out_data &= ~(1<<shift); +} + +void Y_I2C::Out(OUT_I2C_Data_TypeDef *OUT_I2C_Data, uint8_t num) +{ + i2c.write((OUT_I2C_Data+num) -> DevAddress<<1, &(OUT_I2C_Data+num)->out_data,1); wait_us(1000); + } int Y_I2C::In(int address, int num)