1-Wire® library for mbed. Complete 1-Wire library that supports our silicon masters along with a bit-bang master on the MAX32600MBED platform with one common interface for mbed. Slave support has also been included and more slaves will be added as time permits.
Dependents: MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more
Superseded by MaximInterface.
Diff: OneWire_Masters/DS248x/ds248x.cpp
- Revision:
- 6:1faafa0b3cd7
- Parent:
- 5:ce108eeb878d
- Child:
- 14:7b2886a50321
diff -r ce108eeb878d -r 1faafa0b3cd7 OneWire_Masters/DS248x/ds248x.cpp --- a/OneWire_Masters/DS248x/ds248x.cpp Tue Feb 09 03:30:22 2016 +0000 +++ b/OneWire_Masters/DS248x/ds248x.cpp Tue Feb 09 20:08:51 2016 +0000 @@ -48,25 +48,17 @@ //********************************************************************* Ds248x::Ds248x(I2C &i2c_bus, DS248X_I2C_ADRS adrs) -:_p_i2c_bus(&i2c_bus), _w_adrs(adrs << 1), _r_adrs((adrs << 1) | 1), _i2c_owner(false) +:_p_i2c_bus(&i2c_bus), _i2c_owner(false) { - //empty body + set_i2c_adrs(adrs); } //********************************************************************* Ds248x::Ds248x(PinName sda, PinName scl, DS248X_I2C_ADRS adrs) -:_p_i2c_bus(new I2C(sda, scl)), _w_adrs(adrs << 1), _r_adrs((adrs << 1) | 1), _i2c_owner(true) +:_p_i2c_bus(new I2C(sda, scl)), _i2c_owner(true) { - //empty body -} - - -//********************************************************************* -Ds248x::Ds248x(DS248X_I2C_ADRS adrs) -:_w_adrs(adrs << 1), _r_adrs((adrs << 1) | 1) -{ - //empty body + set_i2c_adrs(adrs); } @@ -1051,3 +1043,11 @@ { return _rom_number; } + + +//********************************************************************* +void Ds248x::set_i2c_adrs(DS248X_I2C_ADRS adrs) +{ + _w_adrs = (adrs << 1); + _r_adrs = (_w_adrs | 1); +}