📄 tos.interfaces.i2c.nc.html
字号:
<html><head><title>Interface: I2C</title></head><body><table BORDER="0" CELLPADDING="3" CELLSPACING="0" width="100%"><tr><td><font size="-1"><b><font color="blue"><a href="apps_p.html">Apps</a></font></b> <b><a href="components_p.html">Components</a></b> <b><a href="interfaces_p.html">Interfaces</a></b> <b><a href="allfiles_p.html">All Files</a></b> <b><a href="index.html">Source Tree</a></b> </font></td><td align="right"><font size="-1">source: <b><a href="tos.interfaces.I2C.nc.source">tos.interfaces.I2C.nc</a></b></font></td></tr></table><hr><h1 align="center">Interface: I2C</h1><p> Byte and Command interface for using the I2C hardware bus <p><dl><dt>Components providing this interface:<dd> <a href="tos.platform.mica.I2CM.nc.html">tos.platform.mica.I2CM</a><br> <a href="tos.platform.mica128.I2CC.nc.html">tos.platform.mica128.I2CC</a><br></dl><p><dl><dt>Components requiring this interface:<dd> <a href="tos.sensorboards.micasb.I2CPotM.nc.html">tos.sensorboards.micasb.I2CPotM</a><br></dl><p><table BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><tr BGCOLOR="#CCCCFF"><td><h3>Commands</h3></td></tr></table><ul><li> result_t <b>sendStart</b>(void)<menu> Checks if the bus is free and sends a start condition <table border="0" cellpadding="0"><tr valign="top"><td><b>Returns:</b></td><td> SUCCESS if the start request is accepted, FAIL otherwise</td></tr></table></menu><p><li> result_t <b>sendEnd</b>(void)<menu> Sends a stop/end condition over the bus <table border="0" cellpadding="0"><tr valign="top"><td><b>Returns:</b></td><td> SUCCESS if the end request is accepted, FAIL otherwise</td></tr></table></menu><p><li> result_t <b>read</b>(bool ack)<menu> reads a single byte from the I2C bus from a slave device <table border="0" cellpadding="0"><tr valign="top"><td><b>Returns:</b></td><td> SUCCESS if the read request is accepted, FAIL otherwise</td></tr></table></menu><p><li> result_t <b>write</b>(char data)<menu> writes a single byte to the I2C bus from master to slave <table border="0" cellpadding="0"><tr valign="top"><td><b>Returns:</b></td><td> SUCCESS if the write request is accepted, FAIL otherwise</td></tr></table></menu><p></ul><table BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><tr BGCOLOR="#CCCCFF"><td><h3>Events</h3></td></tr></table><ul><li> result_t <b>sendStartDone</b>(void)<menu> Notifies that the start condition has been established <table border="0" cellpadding="0"><tr valign="top"><td><b>Returns:</b></td><td> SUCCESS to continue using the bus, FAIL to release it</td></tr></table></menu><p><li> result_t <b>sendEndDone</b>(void)<menu> Notifies that the end condition has been established <table border="0" cellpadding="0"><tr valign="top"><td><b>Returns:</b></td><td> Always return SUCCESS (you have released the bus)</td></tr></table></menu><p><li> result_t <b>readDone</b>(char data)<menu> Returns the byte read from the I2C bus <table border="0" cellpadding="0"><tr valign="top"><td><b>Returns:</b></td><td> SUCCESS to continue using the bus, FAIL to release it</td></tr></table></menu><p><li> result_t <b>writeDone</b>(bool success)<menu> Notifies that the byte has been written to the I2C bus <table border="0" cellpadding="0"></td></tr><tr valign="top"><td><br><b>Parameters:</b></td><td><menu><p STYLE="text-indent: -1cm"><b>success</b> - SUCCESS if the slave acknowledged the byte, FAIL otherwise </menu></td></tr><tr valign="top"><td><b>Returns:</b></td><td> SUCCESS to continue using the bus, FAIL to release it</td></tr></table></menu><p></ul>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -