61 lines
2.3 KiB
C
61 lines
2.3 KiB
C
#include "uart.h"
|
|
#include "fsl_common.h"
|
|
#include "fsl_debug_console.h"
|
|
|
|
void uart_tx_pin(void)
|
|
{
|
|
/* Enable IOCON Clock */
|
|
CLOCK_EnableClock(kCLOCK_Iocon);
|
|
|
|
/* Enable Uart Clock IP */
|
|
const uint32_t port0_pin30_config = (/* Pin is configured as FC0_TXD_SCL_MISO_WS */
|
|
0x01u |
|
|
/* No addition pin function */
|
|
0x00u |
|
|
/* Standard mode, output slew rate control is enabled */
|
|
0x00u |
|
|
/* Input function is not inverted */
|
|
0x00u |
|
|
/* Enables digital function */
|
|
0x0100u |
|
|
/* Open drain is disabled */
|
|
0x00u);
|
|
/* PORT0 PIN30 (coords: 94) is configured as FC0_TXD_SCL_MISO_WS */
|
|
IOCON->PIO[0U][30U] = port0_pin30_config;
|
|
|
|
}
|
|
|
|
void uart_rx_pin(void)
|
|
{
|
|
/* Enable IOCON Clock */
|
|
CLOCK_EnableClock(kCLOCK_Iocon);
|
|
|
|
/* Enable Uart Clock IP */
|
|
const uint32_t port0_pin29_config = (/* Pin is configured as FC0_TXD_SCL_MISO_WS */
|
|
0x01u |
|
|
/* No addition pin function */
|
|
0x00u |
|
|
/* Standard mode, output slew rate control is enabled */
|
|
0x00u |
|
|
/* Input function is not inverted */
|
|
0x00u |
|
|
/* Enables digital function */
|
|
0x0100u |
|
|
/* Open drain is disabled */
|
|
0x00u);
|
|
/* PORT0 PIN30 (coords: 94) is configured as FC0_TXD_SCL_MISO_WS */
|
|
IOCON->PIO[0U][29U] = port0_pin29_config;
|
|
|
|
}
|
|
|
|
void uart_init(void){
|
|
uart_tx_pin();
|
|
uart_rx_pin();
|
|
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0);
|
|
RESET_ClearPeripheralReset(kFC0_RST_SHIFT_RSTn);
|
|
uint32_t uartClkSrcFreq = 12000000U;
|
|
DbgConsole_Init(0, 115200U, kSerialPort_Uart, uartClkSrcFreq);
|
|
|
|
}
|
|
|