PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
i2c_init.c
1 /*
2  * @file i2c_init.c
3  *
4  * @author Andy Lindsay
5  *
6  * @version 0.86
7  *
8  * @copyright Copyright (C) Parallax, Inc. 2013. See end of file for
9  * terms of use (MIT License).
10  *
11  * @brief i2c function source, see simpletools.h for documentation.
12  *
13  * @detail Please submit bug reports, suggestions, and improvements to
14  * this code to editor@parallax.com.
15  */
16 
17 #include "simpletools.h"
18 #include "simplei2c.h"
19 
20 #define MAX_I2C_BUS 8
21 
22 unsigned int st_buscnt = 0;
23 
24 static i2c list[MAX_I2C_BUS];
25 
26 i2c *i2c_newbus(int sclPin, int sdaPin, int sclDrive)
27 {
28  i2c *busID = i2c_open(&list[st_buscnt++], sclPin, sdaPin, sclDrive);
29  busID = &list[st_buscnt-1];
30  return busID;
31 }
32 
st_buscnt
unsigned int st_buscnt
Variable used by i2c_newbus.
Definition: i2c_init.c:22
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
i2c_newbus
i2c * i2c_newbus(int sclPin, int sdaPin, int sclDrive)
Set up a simple serial driver with transmit & receive pins.
Definition: i2c_init.c:26
i2c_st
Definition: simplei2c.h:25
i2c_open
HUBTEXT i2c * i2c_open(i2c *bus, int sclPin, int sdaPin, int sclDrive)
Open an i2c device.
Definition: simplei2c.c:60
simplei2c.h
Provides simple i2c start, stop, read, and write functions. See simpletools library for additional I2...