From 6c685205ce734dfe847531fe144cb9f392099bc4 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 5 Jan 2017 14:49:24 +0100 Subject: [PATCH] firmware: support i2c restart --- artiq/firmware/libboard/i2c.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/artiq/firmware/libboard/i2c.rs b/artiq/firmware/libboard/i2c.rs index 1c6b8181e..811f065bd 100644 --- a/artiq/firmware/libboard/i2c.rs +++ b/artiq/firmware/libboard/i2c.rs @@ -70,6 +70,16 @@ pub fn start(busno: u32) { half_period(); } +pub fn restart(busno: u32) { + // Set SCL low then SDA high */ + scl_o(busno, false); + half_period(); + sda_oe(busno, false); + half_period(); + // Do a regular start + start(busno); +} + pub fn stop(busno: u32) { // First, make sure SCL is low, so that the target releases the SDA line scl_o(busno, false);