Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
twi.h
00001 /* 00002 twi.h - TWI/I2C library for Wiring & Arduino 00003 Copyright (c) 2006 Nicholas Zambetti. All right reserved. 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Lesser General Public License for more details. 00012 You should have received a copy of the GNU Lesser General Public 00013 License along with this library; if not, write to the Free Software 00014 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00015 */ 00016 00017 #ifndef twi_h 00018 #define twi_h 00019 00020 #include <inttypes.h> 00021 00022 //#define ATMEGA8 00023 00024 #ifndef TWI_FREQ 00025 #define TWI_FREQ 100000L 00026 #endif 00027 00028 #ifndef TWI_BUFFER_LENGTH 00029 #define TWI_BUFFER_LENGTH 32 00030 #endif 00031 00032 #define TWI_READY 0 00033 #define TWI_MRX 1 00034 #define TWI_MTX 2 00035 #define TWI_SRX 3 00036 #define TWI_STX 4 00037 00038 void twi_init(void); 00039 void twi_setAddress(uint8_t); 00040 uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t); 00041 uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t); 00042 uint8_t twi_transmit(const uint8_t*, uint8_t); 00043 void twi_attachSlaveRxEvent( void (*)(uint8_t*, int) ); 00044 void twi_attachSlaveTxEvent( void (*)(void) ); 00045 void twi_reply(uint8_t); 00046 void twi_stop(void); 00047 void twi_releaseBus(void); 00048 00049 #endif
Generated on Sat Jul 16 2022 20:55:16 by
1.7.2