From e82fb9971eafc33988b2ef7eb770204f7dcd6833 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Fri, 21 Feb 2020 15:10:45 +0100 Subject: [PATCH] Implemented usage example --- i2c/i2c | 2 +- i2c/main.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/i2c/i2c b/i2c/i2c index 939cdc1..629be83 160000 --- a/i2c/i2c +++ b/i2c/i2c @@ -1 +1 @@ -Subproject commit 939cdc1196edb161c6ea25eb61a72fa4488cba06 +Subproject commit 629be83f8ad97cfcfe0d9d4cbad04e1b1f17c695 diff --git a/i2c/main.cpp b/i2c/main.cpp index 3fe7dc9..b3de4b4 100644 --- a/i2c/main.cpp +++ b/i2c/main.cpp @@ -8,8 +8,21 @@ void i2cTest() using config = Hardware; I2c twi; + constexpr auto I2CADDRESS = 0x4B; twi.init(); + + if (!twi.start(false)) { + twi.stop(); + return; + } + + if (!twi.write(0x7F)) { + twi.stop(); + return; + } + + twi.stop(); } int main()