From bfabdf3ed83f75bd36be16e23dda54b5d1e38520 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 29 Nov 2010 23:08:04 +0100 Subject: digital/dev2: add TWI master module --- digital/dev2/doc/twi.txt | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 digital/dev2/doc/twi.txt (limited to 'digital/dev2/doc') diff --git a/digital/dev2/doc/twi.txt b/digital/dev2/doc/twi.txt new file mode 100644 index 00000000..3478b492 --- /dev/null +++ b/digital/dev2/doc/twi.txt @@ -0,0 +1,63 @@ +===================================== + dev2 twi - Two Wire Interface (I2C) +===================================== + +The twi module provides a master twi controlled by the host. + +Do not forget to select an output using the control script! + +Controlling using a serial monitor +================================== + +To control twi master, use a serial monitor (minicom, picocom, gtkterm, +screen, socat...). This module defines a language to make twi requests. + +Commands are composed of a command letter, followed by hexadecimal parameters, +and finally a carriage return. + +Protocol errors are signaled using an exclamation mark followed by a carriage +return. + +Sending data +------------ + +Command:: + + s\r + +Response:: + + S\r + +For example:: + + s04010203\r + S03\r + +The example sends the bytes 0x01, 0x02 and 0x03 to the slave at address 0x04. +The modules responded that all three bytes were sent. + +Receiving data +-------------- + +Command:: + + r\r + +Response:: + + R\r + +For example:: + + r0403\r + R010203\r + +The example request to read three bytes from the slave at address 0x04. The +modules responded with the received data. + +Controlling using python +======================== + +The `dev2.twi` python modules defines the Twi class to easily access the twi +module. -- cgit v1.2.3