⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib_at91r40008_h.html

📁 描述ARM7TDMI在点灯程序
💻 HTML
📖 第 1 页 / 共 5 页
字号:

}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_SetControlRegister">AT91F_US_SetControlRegister</a></b></font>
<font color=#B22222>//* \brief Save and Set <a href="AT91R40008_USART.html#USART">USART</a>'s Control Register</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_SetControlRegister">AT91F_US_SetControlRegister</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> control_mode )      <font color=#B22222>// \arg control Register to be programmed</font>
{
        <font color=#B22222>//* Define the <a href="AT91R40008_USART.html#USART">USART</a>'s Control Mode</font>
        pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> |= control_mode ;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_GetChannelStatus">AT91F_US_GetChannelStatus</a></b></font>
<font color=#B22222>//* \brief Return the Status of a <a href="AT91R40008_USART.html#USART">USART</a> Channel</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> <a href="#AT91F_US_GetChannelStatus">AT91F_US_GetChannelStatus</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>return</font> (pUSART-><a href="AT91R40008_USART.html#US_CSR">US_CSR</a>);
}


<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_EnableRx">AT91F_US_EnableRx</a></b></font>
<font color=#B22222>//* \brief Enable receiving characters</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_EnableRx">AT91F_US_EnableRx</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=#B22222>//* Enable receiver</font>
    pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_RXEN">AT91C_US_RXEN</a>;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_EnableTx">AT91F_US_EnableTx</a></b></font>
<font color=#B22222>//* \brief Enable sending characters</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_EnableTx">AT91F_US_EnableTx</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=#B22222>//* Enable  transmitter</font>
    pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_TXEN">AT91C_US_TXEN</a>;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_ResetRx">AT91F_US_ResetRx</a></b></font>
<font color=#B22222>//* \brief Reset Receiver and re-enable it</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_ResetRx">AT91F_US_ResetRx</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=#B22222>//* Reset receiver</font>
        pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_RSTRX">AT91C_US_RSTRX</a>;
    <font color=#B22222>//* Re-Enable receiver</font>
    pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_RXEN">AT91C_US_RXEN</a>;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_ResetTx">AT91F_US_ResetTx</a></b></font>
<font color=#B22222>//* \brief Reset Transmitter and re-enable it</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_ResetTx">AT91F_US_ResetTx</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=#B22222>//* Reset transmitter</font>
        pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_RSTTX">AT91C_US_RSTTX</a>;
    <font color=#B22222>//* Enable transmitter</font>
    pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_TXEN">AT91C_US_TXEN</a>;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_DisableRx">AT91F_US_DisableRx</a></b></font>
<font color=#B22222>//* \brief Disable Receiver</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_DisableRx">AT91F_US_DisableRx</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=#B22222>//* Disable receiver</font>
    pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_RXDIS">AT91C_US_RXDIS</a>;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_DisableTx">AT91F_US_DisableTx</a></b></font>
<font color=#B22222>//* \brief Disable Transmitter</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_DisableTx">AT91F_US_DisableTx</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=#B22222>//* Disable transmitter</font>
    pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_TXDIS">AT91C_US_TXDIS</a>;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_Close">AT91F_US_Close</a></b></font>
<font color=#B22222>//* \brief Close <a href="AT91R40008_USART.html#USART">USART</a>: disable IT disable receiver and transmitter, close <a href="AT91R40008_PDC.html#PDC">PDC</a></font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_Close">AT91F_US_Close</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=#B22222>//* Reset the baud rate divisor <font color=#0000FF>register</font></font>
    pUSART-><a href="AT91R40008_USART.html#US_BRGR">US_BRGR</a> = 0 ;

    <font color=#B22222>//* Reset the <a href="AT91R40008_USART.html#USART">USART</a> mode</font>
    pUSART-><a href="AT91R40008_USART.html#US_MR">US_MR</a> = 0  ;

    <font color=#B22222>//* Reset the Timeguard Register</font>
    pUSART-><a href="AT91R40008_USART.html#US_TTGR">US_TTGR</a> = 0;

    <font color=#B22222>//* Disable all interrupts</font>
    pUSART-><a href="AT91R40008_USART.html#US_IDR">US_IDR</a> = 0xFFFFFFFF ;

    <font color=#B22222>//* Disable receiver and transmitter and stop any activity immediately</font>
    pUSART-><a href="AT91R40008_USART.html#US_CR">US_CR</a> = <a href="AT91R40008_h.html#AT91C_US_TXDIS">AT91C_US_TXDIS</a> | <a href="AT91R40008_h.html#AT91C_US_RXDIS">AT91C_US_RXDIS</a> | <a href="AT91R40008_h.html#AT91C_US_RSTTX">AT91C_US_RSTTX</a> | <a href="AT91R40008_h.html#AT91C_US_RSTRX">AT91C_US_RSTRX</a> ;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_TxReady">AT91F_US_TxReady</a></b></font>
<font color=#B22222>//* \brief Return 1 <font color=#0000FF>if</font> a character can be written in <a href="AT91R40008_USART.html#US_THR">US_THR</a></font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> <a href="#AT91F_US_TxReady">AT91F_US_TxReady</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>return</font> (pUSART-><a href="AT91R40008_USART.html#US_CSR">US_CSR</a> & <a href="AT91R40008_h.html#AT91C_US_TXRDY">AT91C_US_TXRDY</a>);
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_RxReady">AT91F_US_RxReady</a></b></font>
<font color=#B22222>//* \brief Return 1 <font color=#0000FF>if</font> a character can be read in <a href="AT91R40008_USART.html#US_RHR">US_RHR</a></font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> <a href="#AT91F_US_RxReady">AT91F_US_RxReady</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>return</font> (pUSART-><a href="AT91R40008_USART.html#US_CSR">US_CSR</a> & <a href="AT91R40008_h.html#AT91C_US_RXRDY">AT91C_US_RXRDY</a>);
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_Error">AT91F_US_Error</a></b></font>
<font color=#B22222>//* \brief Return the error flag</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> <a href="#AT91F_US_Error">AT91F_US_Error</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>return</font> (pUSART-><a href="AT91R40008_USART.html#US_CSR">US_CSR</a> &
        (<a href="AT91R40008_h.html#AT91C_US_OVRE">AT91C_US_OVRE</a> |  <font color=#B22222>// Overrun error</font>
         <a href="AT91R40008_h.html#AT91C_US_FRAME">AT91C_US_FRAME</a> | <font color=#B22222>// Framing error</font>
         <a href="AT91R40008_h.html#AT91C_US_PARE">AT91C_US_PARE</a>));  <font color=#B22222>// Parity error</font>
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_US_PutChar">AT91F_US_PutChar</a></b></font>
<font color=#B22222>//* \brief Send a character,does not check <font color=#0000FF>if</font> ready to send</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_US_PutChar">AT91F_US_PutChar</a> (
        <a href="AT91R40008_h.html#AT91PS_USART">AT91PS_USART</a> pUSART,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -