void Uart_Initialization(void) { static uint8 i; /* disable interrupts */ boolean interruptState = IfxCpu_disableInterrupts(); /* create module config */ IfxAsclin_Asc_Config Uart_AscLin0; IfxAsclin_Asc_initModuleConfig(&Uart_AscLin0, &MODULE_ASCLIN0); /* set the desired baudrate */ Uart_AscLin0.baudrate.prescaler = 1; Uart_AscLin0.baudrate.baudrate = 115200; /* FDR values will be calculated in initModule */ Uart_AscLin0.baudrate.oversampling = IfxAsclin_OversamplingFactor_4; /* ISR priorities and interrupt target */ Uart_AscLin0.interrupt.txPriority = ISR_PRIORITY_ASCLIN0_TX; Uart_AscLin0.interrupt.rxPriority = ISR_PRIORITY_ASCLIN0_RX; Uart_AscLin0.interrupt.erPriority = ISR_PRIORITY_ASCLIN0_ER; Uart_AscLin0.interrupt.typeOfService = IfxSrc_Tos_cpu0; /* FIFO configuration */ Uart_AscLin0.txBuffer = AsclinAsc.ascBuffer.tx; Uart_AscLin0.txBufferSize = ASC_TX_BUFFER_SIZE; Uart_AscLin0.rxBuffer = AsclinAsc.ascBuffer.rx; Uart_AscLin0.rxBufferSize = ASC_RX_BUFFER_SIZE; const IfxAsclin_Asc_Pins pins = { NULL, IfxPort_InputMode_pullUp, /* CTS pin not used */ &IfxAsclin0_RXB_P15_3_IN, IfxPort_InputMode_pullUp, /* Rx pin */ NULL, IfxPort_OutputMode_pushPull, /* RTS pin not used */ &IfxAsclin0_TX_P15_2_OUT, IfxPort_OutputMode_pushPull, /* Tx pin */ IfxPort_PadDriver_cmosAutomotiveSpeed1 }; Uart_AscLin0.pins = &pins; /* initialize module */ IfxAsclin_Asc_initModule(&AsclinAsc.drivers.asc0, &Uart_AscLin0); /* enable interrupts again */ IfxCpu_restoreInterrupts(interruptState); } /* End of Uart_Initialization */ |
void Uart_Put_Char(char c){ AsclinAsc.Uart_TxData[0] = c; AsclinAsc.count = UART_TEST_DATA_SIZE; IfxAsclin_Asc_write(&AsclinAsc.drivers.asc0,AsclinAsc.Uart_TxData, &AsclinAsc.count, TIME_INFINITE); } void Uart_Put_String(char *string){ unsigned char i=0; while(string[i] != 0){ Uart_Put_Char(string[i++]); } Uart_Put_Char(0x0A); } |
hello world! 를 출력했다.
'프로젝트 > 자율주행모형차' 카테고리의 다른 글
라인스캔카메라 가우시안 필터, 엣지 디텍션 (1) | 2018.06.13 |
---|---|
라인스캔카메라 (11) | 2018.06.07 |
라이다(RIDAR) tc237 (0) | 2018.06.05 |
tc237 ADC(SAR) (0) | 2018.04.19 |
Infineon TC237 LCD 프로그램 업로드 (0) | 2018.04.03 |