📄 lib_at91r40008_h.html
字号:
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_EnableIt">AT91F_PIO_EnableIt</a> (
<a href="AT91R40008_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio, <font color=#B22222>// \arg pointer to a <a href="AT91R40008_PIO.html#PIO">PIO</a> controller</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> pin) <font color=#B22222>// \arg IT to be enabled</font>
{
<font color=#B22222>//* Write to the IER <font color=#0000FF>register</font></font>
pPio-><a href="AT91R40008_PIO.html#PIO_IER">PIO_IER</a> = pin;
}
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_PIO_DisableIt">AT91F_PIO_DisableIt</a></b></font>
<font color=#B22222>//* \brief Disable a <a href="AT91R40008_PIO.html#PIO">PIO</a> pin IT</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_DisableIt">AT91F_PIO_DisableIt</a> (
<a href="AT91R40008_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio, <font color=#B22222>// \arg pointer to a <a href="AT91R40008_PIO.html#PIO">PIO</a> controller</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> pin) <font color=#B22222>// \arg IT to be disabled</font>
{
<font color=#B22222>//* Write to the IDR <font color=#0000FF>register</font></font>
pPio-><a href="AT91R40008_PIO.html#PIO_IDR">PIO_IDR</a> = pin;
}
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_PIO_PioPinItStatus">AT91F_PIO_PioPinItStatus</a></b></font>
<font color=#B22222>//* \brief Return the <a href="AT91R40008_PIO.html#PIO">PIO</a> pin IT Enabled</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> <a href="#AT91F_PIO_PioPinItStatus">AT91F_PIO_PioPinItStatus</a> (
<a href="AT91R40008_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio) <font color=#B22222>// \arg pointer to a <a href="AT91R40008_PIO.html#PIO">PIO</a> controller</font>
{
<font color=#B22222>//* Read to the <a href="AT91R40008_PIO.html#PIO_IMR">PIO_IMR</a></font>
<font color=#0000FF>return</font> (pPio-><a href="AT91R40008_PIO.html#PIO_IMR">PIO_IMR</a>) ;
}
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_PIO_IsPioPinItPending">AT91F_PIO_IsPioPinItPending</a></b></font>
<font color=#B22222>//* \brief Test <font color=#0000FF>if</font> one or more <a href="AT91R40008_PIO.html#PIO">PIO</a> pin IT are pending</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> <a href="#AT91F_PIO_IsPioPinItPending">AT91F_PIO_IsPioPinItPending</a> (
<a href="AT91R40008_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio) <font color=#B22222>// \arg pointer to a <a href="AT91R40008_PIO.html#PIO">PIO</a> controller</font>
{
<font color=#0000FF>return</font> (pPio-><a href="AT91R40008_PIO.html#PIO_ISR">PIO_ISR</a>);
}
/* *****************************************************************************
SOFTWARE API FOR <a href="AT91R40008_USART.html#USART">USART</a>
***************************************************************************** */
<font color=#B22222>//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity</font>
<font color=#008200>#define</font> AT91C_US_ASYNC_MODE ( <a href="AT91R40008_h.html#AT91C_US_CHMODE_NORMAL">AT91C_US_CHMODE_NORMAL</a> + \
<a href="AT91R40008_h.html#AT91C_US_NBSTOP_1_BIT">AT91C_US_NBSTOP_1_BIT</a> + \
<a href="AT91R40008_h.html#AT91C_US_PAR_NONE">AT91C_US_PAR_NONE</a> + \
<a href="AT91R40008_h.html#AT91C_US_CHRL_8_BITS">AT91C_US_CHRL_8_BITS</a> + \
<a href="AT91R40008_h.html#AT91C_US_CLKS_CLOCK">AT91C_US_CLKS_CLOCK</a> )
<font color=#B22222>//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity</font>
<font color=#008200>#define</font> AT91C_US_ASYNC_SCK_MODE ( <a href="AT91R40008_h.html#AT91C_US_CHMODE_NORMAL">AT91C_US_CHMODE_NORMAL</a> + \
<a href="AT91R40008_h.html#AT91C_US_NBSTOP_1_BIT">AT91C_US_NBSTOP_1_BIT</a> + \
<a href="AT91R40008_h.html#AT91C_US_PAR_NONE">AT91C_US_PAR_NONE</a> + \
<a href="AT91R40008_h.html#AT91C_US_CHRL_8_BITS">AT91C_US_CHRL_8_BITS</a> + \
<a href="AT91R40008_h.html#AT91C_US_CLKS_EXT">AT91C_US_CLKS_EXT</a> )
<font color=#B22222>//* Standard Synchronous Mode : 8 bits , 1 stop , no parity</font>
<font color=#008200>#define</font> AT91C_US_SYNC_MODE ( <a href="AT91R40008_h.html#AT91C_US_SYNC">AT91C_US_SYNC</a> + \
<a href="AT91R40008_h.html#AT91C_US_CHMODE_NORMAL">AT91C_US_CHMODE_NORMAL</a> + \
<a href="AT91R40008_h.html#AT91C_US_NBSTOP_1_BIT">AT91C_US_NBSTOP_1_BIT</a> + \
<a href="AT91R40008_h.html#AT91C_US_PAR_NONE">AT91C_US_PAR_NONE</a> + \
<a href="AT91R40008_h.html#AT91C_US_CHRL_8_BITS">AT91C_US_CHRL_8_BITS</a> + \
<a href="AT91R40008_h.html#AT91C_US_CLKS_CLOCK">AT91C_US_CLKS_CLOCK</a> )
<font color=#B22222>//* SCK used Label</font>
<font color=#008200>#define</font> AT91C_US_SCK_USED (<a href="AT91R40008_h.html#AT91C_US_CKLO">AT91C_US_CKLO</a> | <a href="AT91R40008_h.html#AT91C_US_CLKS_EXT">AT91C_US_CLKS_EXT</a>)
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_US_Baudrate">AT91F_US_Baudrate</a></b></font>
<font color=#B22222>//* \brief Caluculate baud_value according to the <font color=#0000FF>main</font> clock and the baud rate</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> <a href="#AT91F_US_Baudrate">AT91F_US_Baudrate</a> (
<font color=#0000FF>const</font> <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> main_clock, <font color=#B22222>// \arg Master Clock</font>
<font color=#0000FF>const</font> <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> baud_rate) <font color=#B22222>// \arg Desired UART baudrate</font>
{
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> baud_value = ((main_clock*10)/(baud_rate * 16));
<font color=#0000FF>if</font> ((baud_value % 10) >= 5)
baud_value = (baud_value / 10) + 1;
<font color=#0000FF>else</font>
baud_value /= 10;
<font color=#0000FF>return</font> baud_value;
}
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_US_SetBaudrate">AT91F_US_SetBaudrate</a></b></font>
<font color=#B22222>//* \brief Set the baudrate according to the CPU clock</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_SetBaudrate">AT91F_US_SetBaudrate</a> (
<a href="AT91R40008_h.html#AT91PS_USART">AT91PS_USART</a> pUSART, <font color=#B22222>// \arg pointer to a <a href="AT91R40008_USART.html#USART">USART</a> controller</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> mainClock, <font color=#B22222>// \arg Master Clock</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> speed) <font color=#B22222>// \arg UART baudrate to be programmed</font>
{
<font color=#B22222>//* Define the baud rate divisor <font color=#0000FF>register</font></font>
pUSART-><a href="AT91R40008_USART.html#US_BRGR">US_BRGR</a> = <a href="#AT91F_US_Baudrate">AT91F_US_Baudrate</a>(mainClock, speed);
}
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_US_SetTimeguard">AT91F_US_SetTimeguard</a></b></font>
<font color=#B22222>//* \brief Set <a href="AT91R40008_USART.html#USART">USART</a> timeguard</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_SetTimeguard">AT91F_US_SetTimeguard</a> (
<a href="AT91R40008_h.html#AT91PS_USART">AT91PS_USART</a> pUSART, <font color=#B22222>// \arg pointer to a <a href="AT91R40008_USART.html#USART">USART</a> controller</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> timeguard) <font color=#B22222>// \arg timeguard value</font>
{
<font color=#B22222>//* Write the Timeguard Register</font>
pUSART-><a href="AT91R40008_USART.html#US_TTGR">US_TTGR</a> = timeguard ;
}
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_US_EnableIt">AT91F_US_EnableIt</a></b></font>
<font color=#B22222>//* \brief Enable <a href="AT91R40008_USART.html#USART">USART</a> IT</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_EnableIt">AT91F_US_EnableIt</a> (
<a href="AT91R40008_h.html#AT91PS_USART">AT91PS_USART</a> pUSART, <font color=#B22222>// \arg pointer to a <a href="AT91R40008_USART.html#USART">USART</a> controller</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> flag) <font color=#B22222>// \arg IT to be enabled</font>
{
<font color=#B22222>//* Write to the IER <font color=#0000FF>register</font></font>
pUSART-><a href="AT91R40008_USART.html#US_IER">US_IER</a> = flag;
}
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_US_DisableIt">AT91F_US_DisableIt</a></b></font>
<font color=#B22222>//* \brief Disable <a href="AT91R40008_USART.html#USART">USART</a> IT</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_DisableIt">AT91F_US_DisableIt</a> (
<a href="AT91R40008_h.html#AT91PS_USART">AT91PS_USART</a> pUSART, <font color=#B22222>// \arg pointer to a <a href="AT91R40008_USART.html#USART">USART</a> controller</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> flag) <font color=#B22222>// \arg IT to be disabled</font>
{
<font color=#B22222>//* Write to the IER <font color=#0000FF>register</font></font>
pUSART-><a href="AT91R40008_USART.html#US_IDR">US_IDR</a> = flag;
}
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn <b><a name="AT91F_US_Configure">AT91F_US_Configure</a></b></font>
<font color=#B22222>//* \brief Configure <a href="AT91R40008_USART.html#USART">USART</a></font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_Configure">AT91F_US_Configure</a> (
<a href="AT91R40008_h.html#AT91PS_USART">AT91PS_USART</a> pUSART, <font color=#B22222>// \arg pointer to a <a href="AT91R40008_USART.html#USART">USART</a> controller</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> mainClock, <font color=#B22222>// \arg peripheral clock</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> mode , <font color=#B22222>// \arg mode Register to be programmed</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> baudRate , <font color=#B22222>// \arg baudrate to be programmed</font>
<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> timeguard ) <font color=#B22222>// \arg timeguard to be programmed</font>
{
<font color=#B22222>//* Disable interrupts</font>
pUSART-><a href="AT91R40008_USART.html#US_IDR">US_IDR</a> = (<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font>) -1;
<font color=#B22222>//* Reset receiver and transmitter</font>
pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_RSTRX">AT91C_US_RSTRX</a> | <a href="AT91R40008_h.html#AT91C_US_RSTTX">AT91C_US_RSTTX</a> | <a href="AT91R40008_h.html#AT91C_US_RXDIS">AT91C_US_RXDIS</a> | <a href="AT91R40008_h.html#AT91C_US_TXDIS">AT91C_US_TXDIS</a> ;
<font color=#B22222>//* Define the baud rate divisor <font color=#0000FF>register</font></font>
<a href="#AT91F_US_SetBaudrate">AT91F_US_SetBaudrate</a>(pUSART, mainClock, baudRate);
<font color=#B22222>//* Write the Timeguard Register</font>
<a href="#AT91F_US_SetTimeguard">AT91F_US_SetTimeguard</a>(pUSART, timeguard);
<font color=#B22222>//* Define the <a href="AT91R40008_USART.html#USART">USART</a> mode</font>
pUSART-><a href="AT91R40008_USART.html#US_MR">US_MR</a> = mode ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -