670 lines
35 KiB
HTML
670 lines
35 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.9.1"/>
|
|
<title>discoverpixy: Interrupts events and flags management functions</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { init_search(); });
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">discoverpixy
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.9.1 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">Interrupts events and flags management functions<div class="ingroups"><a class="el" href="group___s_t_m32_f4xx___std_periph___driver.html">STM32F4xx_StdPeriph_Driver</a> » <a class="el" href="group___i2_c.html">I2C</a> » <a class="el" href="group___i2_c___private___functions.html">I2C_Private_Functions</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Interrupts, events and flags management functions.
|
|
<a href="#details">More...</a></p>
|
|
<div class="dynheader">
|
|
Collaboration diagram for Interrupts events and flags management functions:</div>
|
|
<div class="dyncontent">
|
|
<center><table><tr><td><img src="group___i2_c___group5.png" border="0" alt="" usemap="#group______i2__c______group5"/>
|
|
<map name="group______i2__c______group5" id="group______i2__c______group5">
|
|
<area shape="rect" id="node1" href="group___i2_c___private___functions.html" title="I2C_Private_Functions" alt="" coords="5,13,156,39"/></map>
|
|
</td></tr></table></center>
|
|
</div>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:ga8021dc796d15f997356b0583d6346805"><td class="memItemLeft" align="right" valign="top">uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group___i2_c___group5.html#ga8021dc796d15f997356b0583d6346805">I2C_ReadRegister</a> (<a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> *I2Cx, uint8_t I2C_Register)</td></tr>
|
|
<tr class="memdesc:ga8021dc796d15f997356b0583d6346805"><td class="mdescLeft"> </td><td class="mdescRight">Reads the specified I2C register and returns its value. <a href="#ga8021dc796d15f997356b0583d6346805">More...</a><br /></td></tr>
|
|
<tr class="separator:ga8021dc796d15f997356b0583d6346805"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga58fed146a06cb81d2940604e460de047"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group___i2_c___group5.html#ga58fed146a06cb81d2940604e460de047">I2C_ITConfig</a> (<a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> *I2Cx, uint16_t I2C_IT, FunctionalState NewState)</td></tr>
|
|
<tr class="memdesc:ga58fed146a06cb81d2940604e460de047"><td class="mdescLeft"> </td><td class="mdescRight">Enables or disables the specified I2C interrupts. <a href="#ga58fed146a06cb81d2940604e460de047">More...</a><br /></td></tr>
|
|
<tr class="separator:ga58fed146a06cb81d2940604e460de047"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga2d5701342f9d4c1f09bf9d3cdcacc326"><td class="memItemLeft" align="right" valign="top">ErrorStatus </td><td class="memItemRight" valign="bottom"><a class="el" href="group___i2_c___group5.html#ga2d5701342f9d4c1f09bf9d3cdcacc326">I2C_CheckEvent</a> (<a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> *I2Cx, uint32_t I2C_EVENT)</td></tr>
|
|
<tr class="memdesc:ga2d5701342f9d4c1f09bf9d3cdcacc326"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether the last I2Cx Event is equal to the one passed as parameter. <a href="#ga2d5701342f9d4c1f09bf9d3cdcacc326">More...</a><br /></td></tr>
|
|
<tr class="separator:ga2d5701342f9d4c1f09bf9d3cdcacc326"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga29237aea9b5a3ead33167e1d027e9f1a"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group___i2_c___group5.html#ga29237aea9b5a3ead33167e1d027e9f1a">I2C_GetLastEvent</a> (<a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> *I2Cx)</td></tr>
|
|
<tr class="memdesc:ga29237aea9b5a3ead33167e1d027e9f1a"><td class="mdescLeft"> </td><td class="mdescRight">Returns the last I2Cx Event. <a href="#ga29237aea9b5a3ead33167e1d027e9f1a">More...</a><br /></td></tr>
|
|
<tr class="separator:ga29237aea9b5a3ead33167e1d027e9f1a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga15c95d0ed124f029621a2061b1677ee7"><td class="memItemLeft" align="right" valign="top">FlagStatus </td><td class="memItemRight" valign="bottom"><a class="el" href="group___i2_c___group5.html#ga15c95d0ed124f029621a2061b1677ee7">I2C_GetFlagStatus</a> (<a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> *I2Cx, uint32_t I2C_FLAG)</td></tr>
|
|
<tr class="memdesc:ga15c95d0ed124f029621a2061b1677ee7"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether the specified I2C flag is set or not. <a href="#ga15c95d0ed124f029621a2061b1677ee7">More...</a><br /></td></tr>
|
|
<tr class="separator:ga15c95d0ed124f029621a2061b1677ee7"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga9d4f8fe9f7232696114b5578b1223963"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group___i2_c___group5.html#ga9d4f8fe9f7232696114b5578b1223963">I2C_ClearFlag</a> (<a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> *I2Cx, uint32_t I2C_FLAG)</td></tr>
|
|
<tr class="memdesc:ga9d4f8fe9f7232696114b5578b1223963"><td class="mdescLeft"> </td><td class="mdescRight">Clears the I2Cx's pending flags. <a href="#ga9d4f8fe9f7232696114b5578b1223963">More...</a><br /></td></tr>
|
|
<tr class="separator:ga9d4f8fe9f7232696114b5578b1223963"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga447771fbbd94a56f3570b9f430a069ba"><td class="memItemLeft" align="right" valign="top">ITStatus </td><td class="memItemRight" valign="bottom"><a class="el" href="group___i2_c___group5.html#ga447771fbbd94a56f3570b9f430a069ba">I2C_GetITStatus</a> (<a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> *I2Cx, uint32_t I2C_IT)</td></tr>
|
|
<tr class="memdesc:ga447771fbbd94a56f3570b9f430a069ba"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether the specified I2C interrupt has occurred or not. <a href="#ga447771fbbd94a56f3570b9f430a069ba">More...</a><br /></td></tr>
|
|
<tr class="separator:ga447771fbbd94a56f3570b9f430a069ba"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga110dda440fa200b5f77349df19b3e6bb"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group___i2_c___group5.html#ga110dda440fa200b5f77349df19b3e6bb">I2C_ClearITPendingBit</a> (<a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> *I2Cx, uint32_t I2C_IT)</td></tr>
|
|
<tr class="memdesc:ga110dda440fa200b5f77349df19b3e6bb"><td class="mdescLeft"> </td><td class="mdescRight">Clears the I2Cx's interrupt pending bits. <a href="#ga110dda440fa200b5f77349df19b3e6bb">More...</a><br /></td></tr>
|
|
<tr class="separator:ga110dda440fa200b5f77349df19b3e6bb"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<p>Interrupts, events and flags management functions. </p>
|
|
<pre class="fragment"> ===============================================================================
|
|
##### Interrupts, events and flags management functions #####
|
|
===============================================================================
|
|
[..]
|
|
This section provides functions allowing to configure the I2C Interrupts
|
|
sources and check or clear the flags or pending bits status.
|
|
The user should identify which mode will be used in his application to manage
|
|
the communication: Polling mode, Interrupt mode or DMA mode.
|
|
|
|
|
|
##### I2C State Monitoring Functions #####
|
|
===============================================================================
|
|
[..]
|
|
This I2C driver provides three different ways for I2C state monitoring
|
|
depending on the application requirements and constraints:
|
|
|
|
|
|
(#) Basic state monitoring (Using I2C_CheckEvent() function)
|
|
|
|
It compares the status registers (SR1 and SR2) content to a given event
|
|
(can be the combination of one or more flags).
|
|
It returns SUCCESS if the current status includes the given flags
|
|
and returns ERROR if one or more flags are missing in the current status.
|
|
|
|
(++) When to use
|
|
(+++) This function is suitable for most applications as well as for startup
|
|
activity since the events are fully described in the product reference
|
|
manual (RM0090).
|
|
(+++) It is also suitable for users who need to define their own events.
|
|
|
|
(++) Limitations
|
|
If an error occurs (ie. error flags are set besides to the monitored
|
|
flags), the I2C_CheckEvent() function may return SUCCESS despite
|
|
the communication hold or corrupted real state.
|
|
In this case, it is advised to use error interrupts to monitor
|
|
the error events and handle them in the interrupt IRQ handler.
|
|
|
|
-@@- For error management, it is advised to use the following functions:
|
|
(+@@) I2C_ITConfig() to configure and enable the error interrupts (I2C_IT_ERR).
|
|
(+@@) I2Cx_ER_IRQHandler() which is called when the error interrupt occurs.
|
|
Where x is the peripheral instance (I2C1, I2C2 ...)
|
|
(+@@) I2C_GetFlagStatus() or I2C_GetITStatus() to be called into the
|
|
I2Cx_ER_IRQHandler() function in order to determine which error occurred.
|
|
(+@@) I2C_ClearFlag() or I2C_ClearITPendingBit() and/or I2C_SoftwareResetCmd()
|
|
and/or I2C_GenerateStop() in order to clear the error flag and source
|
|
and return to correct communication status.
|
|
|
|
|
|
(#) Advanced state monitoring (Using the function I2C_GetLastEvent())
|
|
|
|
Using the function I2C_GetLastEvent() which returns the image of both status
|
|
registers in a single word (uint32_t) (Status Register 2 value is shifted left
|
|
by 16 bits and concatenated to Status Register 1).
|
|
|
|
(++) When to use
|
|
(+++) This function is suitable for the same applications above but it
|
|
allows to overcome the mentioned limitation of I2C_GetFlagStatus()
|
|
function.
|
|
(+++) The returned value could be compared to events already defined in
|
|
the library (stm32f4xx_i2c.h) or to custom values defined by user.
|
|
This function is suitable when multiple flags are monitored at the
|
|
same time.
|
|
(+++) At the opposite of I2C_CheckEvent() function, this function allows
|
|
user to choose when an event is accepted (when all events flags are
|
|
set and no other flags are set or just when the needed flags are set
|
|
like I2C_CheckEvent() function.
|
|
|
|
(++) Limitations
|
|
(+++) User may need to define his own events.
|
|
(+++) Same remark concerning the error management is applicable for this
|
|
function if user decides to check only regular communication flags
|
|
(and ignores error flags).
|
|
|
|
|
|
(#) Flag-based state monitoring (Using the function I2C_GetFlagStatus())
|
|
|
|
Using the function I2C_GetFlagStatus() which simply returns the status of
|
|
one single flag (ie. I2C_FLAG_RXNE ...).
|
|
|
|
(++) When to use
|
|
(+++) This function could be used for specific applications or in debug
|
|
phase.
|
|
(+++) It is suitable when only one flag checking is needed (most I2C
|
|
events are monitored through multiple flags).
|
|
(++) Limitations:
|
|
(+++) When calling this function, the Status register is accessed.
|
|
Some flags are cleared when the status register is accessed.
|
|
So checking the status of one Flag, may clear other ones.
|
|
(+++) Function may need to be called twice or more in order to monitor
|
|
one single event.
|
|
|
|
For detailed description of Events, please refer to section I2C_Events in
|
|
stm32f4xx_i2c.h file.</pre> <h2 class="groupheader">Function Documentation</h2>
|
|
<a class="anchor" id="ga2d5701342f9d4c1f09bf9d3cdcacc326"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">ErrorStatus I2C_CheckEvent </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> * </td>
|
|
<td class="paramname"><em>I2Cx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>I2C_EVENT</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Checks whether the last I2Cx Event is equal to the one passed as parameter. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">I2Cx</td><td>where x can be 1, 2 or 3 to select the I2C peripheral. </td></tr>
|
|
<tr><td class="paramname">I2C_EVENT</td><td>specifies the event to be checked. This parameter can be one of the following values: <ul>
|
|
<li>I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED: EV1 </li>
|
|
<li>I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED: EV1 </li>
|
|
<li>I2C_EVENT_SLAVE_TRANSMITTER_SECONDADDRESS_MATCHED: EV1 </li>
|
|
<li>I2C_EVENT_SLAVE_RECEIVER_SECONDADDRESS_MATCHED: EV1 </li>
|
|
<li>I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED: EV1 </li>
|
|
<li>I2C_EVENT_SLAVE_BYTE_RECEIVED: EV2 </li>
|
|
<li>(I2C_EVENT_SLAVE_BYTE_RECEIVED | I2C_FLAG_DUALF): EV2 </li>
|
|
<li>(I2C_EVENT_SLAVE_BYTE_RECEIVED | I2C_FLAG_GENCALL): EV2 </li>
|
|
<li>I2C_EVENT_SLAVE_BYTE_TRANSMITTED: EV3 </li>
|
|
<li>(I2C_EVENT_SLAVE_BYTE_TRANSMITTED | I2C_FLAG_DUALF): EV3 </li>
|
|
<li>(I2C_EVENT_SLAVE_BYTE_TRANSMITTED | I2C_FLAG_GENCALL): EV3 </li>
|
|
<li>I2C_EVENT_SLAVE_ACK_FAILURE: EV3_2 </li>
|
|
<li>I2C_EVENT_SLAVE_STOP_DETECTED: EV4 </li>
|
|
<li>I2C_EVENT_MASTER_MODE_SELECT: EV5 </li>
|
|
<li>I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED: EV6 </li>
|
|
<li>I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED: EV6 </li>
|
|
<li>I2C_EVENT_MASTER_BYTE_RECEIVED: EV7 </li>
|
|
<li>I2C_EVENT_MASTER_BYTE_TRANSMITTING: EV8 </li>
|
|
<li>I2C_EVENT_MASTER_BYTE_TRANSMITTED: EV8_2 </li>
|
|
<li>I2C_EVENT_MASTER_MODE_ADDRESS10: EV9</li>
|
|
</ul>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section note"><dt>Note</dt><dd>For detailed description of Events, please refer to section I2C_Events in <a class="el" href="stm32f4xx__i2c_8h.html" title="This file contains all the functions prototypes for the I2C firmware library. ">stm32f4xx_i2c.h</a> file.</dd></dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">An</td><td>ErrorStatus enumeration value:<ul>
|
|
<li>SUCCESS: Last event is equal to the I2C_EVENT</li>
|
|
<li>ERROR: Last event is different from the I2C_EVENT </li>
|
|
</ul>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga9d4f8fe9f7232696114b5578b1223963"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void I2C_ClearFlag </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> * </td>
|
|
<td class="paramname"><em>I2Cx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>I2C_FLAG</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Clears the I2Cx's pending flags. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">I2Cx</td><td>where x can be 1, 2 or 3 to select the I2C peripheral. </td></tr>
|
|
<tr><td class="paramname">I2C_FLAG</td><td>specifies the flag to clear. This parameter can be any combination of the following values: <ul>
|
|
<li>I2C_FLAG_SMBALERT: SMBus Alert flag </li>
|
|
<li>I2C_FLAG_TIMEOUT: Timeout or Tlow error flag </li>
|
|
<li>I2C_FLAG_PECERR: PEC error in reception flag </li>
|
|
<li>I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode) </li>
|
|
<li>I2C_FLAG_AF: Acknowledge failure flag </li>
|
|
<li>I2C_FLAG_ARLO: Arbitration lost flag (Master mode) </li>
|
|
<li>I2C_FLAG_BERR: Bus error flag</li>
|
|
</ul>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section note"><dt>Note</dt><dd>STOPF (STOP detection) is cleared by software sequence: a read operation to I2C_SR1 register (<a class="el" href="group___i2_c___group5.html#ga15c95d0ed124f029621a2061b1677ee7" title="Checks whether the specified I2C flag is set or not. ">I2C_GetFlagStatus()</a>) followed by a write operation to I2C_CR1 register (<a class="el" href="group___i2_c___group1.html#ga7e1323c9133c2cb424dfb5b10b7d2f0b" title="Enables or disables the specified I2C peripheral. ">I2C_Cmd()</a> to re-enable the I2C peripheral). </dd>
|
|
<dd>
|
|
ADD10 (10-bit header sent) is cleared by software sequence: a read operation to I2C_SR1 (<a class="el" href="group___i2_c___group5.html#ga15c95d0ed124f029621a2061b1677ee7" title="Checks whether the specified I2C flag is set or not. ">I2C_GetFlagStatus()</a>) followed by writing the second byte of the address in DR register. </dd>
|
|
<dd>
|
|
BTF (Byte Transfer Finished) is cleared by software sequence: a read operation to I2C_SR1 register (<a class="el" href="group___i2_c___group5.html#ga15c95d0ed124f029621a2061b1677ee7" title="Checks whether the specified I2C flag is set or not. ">I2C_GetFlagStatus()</a>) followed by a read/write to I2C_DR register (<a class="el" href="group___i2_c___group2.html#ga7bd9e70b8eafde0dd5eb42b0d95fe1a9" title="Sends a data byte through the I2Cx peripheral. ">I2C_SendData()</a>). </dd>
|
|
<dd>
|
|
ADDR (Address sent) is cleared by software sequence: a read operation to I2C_SR1 register (<a class="el" href="group___i2_c___group5.html#ga15c95d0ed124f029621a2061b1677ee7" title="Checks whether the specified I2C flag is set or not. ">I2C_GetFlagStatus()</a>) followed by a read operation to I2C_SR2 register ((void)(I2Cx->SR2)). </dd>
|
|
<dd>
|
|
SB (Start Bit) is cleared software sequence: a read operation to I2C_SR1 register (<a class="el" href="group___i2_c___group5.html#ga15c95d0ed124f029621a2061b1677ee7" title="Checks whether the specified I2C flag is set or not. ">I2C_GetFlagStatus()</a>) followed by a write operation to I2C_DR register (<a class="el" href="group___i2_c___group2.html#ga7bd9e70b8eafde0dd5eb42b0d95fe1a9" title="Sends a data byte through the I2Cx peripheral. ">I2C_SendData()</a>).</dd></dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">None</td><td></td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga110dda440fa200b5f77349df19b3e6bb"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void I2C_ClearITPendingBit </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> * </td>
|
|
<td class="paramname"><em>I2Cx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>I2C_IT</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Clears the I2Cx's interrupt pending bits. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">I2Cx</td><td>where x can be 1, 2 or 3 to select the I2C peripheral. </td></tr>
|
|
<tr><td class="paramname">I2C_IT</td><td>specifies the interrupt pending bit to clear. This parameter can be any combination of the following values: <ul>
|
|
<li>I2C_IT_SMBALERT: SMBus Alert interrupt </li>
|
|
<li>I2C_IT_TIMEOUT: Timeout or Tlow error interrupt </li>
|
|
<li>I2C_IT_PECERR: PEC error in reception interrupt </li>
|
|
<li>I2C_IT_OVR: Overrun/Underrun interrupt (Slave mode) </li>
|
|
<li>I2C_IT_AF: Acknowledge failure interrupt </li>
|
|
<li>I2C_IT_ARLO: Arbitration lost interrupt (Master mode) </li>
|
|
<li>I2C_IT_BERR: Bus error interrupt</li>
|
|
</ul>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section note"><dt>Note</dt><dd>STOPF (STOP detection) is cleared by software sequence: a read operation to I2C_SR1 register (<a class="el" href="group___i2_c___group5.html#ga447771fbbd94a56f3570b9f430a069ba" title="Checks whether the specified I2C interrupt has occurred or not. ">I2C_GetITStatus()</a>) followed by a write operation to I2C_CR1 register (<a class="el" href="group___i2_c___group1.html#ga7e1323c9133c2cb424dfb5b10b7d2f0b" title="Enables or disables the specified I2C peripheral. ">I2C_Cmd()</a> to re-enable the I2C peripheral). </dd>
|
|
<dd>
|
|
ADD10 (10-bit header sent) is cleared by software sequence: a read operation to I2C_SR1 (<a class="el" href="group___i2_c___group5.html#ga447771fbbd94a56f3570b9f430a069ba" title="Checks whether the specified I2C interrupt has occurred or not. ">I2C_GetITStatus()</a>) followed by writing the second byte of the address in I2C_DR register. </dd>
|
|
<dd>
|
|
BTF (Byte Transfer Finished) is cleared by software sequence: a read operation to I2C_SR1 register (<a class="el" href="group___i2_c___group5.html#ga447771fbbd94a56f3570b9f430a069ba" title="Checks whether the specified I2C interrupt has occurred or not. ">I2C_GetITStatus()</a>) followed by a read/write to I2C_DR register (<a class="el" href="group___i2_c___group2.html#ga7bd9e70b8eafde0dd5eb42b0d95fe1a9" title="Sends a data byte through the I2Cx peripheral. ">I2C_SendData()</a>). </dd>
|
|
<dd>
|
|
ADDR (Address sent) is cleared by software sequence: a read operation to I2C_SR1 register (<a class="el" href="group___i2_c___group5.html#ga447771fbbd94a56f3570b9f430a069ba" title="Checks whether the specified I2C interrupt has occurred or not. ">I2C_GetITStatus()</a>) followed by a read operation to I2C_SR2 register ((void)(I2Cx->SR2)). </dd>
|
|
<dd>
|
|
SB (Start Bit) is cleared by software sequence: a read operation to I2C_SR1 register (<a class="el" href="group___i2_c___group5.html#ga447771fbbd94a56f3570b9f430a069ba" title="Checks whether the specified I2C interrupt has occurred or not. ">I2C_GetITStatus()</a>) followed by a write operation to I2C_DR register (<a class="el" href="group___i2_c___group2.html#ga7bd9e70b8eafde0dd5eb42b0d95fe1a9" title="Sends a data byte through the I2Cx peripheral. ">I2C_SendData()</a>). </dd></dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">None</td><td></td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga15c95d0ed124f029621a2061b1677ee7"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">FlagStatus I2C_GetFlagStatus </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> * </td>
|
|
<td class="paramname"><em>I2Cx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>I2C_FLAG</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Checks whether the specified I2C flag is set or not. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">I2Cx</td><td>where x can be 1, 2 or 3 to select the I2C peripheral. </td></tr>
|
|
<tr><td class="paramname">I2C_FLAG</td><td>specifies the flag to check. This parameter can be one of the following values: <ul>
|
|
<li>I2C_FLAG_DUALF: Dual flag (Slave mode) </li>
|
|
<li>I2C_FLAG_SMBHOST: SMBus host header (Slave mode) </li>
|
|
<li>I2C_FLAG_SMBDEFAULT: SMBus default header (Slave mode) </li>
|
|
<li>I2C_FLAG_GENCALL: General call header flag (Slave mode) </li>
|
|
<li>I2C_FLAG_TRA: Transmitter/Receiver flag </li>
|
|
<li>I2C_FLAG_BUSY: Bus busy flag </li>
|
|
<li>I2C_FLAG_MSL: Master/Slave flag </li>
|
|
<li>I2C_FLAG_SMBALERT: SMBus Alert flag </li>
|
|
<li>I2C_FLAG_TIMEOUT: Timeout or Tlow error flag </li>
|
|
<li>I2C_FLAG_PECERR: PEC error in reception flag </li>
|
|
<li>I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode) </li>
|
|
<li>I2C_FLAG_AF: Acknowledge failure flag </li>
|
|
<li>I2C_FLAG_ARLO: Arbitration lost flag (Master mode) </li>
|
|
<li>I2C_FLAG_BERR: Bus error flag </li>
|
|
<li>I2C_FLAG_TXE: Data register empty flag (Transmitter) </li>
|
|
<li>I2C_FLAG_RXNE: Data register not empty (Receiver) flag </li>
|
|
<li>I2C_FLAG_STOPF: Stop detection flag (Slave mode) </li>
|
|
<li>I2C_FLAG_ADD10: 10-bit header sent flag (Master mode) </li>
|
|
<li>I2C_FLAG_BTF: Byte transfer finished flag </li>
|
|
<li>I2C_FLAG_ADDR: Address sent flag (Master mode) "ADSL" Address matched flag (Slave mode)"ENDAD" </li>
|
|
<li>I2C_FLAG_SB: Start bit flag (Master mode) </li>
|
|
</ul>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">The</td><td>new state of I2C_FLAG (SET or RESET). </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga447771fbbd94a56f3570b9f430a069ba"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">ITStatus I2C_GetITStatus </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> * </td>
|
|
<td class="paramname"><em>I2Cx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>I2C_IT</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Checks whether the specified I2C interrupt has occurred or not. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">I2Cx</td><td>where x can be 1, 2 or 3 to select the I2C peripheral. </td></tr>
|
|
<tr><td class="paramname">I2C_IT</td><td>specifies the interrupt source to check. This parameter can be one of the following values: <ul>
|
|
<li>I2C_IT_SMBALERT: SMBus Alert flag </li>
|
|
<li>I2C_IT_TIMEOUT: Timeout or Tlow error flag </li>
|
|
<li>I2C_IT_PECERR: PEC error in reception flag </li>
|
|
<li>I2C_IT_OVR: Overrun/Underrun flag (Slave mode) </li>
|
|
<li>I2C_IT_AF: Acknowledge failure flag </li>
|
|
<li>I2C_IT_ARLO: Arbitration lost flag (Master mode) </li>
|
|
<li>I2C_IT_BERR: Bus error flag </li>
|
|
<li>I2C_IT_TXE: Data register empty flag (Transmitter) </li>
|
|
<li>I2C_IT_RXNE: Data register not empty (Receiver) flag </li>
|
|
<li>I2C_IT_STOPF: Stop detection flag (Slave mode) </li>
|
|
<li>I2C_IT_ADD10: 10-bit header sent flag (Master mode) </li>
|
|
<li>I2C_IT_BTF: Byte transfer finished flag </li>
|
|
<li>I2C_IT_ADDR: Address sent flag (Master mode) "ADSL" Address matched flag (Slave mode)"ENDAD" </li>
|
|
<li>I2C_IT_SB: Start bit flag (Master mode) </li>
|
|
</ul>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">The</td><td>new state of I2C_IT (SET or RESET). </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga29237aea9b5a3ead33167e1d027e9f1a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint32_t I2C_GetLastEvent </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> * </td>
|
|
<td class="paramname"><em>I2Cx</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Returns the last I2Cx Event. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">I2Cx</td><td>where x can be 1, 2 or 3 to select the I2C peripheral.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section note"><dt>Note</dt><dd>For detailed description of Events, please refer to section I2C_Events in <a class="el" href="stm32f4xx__i2c_8h.html" title="This file contains all the functions prototypes for the I2C firmware library. ">stm32f4xx_i2c.h</a> file.</dd></dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">The</td><td>last event </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga58fed146a06cb81d2940604e460de047"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void I2C_ITConfig </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> * </td>
|
|
<td class="paramname"><em>I2Cx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint16_t </td>
|
|
<td class="paramname"><em>I2C_IT</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">FunctionalState </td>
|
|
<td class="paramname"><em>NewState</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Enables or disables the specified I2C interrupts. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">I2Cx</td><td>where x can be 1, 2 or 3 to select the I2C peripheral. </td></tr>
|
|
<tr><td class="paramname">I2C_IT</td><td>specifies the I2C interrupts sources to be enabled or disabled. This parameter can be any combination of the following values: <ul>
|
|
<li>I2C_IT_BUF: Buffer interrupt mask </li>
|
|
<li>I2C_IT_EVT: Event interrupt mask </li>
|
|
<li>I2C_IT_ERR: Error interrupt mask </li>
|
|
</ul>
|
|
</td></tr>
|
|
<tr><td class="paramname">NewState</td><td>new state of the specified I2C interrupts. This parameter can be: ENABLE or DISABLE. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">None</td><td></td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga8021dc796d15f997356b0583d6346805"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint16_t I2C_ReadRegister </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_i2_c___type_def.html">I2C_TypeDef</a> * </td>
|
|
<td class="paramname"><em>I2Cx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>I2C_Register</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Reads the specified I2C register and returns its value. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">I2C_Register</td><td>specifies the register to read. This parameter can be one of the following values: <ul>
|
|
<li>I2C_Register_CR1: CR1 register. </li>
|
|
<li>I2C_Register_CR2: CR2 register. </li>
|
|
<li>I2C_Register_OAR1: OAR1 register. </li>
|
|
<li>I2C_Register_OAR2: OAR2 register. </li>
|
|
<li>I2C_Register_DR: DR register. </li>
|
|
<li>I2C_Register_SR1: SR1 register. </li>
|
|
<li>I2C_Register_SR2: SR2 register. </li>
|
|
<li>I2C_Register_CCR: CCR register. </li>
|
|
<li>I2C_Register_TRISE: TRISE register. </li>
|
|
</ul>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">The</td><td>value of the read register. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Sun May 10 2015 15:15:20 for discoverpixy by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.9.1
|
|
</small></address>
|
|
</body>
|
|
</html>
|