Browse Source

library - Wire

Richard Wackerbarth 9 years ago
parent
commit
363d7c505f

+ 303
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/Wire.cpp View File

@@ -0,0 +1,303 @@
1
+/*
2
+  TwoWire.cpp - TWI/I2C library for Wiring & Arduino
3
+  Copyright (c) 2006 Nicholas Zambetti.  All right reserved.
4
+
5
+  This library is free software; you can redistribute it and/or
6
+  modify it under the terms of the GNU Lesser General Public
7
+  License as published by the Free Software Foundation; either
8
+  version 2.1 of the License, or (at your option) any later version.
9
+
10
+  This library is distributed in the hope that it will be useful,
11
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+  Lesser General Public License for more details.
14
+
15
+  You should have received a copy of the GNU Lesser General Public
16
+  License along with this library; if not, write to the Free Software
17
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
+ 
19
+  Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
20
+*/
21
+
22
+extern "C" {
23
+  #include <stdlib.h>
24
+  #include <string.h>
25
+  #include <inttypes.h>
26
+  #include "twi.h"
27
+}
28
+
29
+#include "Wire.h"
30
+
31
+// Initialize Class Variables //////////////////////////////////////////////////
32
+
33
+uint8_t TwoWire::rxBuffer[BUFFER_LENGTH];
34
+uint8_t TwoWire::rxBufferIndex = 0;
35
+uint8_t TwoWire::rxBufferLength = 0;
36
+
37
+uint8_t TwoWire::txAddress = 0;
38
+uint8_t TwoWire::txBuffer[BUFFER_LENGTH];
39
+uint8_t TwoWire::txBufferIndex = 0;
40
+uint8_t TwoWire::txBufferLength = 0;
41
+
42
+uint8_t TwoWire::transmitting = 0;
43
+void (*TwoWire::user_onRequest)(void);
44
+void (*TwoWire::user_onReceive)(int);
45
+
46
+// Constructors ////////////////////////////////////////////////////////////////
47
+
48
+TwoWire::TwoWire()
49
+{
50
+}
51
+
52
+// Public Methods //////////////////////////////////////////////////////////////
53
+
54
+void TwoWire::begin(void)
55
+{
56
+  rxBufferIndex = 0;
57
+  rxBufferLength = 0;
58
+
59
+  txBufferIndex = 0;
60
+  txBufferLength = 0;
61
+
62
+  twi_init();
63
+}
64
+
65
+void TwoWire::begin(uint8_t address)
66
+{
67
+  twi_setAddress(address);
68
+  twi_attachSlaveTxEvent(onRequestService);
69
+  twi_attachSlaveRxEvent(onReceiveService);
70
+  begin();
71
+}
72
+
73
+void TwoWire::begin(int address)
74
+{
75
+  begin((uint8_t)address);
76
+}
77
+
78
+void TwoWire::setClock(uint32_t frequency)
79
+{
80
+  TWBR = ((F_CPU / frequency) - 16) / 2;
81
+}
82
+
83
+uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop)
84
+{
85
+  // clamp to buffer length
86
+  if(quantity > BUFFER_LENGTH){
87
+    quantity = BUFFER_LENGTH;
88
+  }
89
+  // perform blocking read into buffer
90
+  uint8_t read = twi_readFrom(address, rxBuffer, quantity, sendStop);
91
+  // set rx buffer iterator vars
92
+  rxBufferIndex = 0;
93
+  rxBufferLength = read;
94
+
95
+  return read;
96
+}
97
+
98
+uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity)
99
+{
100
+  return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)true);
101
+}
102
+
103
+uint8_t TwoWire::requestFrom(int address, int quantity)
104
+{
105
+  return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)true);
106
+}
107
+
108
+uint8_t TwoWire::requestFrom(int address, int quantity, int sendStop)
109
+{
110
+  return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)sendStop);
111
+}
112
+
113
+void TwoWire::beginTransmission(uint8_t address)
114
+{
115
+  // indicate that we are transmitting
116
+  transmitting = 1;
117
+  // set address of targeted slave
118
+  txAddress = address;
119
+  // reset tx buffer iterator vars
120
+  txBufferIndex = 0;
121
+  txBufferLength = 0;
122
+}
123
+
124
+void TwoWire::beginTransmission(int address)
125
+{
126
+  beginTransmission((uint8_t)address);
127
+}
128
+
129
+//
130
+//	Originally, 'endTransmission' was an f(void) function.
131
+//	It has been modified to take one parameter indicating
132
+//	whether or not a STOP should be performed on the bus.
133
+//	Calling endTransmission(false) allows a sketch to 
134
+//	perform a repeated start. 
135
+//
136
+//	WARNING: Nothing in the library keeps track of whether
137
+//	the bus tenure has been properly ended with a STOP. It
138
+//	is very possible to leave the bus in a hung state if
139
+//	no call to endTransmission(true) is made. Some I2C
140
+//	devices will behave oddly if they do not see a STOP.
141
+//
142
+uint8_t TwoWire::endTransmission(uint8_t sendStop)
143
+{
144
+  // transmit buffer (blocking)
145
+  int8_t ret = twi_writeTo(txAddress, txBuffer, txBufferLength, 1, sendStop);
146
+  // reset tx buffer iterator vars
147
+  txBufferIndex = 0;
148
+  txBufferLength = 0;
149
+  // indicate that we are done transmitting
150
+  transmitting = 0;
151
+  return ret;
152
+}
153
+
154
+//	This provides backwards compatibility with the original
155
+//	definition, and expected behaviour, of endTransmission
156
+//
157
+uint8_t TwoWire::endTransmission(void)
158
+{
159
+  return endTransmission(true);
160
+}
161
+
162
+// must be called in:
163
+// slave tx event callback
164
+// or after beginTransmission(address)
165
+size_t TwoWire::write(uint8_t data)
166
+{
167
+  if(transmitting){
168
+  // in master transmitter mode
169
+    // don't bother if buffer is full
170
+    if(txBufferLength >= BUFFER_LENGTH){
171
+      setWriteError();
172
+      return 0;
173
+    }
174
+    // put byte in tx buffer
175
+    txBuffer[txBufferIndex] = data;
176
+    ++txBufferIndex;
177
+    // update amount in buffer   
178
+    txBufferLength = txBufferIndex;
179
+  }else{
180
+  // in slave send mode
181
+    // reply to master
182
+    twi_transmit(&data, 1);
183
+  }
184
+  return 1;
185
+}
186
+
187
+// must be called in:
188
+// slave tx event callback
189
+// or after beginTransmission(address)
190
+size_t TwoWire::write(const uint8_t *data, size_t quantity)
191
+{
192
+  if(transmitting){
193
+  // in master transmitter mode
194
+    for(size_t i = 0; i < quantity; ++i){
195
+      write(data[i]);
196
+    }
197
+  }else{
198
+  // in slave send mode
199
+    // reply to master
200
+    twi_transmit(data, quantity);
201
+  }
202
+  return quantity;
203
+}
204
+
205
+// must be called in:
206
+// slave rx event callback
207
+// or after requestFrom(address, numBytes)
208
+int TwoWire::available(void)
209
+{
210
+  return rxBufferLength - rxBufferIndex;
211
+}
212
+
213
+// must be called in:
214
+// slave rx event callback
215
+// or after requestFrom(address, numBytes)
216
+int TwoWire::read(void)
217
+{
218
+  int value = -1;
219
+  
220
+  // get each successive byte on each call
221
+  if(rxBufferIndex < rxBufferLength){
222
+    value = rxBuffer[rxBufferIndex];
223
+    ++rxBufferIndex;
224
+  }
225
+
226
+  return value;
227
+}
228
+
229
+// must be called in:
230
+// slave rx event callback
231
+// or after requestFrom(address, numBytes)
232
+int TwoWire::peek(void)
233
+{
234
+  int value = -1;
235
+  
236
+  if(rxBufferIndex < rxBufferLength){
237
+    value = rxBuffer[rxBufferIndex];
238
+  }
239
+
240
+  return value;
241
+}
242
+
243
+void TwoWire::flush(void)
244
+{
245
+  // XXX: to be implemented.
246
+}
247
+
248
+// behind the scenes function that is called when data is received
249
+void TwoWire::onReceiveService(uint8_t* inBytes, int numBytes)
250
+{
251
+  // don't bother if user hasn't registered a callback
252
+  if(!user_onReceive){
253
+    return;
254
+  }
255
+  // don't bother if rx buffer is in use by a master requestFrom() op
256
+  // i know this drops data, but it allows for slight stupidity
257
+  // meaning, they may not have read all the master requestFrom() data yet
258
+  if(rxBufferIndex < rxBufferLength){
259
+    return;
260
+  }
261
+  // copy twi rx buffer into local read buffer
262
+  // this enables new reads to happen in parallel
263
+  for(uint8_t i = 0; i < numBytes; ++i){
264
+    rxBuffer[i] = inBytes[i];    
265
+  }
266
+  // set rx iterator vars
267
+  rxBufferIndex = 0;
268
+  rxBufferLength = numBytes;
269
+  // alert user program
270
+  user_onReceive(numBytes);
271
+}
272
+
273
+// behind the scenes function that is called when data is requested
274
+void TwoWire::onRequestService(void)
275
+{
276
+  // don't bother if user hasn't registered a callback
277
+  if(!user_onRequest){
278
+    return;
279
+  }
280
+  // reset tx buffer iterator vars
281
+  // !!! this will kill any pending pre-master sendTo() activity
282
+  txBufferIndex = 0;
283
+  txBufferLength = 0;
284
+  // alert user program
285
+  user_onRequest();
286
+}
287
+
288
+// sets function called on slave write
289
+void TwoWire::onReceive( void (*function)(int) )
290
+{
291
+  user_onReceive = function;
292
+}
293
+
294
+// sets function called on slave read
295
+void TwoWire::onRequest( void (*function)(void) )
296
+{
297
+  user_onRequest = function;
298
+}
299
+
300
+// Preinstantiate Objects //////////////////////////////////////////////////////
301
+
302
+TwoWire Wire = TwoWire();
303
+

+ 80
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/Wire.h View File

@@ -0,0 +1,80 @@
1
+/*
2
+  TwoWire.h - TWI/I2C library for Arduino & Wiring
3
+  Copyright (c) 2006 Nicholas Zambetti.  All right reserved.
4
+
5
+  This library is free software; you can redistribute it and/or
6
+  modify it under the terms of the GNU Lesser General Public
7
+  License as published by the Free Software Foundation; either
8
+  version 2.1 of the License, or (at your option) any later version.
9
+
10
+  This library is distributed in the hope that it will be useful,
11
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+  Lesser General Public License for more details.
14
+
15
+  You should have received a copy of the GNU Lesser General Public
16
+  License along with this library; if not, write to the Free Software
17
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
+
19
+  Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
20
+*/
21
+
22
+#ifndef TwoWire_h
23
+#define TwoWire_h
24
+
25
+#include <inttypes.h>
26
+#include "Stream.h"
27
+
28
+#define BUFFER_LENGTH 32
29
+
30
+class TwoWire : public Stream
31
+{
32
+  private:
33
+    static uint8_t rxBuffer[];
34
+    static uint8_t rxBufferIndex;
35
+    static uint8_t rxBufferLength;
36
+
37
+    static uint8_t txAddress;
38
+    static uint8_t txBuffer[];
39
+    static uint8_t txBufferIndex;
40
+    static uint8_t txBufferLength;
41
+
42
+    static uint8_t transmitting;
43
+    static void (*user_onRequest)(void);
44
+    static void (*user_onReceive)(int);
45
+    static void onRequestService(void);
46
+    static void onReceiveService(uint8_t*, int);
47
+  public:
48
+    TwoWire();
49
+    void begin();
50
+    void begin(uint8_t);
51
+    void begin(int);
52
+    void setClock(uint32_t);
53
+    void beginTransmission(uint8_t);
54
+    void beginTransmission(int);
55
+    uint8_t endTransmission(void);
56
+    uint8_t endTransmission(uint8_t);
57
+    uint8_t requestFrom(uint8_t, uint8_t);
58
+    uint8_t requestFrom(uint8_t, uint8_t, uint8_t);
59
+    uint8_t requestFrom(int, int);
60
+    uint8_t requestFrom(int, int, int);
61
+    virtual size_t write(uint8_t);
62
+    virtual size_t write(const uint8_t *, size_t);
63
+    virtual int available(void);
64
+    virtual int read(void);
65
+    virtual int peek(void);
66
+    virtual void flush(void);
67
+    void onReceive( void (*)(int) );
68
+    void onRequest( void (*)(void) );
69
+
70
+    inline size_t write(unsigned long n) { return write((uint8_t)n); }
71
+    inline size_t write(long n) { return write((uint8_t)n); }
72
+    inline size_t write(unsigned int n) { return write((uint8_t)n); }
73
+    inline size_t write(int n) { return write((uint8_t)n); }
74
+    using Print::write;
75
+};
76
+
77
+extern TwoWire Wire;
78
+
79
+#endif
80
+

+ 87
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino View File

@@ -0,0 +1,87 @@
1
+// I2C SRF10 or SRF08 Devantech Ultrasonic Ranger Finder
2
+// by Nicholas Zambetti <http://www.zambetti.com>
3
+// and James Tichenor <http://www.jamestichenor.net>
4
+
5
+// Demonstrates use of the Wire library reading data from the
6
+// Devantech Utrasonic Rangers SFR08 and SFR10
7
+
8
+// Created 29 April 2006
9
+
10
+// This example code is in the public domain.
11
+
12
+
13
+#include <Wire.h>
14
+
15
+void setup()
16
+{
17
+  Wire.begin();                // join i2c bus (address optional for master)
18
+  Serial.begin(9600);          // start serial communication at 9600bps
19
+}
20
+
21
+int reading = 0;
22
+
23
+void loop()
24
+{
25
+  // step 1: instruct sensor to read echoes
26
+  Wire.beginTransmission(112); // transmit to device #112 (0x70)
27
+  // the address specified in the datasheet is 224 (0xE0)
28
+  // but i2c adressing uses the high 7 bits so it's 112
29
+  Wire.write(byte(0x00));      // sets register pointer to the command register (0x00)
30
+  Wire.write(byte(0x50));      // command sensor to measure in "inches" (0x50)
31
+  // use 0x51 for centimeters
32
+  // use 0x52 for ping microseconds
33
+  Wire.endTransmission();      // stop transmitting
34
+
35
+  // step 2: wait for readings to happen
36
+  delay(70);                   // datasheet suggests at least 65 milliseconds
37
+
38
+  // step 3: instruct sensor to return a particular echo reading
39
+  Wire.beginTransmission(112); // transmit to device #112
40
+  Wire.write(byte(0x02));      // sets register pointer to echo #1 register (0x02)
41
+  Wire.endTransmission();      // stop transmitting
42
+
43
+  // step 4: request reading from sensor
44
+  Wire.requestFrom(112, 2);    // request 2 bytes from slave device #112
45
+
46
+  // step 5: receive reading from sensor
47
+  if (2 <= Wire.available())   // if two bytes were received
48
+  {
49
+    reading = Wire.read();  // receive high byte (overwrites previous reading)
50
+    reading = reading << 8;    // shift high byte to be high 8 bits
51
+    reading |= Wire.read(); // receive low byte as lower 8 bits
52
+    Serial.println(reading);   // print the reading
53
+  }
54
+
55
+  delay(250);                  // wait a bit since people have to read the output :)
56
+}
57
+
58
+
59
+/*
60
+
61
+// The following code changes the address of a Devantech Ultrasonic Range Finder (SRF10 or SRF08)
62
+// usage: changeAddress(0x70, 0xE6);
63
+
64
+void changeAddress(byte oldAddress, byte newAddress)
65
+{
66
+  Wire.beginTransmission(oldAddress);
67
+  Wire.write(byte(0x00));
68
+  Wire.write(byte(0xA0));
69
+  Wire.endTransmission();
70
+
71
+  Wire.beginTransmission(oldAddress);
72
+  Wire.write(byte(0x00));
73
+  Wire.write(byte(0xAA));
74
+  Wire.endTransmission();
75
+
76
+  Wire.beginTransmission(oldAddress);
77
+  Wire.write(byte(0x00));
78
+  Wire.write(byte(0xA5));
79
+  Wire.endTransmission();
80
+
81
+  Wire.beginTransmission(oldAddress);
82
+  Wire.write(byte(0x00));
83
+  Wire.write(newAddress);
84
+  Wire.endTransmission();
85
+}
86
+
87
+*/

+ 39
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/examples/digital_potentiometer/digital_potentiometer.ino View File

@@ -0,0 +1,39 @@
1
+// I2C Digital Potentiometer
2
+// by Nicholas Zambetti <http://www.zambetti.com>
3
+// and Shawn Bonkowski <http://people.interaction-ivrea.it/s.bonkowski/>
4
+
5
+// Demonstrates use of the Wire library
6
+// Controls AD5171 digital potentiometer via I2C/TWI
7
+
8
+// Created 31 March 2006
9
+
10
+// This example code is in the public domain.
11
+
12
+// This example code is in the public domain.
13
+
14
+
15
+#include <Wire.h>
16
+
17
+void setup()
18
+{
19
+  Wire.begin(); // join i2c bus (address optional for master)
20
+}
21
+
22
+byte val = 0;
23
+
24
+void loop()
25
+{
26
+  Wire.beginTransmission(44); // transmit to device #44 (0x2c)
27
+  // device address is specified in datasheet
28
+  Wire.write(byte(0x00));            // sends instruction byte
29
+  Wire.write(val);             // sends potentiometer value byte
30
+  Wire.endTransmission();     // stop transmitting
31
+
32
+  val++;        // increment value
33
+  if (val == 64) // if reached 64th position (max)
34
+  {
35
+    val = 0;    // start over from lowest value
36
+  }
37
+  delay(500);
38
+}
39
+

+ 32
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/examples/master_reader/master_reader.ino View File

@@ -0,0 +1,32 @@
1
+// Wire Master Reader
2
+// by Nicholas Zambetti <http://www.zambetti.com>
3
+
4
+// Demonstrates use of the Wire library
5
+// Reads data from an I2C/TWI slave device
6
+// Refer to the "Wire Slave Sender" example for use with this
7
+
8
+// Created 29 March 2006
9
+
10
+// This example code is in the public domain.
11
+
12
+
13
+#include <Wire.h>
14
+
15
+void setup()
16
+{
17
+  Wire.begin();        // join i2c bus (address optional for master)
18
+  Serial.begin(9600);  // start serial for output
19
+}
20
+
21
+void loop()
22
+{
23
+  Wire.requestFrom(2, 6);    // request 6 bytes from slave device #2
24
+
25
+  while (Wire.available())   // slave may send less than requested
26
+  {
27
+    char c = Wire.read(); // receive a byte as character
28
+    Serial.print(c);         // print the character
29
+  }
30
+
31
+  delay(500);
32
+}

+ 31
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/examples/master_writer/master_writer.ino View File

@@ -0,0 +1,31 @@
1
+// Wire Master Writer
2
+// by Nicholas Zambetti <http://www.zambetti.com>
3
+
4
+// Demonstrates use of the Wire library
5
+// Writes data to an I2C/TWI slave device
6
+// Refer to the "Wire Slave Receiver" example for use with this
7
+
8
+// Created 29 March 2006
9
+
10
+// This example code is in the public domain.
11
+
12
+
13
+#include <Wire.h>
14
+
15
+void setup()
16
+{
17
+  Wire.begin(); // join i2c bus (address optional for master)
18
+}
19
+
20
+byte x = 0;
21
+
22
+void loop()
23
+{
24
+  Wire.beginTransmission(4); // transmit to device #4
25
+  Wire.write("x is ");        // sends five bytes
26
+  Wire.write(x);              // sends one byte
27
+  Wire.endTransmission();    // stop transmitting
28
+
29
+  x++;
30
+  delay(500);
31
+}

+ 38
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/examples/slave_receiver/slave_receiver.ino View File

@@ -0,0 +1,38 @@
1
+// Wire Slave Receiver
2
+// by Nicholas Zambetti <http://www.zambetti.com>
3
+
4
+// Demonstrates use of the Wire library
5
+// Receives data as an I2C/TWI slave device
6
+// Refer to the "Wire Master Writer" example for use with this
7
+
8
+// Created 29 March 2006
9
+
10
+// This example code is in the public domain.
11
+
12
+
13
+#include <Wire.h>
14
+
15
+void setup()
16
+{
17
+  Wire.begin(4);                // join i2c bus with address #4
18
+  Wire.onReceive(receiveEvent); // register event
19
+  Serial.begin(9600);           // start serial for output
20
+}
21
+
22
+void loop()
23
+{
24
+  delay(100);
25
+}
26
+
27
+// function that executes whenever data is received from master
28
+// this function is registered as an event, see setup()
29
+void receiveEvent(int howMany)
30
+{
31
+  while (1 < Wire.available()) // loop through all but the last
32
+  {
33
+    char c = Wire.read(); // receive byte as a character
34
+    Serial.print(c);         // print the character
35
+  }
36
+  int x = Wire.read();    // receive byte as an integer
37
+  Serial.println(x);         // print the integer
38
+}

+ 32
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/examples/slave_sender/slave_sender.ino View File

@@ -0,0 +1,32 @@
1
+// Wire Slave Sender
2
+// by Nicholas Zambetti <http://www.zambetti.com>
3
+
4
+// Demonstrates use of the Wire library
5
+// Sends data as an I2C/TWI slave device
6
+// Refer to the "Wire Master Reader" example for use with this
7
+
8
+// Created 29 March 2006
9
+
10
+// This example code is in the public domain.
11
+
12
+
13
+#include <Wire.h>
14
+
15
+void setup()
16
+{
17
+  Wire.begin(2);                // join i2c bus with address #2
18
+  Wire.onRequest(requestEvent); // register event
19
+}
20
+
21
+void loop()
22
+{
23
+  delay(100);
24
+}
25
+
26
+// function that executes whenever data is requested by master
27
+// this function is registered as an event, see setup()
28
+void requestEvent()
29
+{
30
+  Wire.write("hello "); // respond with message of 6 bytes
31
+  // as expected by master
32
+}

+ 32
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/keywords.txt View File

@@ -0,0 +1,32 @@
1
+#######################################
2
+# Syntax Coloring Map For Wire
3
+#######################################
4
+
5
+#######################################
6
+# Datatypes (KEYWORD1)
7
+#######################################
8
+
9
+#######################################
10
+# Methods and Functions (KEYWORD2)
11
+#######################################
12
+
13
+begin	KEYWORD2
14
+setClock	KEYWORD2
15
+beginTransmission	KEYWORD2
16
+endTransmission	KEYWORD2
17
+requestFrom	KEYWORD2
18
+send	KEYWORD2
19
+receive	KEYWORD2
20
+onReceive	KEYWORD2
21
+onRequest	KEYWORD2
22
+
23
+#######################################
24
+# Instances (KEYWORD2)
25
+#######################################
26
+
27
+Wire	KEYWORD2
28
+
29
+#######################################
30
+# Constants (LITERAL1)
31
+#######################################
32
+

+ 8
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/library.properties View File

@@ -0,0 +1,8 @@
1
+name=Wire
2
+version=1.0
3
+author=Arduino
4
+maintainer=Arduino <info@arduino.cc>
5
+sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. For all Arduino boards, BUT Arduino DUE. 
6
+paragraph=
7
+url=http://arduino.cc/en/Reference/Wire
8
+architectures=avr

+ 527
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/utility/twi.c View File

@@ -0,0 +1,527 @@
1
+/*
2
+  twi.c - TWI/I2C library for Wiring & Arduino
3
+  Copyright (c) 2006 Nicholas Zambetti.  All right reserved.
4
+
5
+  This library is free software; you can redistribute it and/or
6
+  modify it under the terms of the GNU Lesser General Public
7
+  License as published by the Free Software Foundation; either
8
+  version 2.1 of the License, or (at your option) any later version.
9
+
10
+  This library is distributed in the hope that it will be useful,
11
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+  Lesser General Public License for more details.
14
+
15
+  You should have received a copy of the GNU Lesser General Public
16
+  License along with this library; if not, write to the Free Software
17
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
+
19
+  Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
20
+*/
21
+
22
+#include <math.h>
23
+#include <stdlib.h>
24
+#include <inttypes.h>
25
+#include <avr/io.h>
26
+#include <avr/interrupt.h>
27
+#include <compat/twi.h>
28
+#include "Arduino.h" // for digitalWrite
29
+
30
+#ifndef cbi
31
+#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
32
+#endif
33
+
34
+#ifndef sbi
35
+#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
36
+#endif
37
+
38
+#include "pins_arduino.h"
39
+#include "twi.h"
40
+
41
+static volatile uint8_t twi_state;
42
+static volatile uint8_t twi_slarw;
43
+static volatile uint8_t twi_sendStop;			// should the transaction end with a stop
44
+static volatile uint8_t twi_inRepStart;			// in the middle of a repeated start
45
+
46
+static void (*twi_onSlaveTransmit)(void);
47
+static void (*twi_onSlaveReceive)(uint8_t*, int);
48
+
49
+static uint8_t twi_masterBuffer[TWI_BUFFER_LENGTH];
50
+static volatile uint8_t twi_masterBufferIndex;
51
+static volatile uint8_t twi_masterBufferLength;
52
+
53
+static uint8_t twi_txBuffer[TWI_BUFFER_LENGTH];
54
+static volatile uint8_t twi_txBufferIndex;
55
+static volatile uint8_t twi_txBufferLength;
56
+
57
+static uint8_t twi_rxBuffer[TWI_BUFFER_LENGTH];
58
+static volatile uint8_t twi_rxBufferIndex;
59
+
60
+static volatile uint8_t twi_error;
61
+
62
+/* 
63
+ * Function twi_init
64
+ * Desc     readys twi pins and sets twi bitrate
65
+ * Input    none
66
+ * Output   none
67
+ */
68
+void twi_init(void)
69
+{
70
+  // initialize state
71
+  twi_state = TWI_READY;
72
+  twi_sendStop = true;		// default value
73
+  twi_inRepStart = false;
74
+  
75
+  // activate internal pullups for twi.
76
+  digitalWrite(SDA, 1);
77
+  digitalWrite(SCL, 1);
78
+
79
+  // initialize twi prescaler and bit rate
80
+  cbi(TWSR, TWPS0);
81
+  cbi(TWSR, TWPS1);
82
+  TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;
83
+
84
+  /* twi bit rate formula from atmega128 manual pg 204
85
+  SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR))
86
+  note: TWBR should be 10 or higher for master mode
87
+  It is 72 for a 16mhz Wiring board with 100kHz TWI */
88
+
89
+  // enable twi module, acks, and twi interrupt
90
+  TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);
91
+}
92
+
93
+/* 
94
+ * Function twi_slaveInit
95
+ * Desc     sets slave address and enables interrupt
96
+ * Input    none
97
+ * Output   none
98
+ */
99
+void twi_setAddress(uint8_t address)
100
+{
101
+  // set twi slave address (skip over TWGCE bit)
102
+  TWAR = address << 1;
103
+}
104
+
105
+/* 
106
+ * Function twi_readFrom
107
+ * Desc     attempts to become twi bus master and read a
108
+ *          series of bytes from a device on the bus
109
+ * Input    address: 7bit i2c device address
110
+ *          data: pointer to byte array
111
+ *          length: number of bytes to read into array
112
+ *          sendStop: Boolean indicating whether to send a stop at the end
113
+ * Output   number of bytes read
114
+ */
115
+uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sendStop)
116
+{
117
+  uint8_t i;
118
+
119
+  // ensure data will fit into buffer
120
+  if(TWI_BUFFER_LENGTH < length){
121
+    return 0;
122
+  }
123
+
124
+  // wait until twi is ready, become master receiver
125
+  while(TWI_READY != twi_state){
126
+    continue;
127
+  }
128
+  twi_state = TWI_MRX;
129
+  twi_sendStop = sendStop;
130
+  // reset error state (0xFF.. no error occured)
131
+  twi_error = 0xFF;
132
+
133
+  // initialize buffer iteration vars
134
+  twi_masterBufferIndex = 0;
135
+  twi_masterBufferLength = length-1;  // This is not intuitive, read on...
136
+  // On receive, the previously configured ACK/NACK setting is transmitted in
137
+  // response to the received byte before the interrupt is signalled. 
138
+  // Therefor we must actually set NACK when the _next_ to last byte is
139
+  // received, causing that NACK to be sent in response to receiving the last
140
+  // expected byte of data.
141
+
142
+  // build sla+w, slave device address + w bit
143
+  twi_slarw = TW_READ;
144
+  twi_slarw |= address << 1;
145
+
146
+  if (true == twi_inRepStart) {
147
+    // if we're in the repeated start state, then we've already sent the start,
148
+    // (@@@ we hope), and the TWI statemachine is just waiting for the address byte.
149
+    // We need to remove ourselves from the repeated start state before we enable interrupts,
150
+    // since the ISR is ASYNC, and we could get confused if we hit the ISR before cleaning
151
+    // up. Also, don't enable the START interrupt. There may be one pending from the 
152
+    // repeated start that we sent outselves, and that would really confuse things.
153
+    twi_inRepStart = false;			// remember, we're dealing with an ASYNC ISR
154
+    TWDR = twi_slarw;
155
+    TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE);	// enable INTs, but not START
156
+  }
157
+  else
158
+    // send start condition
159
+    TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA);
160
+
161
+  // wait for read operation to complete
162
+  while(TWI_MRX == twi_state){
163
+    continue;
164
+  }
165
+
166
+  if (twi_masterBufferIndex < length)
167
+    length = twi_masterBufferIndex;
168
+
169
+  // copy twi buffer to data
170
+  for(i = 0; i < length; ++i){
171
+    data[i] = twi_masterBuffer[i];
172
+  }
173
+	
174
+  return length;
175
+}
176
+
177
+/* 
178
+ * Function twi_writeTo
179
+ * Desc     attempts to become twi bus master and write a
180
+ *          series of bytes to a device on the bus
181
+ * Input    address: 7bit i2c device address
182
+ *          data: pointer to byte array
183
+ *          length: number of bytes in array
184
+ *          wait: boolean indicating to wait for write or not
185
+ *          sendStop: boolean indicating whether or not to send a stop at the end
186
+ * Output   0 .. success
187
+ *          1 .. length to long for buffer
188
+ *          2 .. address send, NACK received
189
+ *          3 .. data send, NACK received
190
+ *          4 .. other twi error (lost bus arbitration, bus error, ..)
191
+ */
192
+uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait, uint8_t sendStop)
193
+{
194
+  uint8_t i;
195
+
196
+  // ensure data will fit into buffer
197
+  if(TWI_BUFFER_LENGTH < length){
198
+    return 1;
199
+  }
200
+
201
+  // wait until twi is ready, become master transmitter
202
+  while(TWI_READY != twi_state){
203
+    continue;
204
+  }
205
+  twi_state = TWI_MTX;
206
+  twi_sendStop = sendStop;
207
+  // reset error state (0xFF.. no error occured)
208
+  twi_error = 0xFF;
209
+
210
+  // initialize buffer iteration vars
211
+  twi_masterBufferIndex = 0;
212
+  twi_masterBufferLength = length;
213
+  
214
+  // copy data to twi buffer
215
+  for(i = 0; i < length; ++i){
216
+    twi_masterBuffer[i] = data[i];
217
+  }
218
+  
219
+  // build sla+w, slave device address + w bit
220
+  twi_slarw = TW_WRITE;
221
+  twi_slarw |= address << 1;
222
+  
223
+  // if we're in a repeated start, then we've already sent the START
224
+  // in the ISR. Don't do it again.
225
+  //
226
+  if (true == twi_inRepStart) {
227
+    // if we're in the repeated start state, then we've already sent the start,
228
+    // (@@@ we hope), and the TWI statemachine is just waiting for the address byte.
229
+    // We need to remove ourselves from the repeated start state before we enable interrupts,
230
+    // since the ISR is ASYNC, and we could get confused if we hit the ISR before cleaning
231
+    // up. Also, don't enable the START interrupt. There may be one pending from the 
232
+    // repeated start that we sent outselves, and that would really confuse things.
233
+    twi_inRepStart = false;			// remember, we're dealing with an ASYNC ISR
234
+    TWDR = twi_slarw;				
235
+    TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE);	// enable INTs, but not START
236
+  }
237
+  else
238
+    // send start condition
239
+    TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE) | _BV(TWSTA);	// enable INTs
240
+
241
+  // wait for write operation to complete
242
+  while(wait && (TWI_MTX == twi_state)){
243
+    continue;
244
+  }
245
+  
246
+  if (twi_error == 0xFF)
247
+    return 0;	// success
248
+  else if (twi_error == TW_MT_SLA_NACK)
249
+    return 2;	// error: address send, nack received
250
+  else if (twi_error == TW_MT_DATA_NACK)
251
+    return 3;	// error: data send, nack received
252
+  else
253
+    return 4;	// other twi error
254
+}
255
+
256
+/* 
257
+ * Function twi_transmit
258
+ * Desc     fills slave tx buffer with data
259
+ *          must be called in slave tx event callback
260
+ * Input    data: pointer to byte array
261
+ *          length: number of bytes in array
262
+ * Output   1 length too long for buffer
263
+ *          2 not slave transmitter
264
+ *          0 ok
265
+ */
266
+uint8_t twi_transmit(const uint8_t* data, uint8_t length)
267
+{
268
+  uint8_t i;
269
+
270
+  // ensure data will fit into buffer
271
+  if(TWI_BUFFER_LENGTH < length){
272
+    return 1;
273
+  }
274
+  
275
+  // ensure we are currently a slave transmitter
276
+  if(TWI_STX != twi_state){
277
+    return 2;
278
+  }
279
+  
280
+  // set length and copy data into tx buffer
281
+  twi_txBufferLength = length;
282
+  for(i = 0; i < length; ++i){
283
+    twi_txBuffer[i] = data[i];
284
+  }
285
+  
286
+  return 0;
287
+}
288
+
289
+/* 
290
+ * Function twi_attachSlaveRxEvent
291
+ * Desc     sets function called before a slave read operation
292
+ * Input    function: callback function to use
293
+ * Output   none
294
+ */
295
+void twi_attachSlaveRxEvent( void (*function)(uint8_t*, int) )
296
+{
297
+  twi_onSlaveReceive = function;
298
+}
299
+
300
+/* 
301
+ * Function twi_attachSlaveTxEvent
302
+ * Desc     sets function called before a slave write operation
303
+ * Input    function: callback function to use
304
+ * Output   none
305
+ */
306
+void twi_attachSlaveTxEvent( void (*function)(void) )
307
+{
308
+  twi_onSlaveTransmit = function;
309
+}
310
+
311
+/* 
312
+ * Function twi_reply
313
+ * Desc     sends byte or readys receive line
314
+ * Input    ack: byte indicating to ack or to nack
315
+ * Output   none
316
+ */
317
+void twi_reply(uint8_t ack)
318
+{
319
+  // transmit master read ready signal, with or without ack
320
+  if(ack){
321
+    TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT) | _BV(TWEA);
322
+  }else{
323
+	  TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT);
324
+  }
325
+}
326
+
327
+/* 
328
+ * Function twi_stop
329
+ * Desc     relinquishes bus master status
330
+ * Input    none
331
+ * Output   none
332
+ */
333
+void twi_stop(void)
334
+{
335
+  // send stop condition
336
+  TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTO);
337
+
338
+  // wait for stop condition to be exectued on bus
339
+  // TWINT is not set after a stop condition!
340
+  while(TWCR & _BV(TWSTO)){
341
+    continue;
342
+  }
343
+
344
+  // update twi state
345
+  twi_state = TWI_READY;
346
+}
347
+
348
+/* 
349
+ * Function twi_releaseBus
350
+ * Desc     releases bus control
351
+ * Input    none
352
+ * Output   none
353
+ */
354
+void twi_releaseBus(void)
355
+{
356
+  // release bus
357
+  TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT);
358
+
359
+  // update twi state
360
+  twi_state = TWI_READY;
361
+}
362
+
363
+ISR(TWI_vect)
364
+{
365
+  switch(TW_STATUS){
366
+    // All Master
367
+    case TW_START:     // sent start condition
368
+    case TW_REP_START: // sent repeated start condition
369
+      // copy device address and r/w bit to output register and ack
370
+      TWDR = twi_slarw;
371
+      twi_reply(1);
372
+      break;
373
+
374
+    // Master Transmitter
375
+    case TW_MT_SLA_ACK:  // slave receiver acked address
376
+    case TW_MT_DATA_ACK: // slave receiver acked data
377
+      // if there is data to send, send it, otherwise stop 
378
+      if(twi_masterBufferIndex < twi_masterBufferLength){
379
+        // copy data to output register and ack
380
+        TWDR = twi_masterBuffer[twi_masterBufferIndex++];
381
+        twi_reply(1);
382
+      }else{
383
+	if (twi_sendStop)
384
+          twi_stop();
385
+	else {
386
+	  twi_inRepStart = true;	// we're gonna send the START
387
+	  // don't enable the interrupt. We'll generate the start, but we 
388
+	  // avoid handling the interrupt until we're in the next transaction,
389
+	  // at the point where we would normally issue the start.
390
+	  TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
391
+	  twi_state = TWI_READY;
392
+	}
393
+      }
394
+      break;
395
+    case TW_MT_SLA_NACK:  // address sent, nack received
396
+      twi_error = TW_MT_SLA_NACK;
397
+      twi_stop();
398
+      break;
399
+    case TW_MT_DATA_NACK: // data sent, nack received
400
+      twi_error = TW_MT_DATA_NACK;
401
+      twi_stop();
402
+      break;
403
+    case TW_MT_ARB_LOST: // lost bus arbitration
404
+      twi_error = TW_MT_ARB_LOST;
405
+      twi_releaseBus();
406
+      break;
407
+
408
+    // Master Receiver
409
+    case TW_MR_DATA_ACK: // data received, ack sent
410
+      // put byte into buffer
411
+      twi_masterBuffer[twi_masterBufferIndex++] = TWDR;
412
+    case TW_MR_SLA_ACK:  // address sent, ack received
413
+      // ack if more bytes are expected, otherwise nack
414
+      if(twi_masterBufferIndex < twi_masterBufferLength){
415
+        twi_reply(1);
416
+      }else{
417
+        twi_reply(0);
418
+      }
419
+      break;
420
+    case TW_MR_DATA_NACK: // data received, nack sent
421
+      // put final byte into buffer
422
+      twi_masterBuffer[twi_masterBufferIndex++] = TWDR;
423
+	if (twi_sendStop)
424
+          twi_stop();
425
+	else {
426
+	  twi_inRepStart = true;	// we're gonna send the START
427
+	  // don't enable the interrupt. We'll generate the start, but we 
428
+	  // avoid handling the interrupt until we're in the next transaction,
429
+	  // at the point where we would normally issue the start.
430
+	  TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
431
+	  twi_state = TWI_READY;
432
+	}    
433
+	break;
434
+    case TW_MR_SLA_NACK: // address sent, nack received
435
+      twi_stop();
436
+      break;
437
+    // TW_MR_ARB_LOST handled by TW_MT_ARB_LOST case
438
+
439
+    // Slave Receiver
440
+    case TW_SR_SLA_ACK:   // addressed, returned ack
441
+    case TW_SR_GCALL_ACK: // addressed generally, returned ack
442
+    case TW_SR_ARB_LOST_SLA_ACK:   // lost arbitration, returned ack
443
+    case TW_SR_ARB_LOST_GCALL_ACK: // lost arbitration, returned ack
444
+      // enter slave receiver mode
445
+      twi_state = TWI_SRX;
446
+      // indicate that rx buffer can be overwritten and ack
447
+      twi_rxBufferIndex = 0;
448
+      twi_reply(1);
449
+      break;
450
+    case TW_SR_DATA_ACK:       // data received, returned ack
451
+    case TW_SR_GCALL_DATA_ACK: // data received generally, returned ack
452
+      // if there is still room in the rx buffer
453
+      if(twi_rxBufferIndex < TWI_BUFFER_LENGTH){
454
+        // put byte in buffer and ack
455
+        twi_rxBuffer[twi_rxBufferIndex++] = TWDR;
456
+        twi_reply(1);
457
+      }else{
458
+        // otherwise nack
459
+        twi_reply(0);
460
+      }
461
+      break;
462
+    case TW_SR_STOP: // stop or repeated start condition received
463
+      // put a null char after data if there's room
464
+      if(twi_rxBufferIndex < TWI_BUFFER_LENGTH){
465
+        twi_rxBuffer[twi_rxBufferIndex] = '\0';
466
+      }
467
+      // sends ack and stops interface for clock stretching
468
+      twi_stop();
469
+      // callback to user defined callback
470
+      twi_onSlaveReceive(twi_rxBuffer, twi_rxBufferIndex);
471
+      // since we submit rx buffer to "wire" library, we can reset it
472
+      twi_rxBufferIndex = 0;
473
+      // ack future responses and leave slave receiver state
474
+      twi_releaseBus();
475
+      break;
476
+    case TW_SR_DATA_NACK:       // data received, returned nack
477
+    case TW_SR_GCALL_DATA_NACK: // data received generally, returned nack
478
+      // nack back at master
479
+      twi_reply(0);
480
+      break;
481
+    
482
+    // Slave Transmitter
483
+    case TW_ST_SLA_ACK:          // addressed, returned ack
484
+    case TW_ST_ARB_LOST_SLA_ACK: // arbitration lost, returned ack
485
+      // enter slave transmitter mode
486
+      twi_state = TWI_STX;
487
+      // ready the tx buffer index for iteration
488
+      twi_txBufferIndex = 0;
489
+      // set tx buffer length to be zero, to verify if user changes it
490
+      twi_txBufferLength = 0;
491
+      // request for txBuffer to be filled and length to be set
492
+      // note: user must call twi_transmit(bytes, length) to do this
493
+      twi_onSlaveTransmit();
494
+      // if they didn't change buffer & length, initialize it
495
+      if(0 == twi_txBufferLength){
496
+        twi_txBufferLength = 1;
497
+        twi_txBuffer[0] = 0x00;
498
+      }
499
+      // transmit first byte from buffer, fall
500
+    case TW_ST_DATA_ACK: // byte sent, ack returned
501
+      // copy data to output register
502
+      TWDR = twi_txBuffer[twi_txBufferIndex++];
503
+      // if there is more to send, ack, otherwise nack
504
+      if(twi_txBufferIndex < twi_txBufferLength){
505
+        twi_reply(1);
506
+      }else{
507
+        twi_reply(0);
508
+      }
509
+      break;
510
+    case TW_ST_DATA_NACK: // received nack, we are done 
511
+    case TW_ST_LAST_DATA: // received ack, but we are done already!
512
+      // ack future responses
513
+      twi_reply(1);
514
+      // leave slave receiver state
515
+      twi_state = TWI_READY;
516
+      break;
517
+
518
+    // All
519
+    case TW_NO_INFO:   // no state information
520
+      break;
521
+    case TW_BUS_ERROR: // bus error, illegal stop/start
522
+      twi_error = TW_BUS_ERROR;
523
+      twi_stop();
524
+      break;
525
+  }
526
+}
527
+

+ 53
- 0
ArduinoAddons/Arduino_1.6.x/hardware/marlin/avr/libraries/Wire/utility/twi.h View File

@@ -0,0 +1,53 @@
1
+/*
2
+  twi.h - TWI/I2C library for Wiring & Arduino
3
+  Copyright (c) 2006 Nicholas Zambetti.  All right reserved.
4
+
5
+  This library is free software; you can redistribute it and/or
6
+  modify it under the terms of the GNU Lesser General Public
7
+  License as published by the Free Software Foundation; either
8
+  version 2.1 of the License, or (at your option) any later version.
9
+
10
+  This library is distributed in the hope that it will be useful,
11
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+  Lesser General Public License for more details.
14
+
15
+  You should have received a copy of the GNU Lesser General Public
16
+  License along with this library; if not, write to the Free Software
17
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
+*/
19
+
20
+#ifndef twi_h
21
+#define twi_h
22
+
23
+  #include <inttypes.h>
24
+
25
+  //#define ATMEGA8
26
+
27
+  #ifndef TWI_FREQ
28
+  #define TWI_FREQ 100000L
29
+  #endif
30
+
31
+  #ifndef TWI_BUFFER_LENGTH
32
+  #define TWI_BUFFER_LENGTH 32
33
+  #endif
34
+
35
+  #define TWI_READY 0
36
+  #define TWI_MRX   1
37
+  #define TWI_MTX   2
38
+  #define TWI_SRX   3
39
+  #define TWI_STX   4
40
+  
41
+  void twi_init(void);
42
+  void twi_setAddress(uint8_t);
43
+  uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t);
44
+  uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t);
45
+  uint8_t twi_transmit(const uint8_t*, uint8_t);
46
+  void twi_attachSlaveRxEvent( void (*)(uint8_t*, int) );
47
+  void twi_attachSlaveTxEvent( void (*)(void) );
48
+  void twi_reply(uint8_t);
49
+  void twi_stop(void);
50
+  void twi_releaseBus(void);
51
+
52
+#endif
53
+

Loading…
Cancel
Save