Implemented usage example
This commit is contained in:
parent
4075cb4e63
commit
e82fb9971e
2
i2c/i2c
2
i2c/i2c
@ -1 +1 @@
|
|||||||
Subproject commit 939cdc1196edb161c6ea25eb61a72fa4488cba06
|
Subproject commit 629be83f8ad97cfcfe0d9d4cbad04e1b1f17c695
|
13
i2c/main.cpp
13
i2c/main.cpp
@ -8,8 +8,21 @@ void i2cTest()
|
|||||||
using config = Hardware<Prescaler::PRESCALER_1, 100000>;
|
using config = Hardware<Prescaler::PRESCALER_1, 100000>;
|
||||||
|
|
||||||
I2c<config> twi;
|
I2c<config> twi;
|
||||||
|
constexpr auto I2CADDRESS = 0x4B;
|
||||||
|
|
||||||
twi.init();
|
twi.init();
|
||||||
|
|
||||||
|
if (!twi.start<I2CADDRESS>(false)) {
|
||||||
|
twi.stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!twi.write(0x7F)) {
|
||||||
|
twi.stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
twi.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
Loading…
Reference in New Issue
Block a user