Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(void) {
- uint8_t c;
- /* Initialize system */
- SystemInit();
- /* Initialize USART1 at 9600 baud, TX: PB6, RX: PB7 */
- TM_USART_Init(USART1, TM_USART_PinsPack_2, 9600);
- /* Put string to USART */
- //TM_USART_Puts(USART1, "Hello world\n\r");
- GPIO_InitTypeDef GPIO_InitDef;
- RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);
- GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
- GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;
- GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
- GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;
- GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz;
- //Initialize pins
- GPIO_Init(GPIOG, &GPIO_InitDef);
- while (1) {
- /* Get character from internal buffer */
- c = TM_USART_Getc(USART1);
- if (c) {
- /* If anything received, put it back to terminal */
- GPIO_SetBits(GPIOG, GPIO_Pin_13 | GPIO_Pin_14);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement