- /*---------------------------------------------------------------------------------------------------------*/
- /* Function: DrvUART_SetFnRS485 */
- /* */
- /* Parameter: */
- /* u32Port -[in] UART Channel: UART_PORT0 / UART_PORT1 */
- /* STR_RS485_T -[in] Ther stucture of RS485 */
- /* It includes of */
- /* u8cModeSelect: MODE_RS485_AUD / MODE_RS485_AAD */
- /* MODE_RS485_NMM */
- /* u8cAddrEnable: Enable or Disable RS-485 Address Detection */
- /* u8cAddrValue: Match Address Value */
- /* u8cDelayTime: Set transmit delay time value */
- /* u8cRxDisable: Enable or Disable receiver function */
- /* Returns: */
- /* None */
- /* */
- /* Description: */
- /* The function is to Set RS485 Control Register */
- /*---------------------------------------------------------------------------------------------------------*/
- void DrvUART_SetFnRS485(E_UART_PORT u32Port,STR_RS485_T *str_RS485)
- {
- UART_T * tUART;
- tUART = (UART_T *)((uint32_t)UART0 + u32Port);
- tUART->FUNSEL.FUN_SEL = FUN_RS485; /* Enable RS485 function and configure */
- tUART->ALTCON.RS485_ADD_EN = str_RS485-> u8cAddrEnable ?1:0;
- tUART->ALTCON.ADDR_MATCH = str_RS485-> u8cAddrValue ;
- tUART->ALTCON.RS485_NMM = (str_RS485-> u8cModeSelect & MODE_RS485_NMM)?1:0;
- tUART->ALTCON.RS485_AAD = (str_RS485-> u8cModeSelect & MODE_RS485_AAD)?1:0;
- tUART->ALTCON.RS485_AUD = (str_RS485-> u8cModeSelect & MODE_RS485_AUD)?1:0;
- tUART->TOR.DLY = str_RS485-> u8cDelayTime;
- tUART->FCR.RX_DIS = str_RS485-> u8cRxDisable;
- tUART->MCR.LEV_RTS = 0;
- }
|