twi.h
Go to the documentation of this file.
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_disable(void);
43  void twi_setAddress(uint8_t);
45  uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t);
46  uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t);
47  uint8_t twi_transmit(const uint8_t*, uint8_t);
48  void twi_attachSlaveRxEvent( void (*)(uint8_t*, int) );
49  void twi_attachSlaveTxEvent( void (*)(void) );
50  void twi_reply(uint8_t);
51  void twi_stop(void);
52  void twi_releaseBus(void);
53 
54 #endif
55 
void twi_attachSlaveRxEvent(void(*)(uint8_t *, int))
Definition: twi.c:331
void twi_reply(uint8_t)
Definition: twi.c:353
uint8_t twi_writeTo(uint8_t, uint8_t *, uint8_t, uint8_t, uint8_t)
Definition: twi.c:226
void twi_disable(void)
Definition: twi.c:99
void twi_init(void)
Definition: twi.c:68
unsigned int uint32_t
void twi_stop(void)
Definition: twi.c:369
void twi_releaseBus(void)
Definition: twi.c:390
uint8_t twi_transmit(const uint8_t *, uint8_t)
Definition: twi.c:302
void twi_setFrequency(uint32_t)
Definition: twi.c:127
void twi_attachSlaveTxEvent(void(*)(void))
Definition: twi.c:342
void twi_setAddress(uint8_t)
Definition: twi.c:115
uint8_t twi_readFrom(uint8_t, uint8_t *, uint8_t, uint8_t)
Definition: twi.c:147


arduino_daq
Author(s):
autogenerated on Mon Jun 10 2019 12:46:03