• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GPIOPinTypeUART函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GPIOPinTypeUART函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIOPinTypeUART函数的具体用法?C++ GPIOPinTypeUART怎么用?C++ GPIOPinTypeUART使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GPIOPinTypeUART函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetupUartTask

/**
 * /fn SetupUartTask
 * /brief Setup UART tasks.
 *
 * Task has priority 15 and receives 1kB of stack.
 *
 * /return Always 0. In case of error the system halts.
 */
int SetupUartTask(void) {
	Task_Params taskTransferParams;
	Task_Handle taskTransfer;
	Error_Block eb;

	/* Enable and configure the peripherals used by the UART7 */
	SysCtlPeripheralEnable(GPIO_PORTC_BASE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
	GPIOPinConfigure(GPIO_PC4_U7RX);
	GPIOPinConfigure(GPIO_PC5_U7TX);
	GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);

	/* Enable and configure the peripherals used by the UART6 */
	SysCtlPeripheralEnable(GPIO_PORTP_BASE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART6);
	GPIOPinConfigure(GPIO_PP0_U6RX);
	GPIOPinConfigure(GPIO_PP1_U6TX);
	GPIOPinTypeUART(GPIO_PORTP_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	UART_init();

	InitializeLedUserSwitch();

	Error_init(&eb);
	Task_Params_init(&taskTransferParams);
	taskTransferParams.stackSize = 1024;
	taskTransferParams.priority = 15;
	taskTransfer = Task_create((Task_FuncPtr) TransferFunction,
			&taskTransferParams, &eb);
	if (taskTransfer == NULL) {
		System_abort("UART task create failed");
	}

	return (0);
}
开发者ID:Komisa72,项目名称:ese_wheaterstation_2016,代码行数:43,代码来源:UART_Task.c


示例2: ConfigureUART

//*****************************************************************************
//
// Configure the UART and its pins.  This must be called before UARTprintf().
//
//*****************************************************************************
void
ConfigureUART(void)
{
	//
	// Enable the GPIO Peripheral used by the UART.
	//
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	//
	// Enable UART0
	//
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
	//
	// Configure GPIO Pins for UART mode.
	//
	GPIOPinConfigure(GPIO_PB0_U1RX);
	GPIOPinConfigure(GPIO_PB1_U1TX);
	GPIOPinConfigure(GPIO_PA1_U0TX);
	GPIOPinConfigure(GPIO_PA1_U0TX);
	GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
	//
	// Use the internal 16MHz oscillator as the UART clock source.
	//
	UARTClockSourceSet(UART1_BASE, UART_CLOCK_PIOSC);
	UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

	//
	// Initialize the UART for console I/O.
	//
	UARTStdioConfig(0, 115200, 16000000);
}
开发者ID:rheostat2718,项目名称:mpu9150_driver,代码行数:38,代码来源:compdcm_mpu9150.c


示例3: bsp_gpio_init

static void
bsp_gpio_init(void)
{
    int32_t i;

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    for (i = 0; i < ARRAY_SIZE(the_inout_iomap); i++)
    {
        if (the_inout_iomap[i].mode == IO_INPUT)
        {
            GPIODirModeSet(the_inout_iomap[i].gpiobase, the_inout_iomap[i].pinno, GPIO_DIR_MODE_IN);
        }
        else
        {
            GPIODirModeSet(the_inout_iomap[i].gpiobase, the_inout_iomap[i].pinno, GPIO_DIR_MODE_OUT);
            GPIOPadConfigSet(the_inout_iomap[i].gpiobase, the_inout_iomap[i].pinno, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
        }
    }

    sys_gpio_bspInstall(bsp_gpio_cfg, bsp_gpio_read, bsp_gpio_write);

    /* 设置uart0、1模式 */
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_2 | GPIO_PIN_3);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);

}
开发者ID:liuning587,项目名称:rtos_811,代码行数:32,代码来源:bsp.c


示例4: Init

/************************************************************************************//**
** \brief     Initializes the microcontroller. 
** \return    none.
**
****************************************************************************************/
static void Init(void)
{
  /* set the clocking to run at 50MHz from the PLL */
  SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
#if (BOOT_COM_UART_ENABLE > 0)
  #if (BOOT_COM_UART_CHANNEL_INDEX == 0)
  /* enable and configure UART0 related peripherals and pins */
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
  GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
  #endif
#elif (BOOT_FILE_LOGGING_ENABLE > 0)
  /* log info strings to UART during firmware updates from local file storage */
  /* enable and configure UART0 related peripherals and pins */
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
  GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
  /* enable the UART0 peripheral */
  SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
  /* configure the UART0 baudrate and communication parameters */
  UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 57600,
                      (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | 
                      UART_CONFIG_PAR_NONE));
#endif
#if (BOOT_COM_USB_ENABLE > 0)
  /* enable the GPIO peripheral used for USB, and configure the USB pins */
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
  GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
  GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);
#endif  
  /* enable the GPIO port to which the SELECT button is connected */
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
  /* configure the SELECT button pin as an input with pull-up */
  GPIODirModeSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_DIR_MODE_IN);
  GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
} /*** end of Init ***/
开发者ID:x893,项目名称:OpenBLT,代码行数:40,代码来源:main.c


示例5: commUartInit

void commUartInit ( void )
{
    /*********** UART 0 ***************/
    SysCtlPeripheralEnable ( SYSCTL_PERIPH_UART0 );
    //
    // Set GPIO A0 and A1 as UART pins.
    //
    GPIOPinConfigure ( GPIO_PA0_U0RX );
    GPIOPinConfigure ( GPIO_PA1_U0TX );
    GPIOPinTypeUART ( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1 );

    UARTConfigSetExpClk ( UART0_BASE, SysCtlClockGet(), SPEED_UART_STD,
                          ( UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                            UART_CONFIG_PAR_NONE ) );
    UARTFIFOEnable ( UART0_BASE );
    UARTFIFOLevelSet ( UART0_BASE , UART_FIFO_TX4_8 , UART_FIFO_RX4_8 );
    
    UARTIntEnable ( UART0_BASE, UART_INT_RX | UART_INT_RT );


    /*********** UART 1 ***************/
    SysCtlPeripheralEnable ( SYSCTL_PERIPH_UART1 );
    //
    // Set GPIO D2 and D3 as UART pins.
    //
    GPIOPinConfigure ( GPIO_PD2_U1RX );
    GPIOPinConfigure ( GPIO_PD3_U1TX );
    GPIOPinTypeUART ( GPIO_PORTD_BASE, GPIO_PIN_2 | GPIO_PIN_3 );

    UARTConfigSetExpClk ( UART1_BASE, SysCtlClockGet(), SPEED_UART_STD,
                          ( UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                            UART_CONFIG_PAR_NONE) );
    UARTFIFOEnable ( UART1_BASE );
    UARTFIFOLevelSet ( UART1_BASE , UART_FIFO_TX4_8 , UART_FIFO_RX4_8 );
    
    UARTIntEnable ( UART1_BASE, UART_INT_RX | UART_INT_RT );
    
    /*********** UART 2 ***************/
    SysCtlPeripheralEnable ( SYSCTL_PERIPH_UART2 );
    //
    // Set GPIO G0 and G1 as UART pins.
    //
    GPIOPinConfigure ( GPIO_PG0_U2RX );
    GPIOPinConfigure ( GPIO_PG1_U2TX );
    GPIOPinTypeUART ( GPIO_PORTG_BASE, GPIO_PIN_0 | GPIO_PIN_1 );

    UARTConfigSetExpClk ( UART2_BASE, SysCtlClockGet(), SPEED_UART_RS485,
                          ( UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                            UART_CONFIG_PAR_NONE ) );
    UARTFIFOEnable ( UART2_BASE );
    UARTFIFOLevelSet ( UART2_BASE , UART_FIFO_TX4_8 , UART_FIFO_RX4_8 );
    
    UARTIntEnable ( UART2_BASE, UART_INT_RX | UART_INT_RT );

    

}
开发者ID:yanlunyao,项目名称:stm32_lwip_ucos_udp_test,代码行数:57,代码来源:uarthandle.c


示例6: cfgUART

void cfgUART()
{
  SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

  GPIOPinConfigure(GPIO_PA0_U0RX);
  GPIOPinConfigure(GPIO_PA1_U0TX);
  GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

  //UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

  // Enable GPIO port A which is used for UART0 pins.
  // TODO: change this to whichever GPIO port you are using.

  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

  //
  // Configure the pin muxing for UART0 functions on port A0 and A1.
  // This step is not necessary if your part does not support pin muxing.
  // TODO: change this to select the port/pin you are using.
  //
  GPIOPinConfigure(GPIO_PA0_U0RX);
  GPIOPinConfigure(GPIO_PA1_U0TX);

  //
  // Enable UART0 so that we can configure the clock.
  //
  SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

  //
  // Use the internal 16MHz oscillator as the UART clock source.
  //
  UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

  //
  // Select the alternate (UART) function for these pins.
  // TODO: change this to select the port/pin you are using.
  //
  GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

  //
  // Initialize the UART for console I/O.
  //
  UARTStdioConfig(0, 115200, 16000000);

  IntMasterEnable(); //enable processor interrupts

  IntEnable(INT_UART0); //enable the UART interrupt

  UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); //only enable RX and TX interrupts
}
开发者ID:EDAyele,项目名称:tiva_arm_template,代码行数:51,代码来源:timer.c


示例7: main

int main(void)
{
	char cThisChar;

	SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL |SYSCTL_XTAL_16MHZ| SYSCTL_OSC_MAIN );

	//Para el SW1
	/*SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
	GPIODirModeSet(GPIO_PORTF_BASE, 0xFF, GPIO_DIR_MODE_IN);
	GPIOPinIntEnable(GPIO_PORTB_BASE, 0xFF);
	IntEnable(INT_GPIOF);*/

	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

	GPIOPinConfigure(GPIO_PA0_U0RX);
	GPIOPinConfigure(GPIO_PA1_U0TX);

	GPIOPinConfigure(GPIO_PB0_U1RX);
	GPIOPinConfigure(GPIO_PB1_U1TX);

	GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 9600,
			(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
					UART_CONFIG_PAR_NONE));

	UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 9600,
	                        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
	                         UART_CONFIG_PAR_NONE));

	UARTFIFOLevelSet(UART1_BASE,UART_FIFO_TX7_8,UART_FIFO_RX7_8);
	UARTIntClear(UART1_BASE, UART_INT_TX | UART_INT_RX);
	UARTIntEnable(UART1_BASE, UART_INT_RX);
	UARTFIFOEnable(UART1_BASE);
	IntMasterEnable();
	UARTEnable(UART1_BASE);
	IntEnable(INT_UART1);

		for(n=0; n<sizeof(buferA); n++){
					UARTCharPut(UART1_BASE, buferA[n]);}

		for(m=0; m<sizeof(buferC); m++){
						UARTCharPut(UART1_BASE, buferC[m]);}

	while(1){;}
}
开发者ID:joseomar,项目名称:Proyectos_CCS-TI,代码行数:51,代码来源:main.c


示例8: EK_LM4F120XL_initUART

/*
 *  ======== EK_LM4F120XL_initUART ========
 */
Void EK_LM4F120XL_initUART()
{
    /* Enable and configure the peripherals used by the uart0. */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    /* Enable and configure the peripherals used by the uart1. */
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
	GPIOPinConfigure(GPIO_PB0_U1RX);
	GPIOPinConfigure(GPIO_PB1_U1TX);
	GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	/* Enable and configure the peripherals used by the uart2. */
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
	HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
	HWREG(GPIO_PORTD_BASE + GPIO_O_CR) = 0x80;
	GPIOPinConfigure(GPIO_PD6_U2RX);
	GPIOPinConfigure(GPIO_PD7_U2TX);
	GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7);

	/* Enable and configure the peripherals used by the uart3 and uart4. */
	//UART 3
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
	GPIOPinConfigure(GPIO_PC6_U3RX);
	GPIOPinConfigure(GPIO_PC7_U3TX);
	//UART 4
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART4);
	GPIOPinConfigure(GPIO_PC4_U4RX);
	GPIOPinConfigure(GPIO_PC5_U4TX);
	GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);

	/* Enable and configure the peripherals used by the uart5. */
	//UART 5
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
	GPIOPinConfigure(GPIO_PE4_U5RX);
	GPIOPinConfigure(GPIO_PE5_U5TX);

	//UART 7
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
	GPIOPinConfigure(GPIO_PE0_U7RX);
	GPIOPinConfigure(GPIO_PE1_U7TX);
	GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5);

    /* Initialize the UART driver */
	UART_init();
}
开发者ID:kawfey,项目名称:motherboard,代码行数:51,代码来源:EK_LM4F120XL.c


示例9: main

int main(void)
{
	//FRESULT rc;

	SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_PLL |SYSCTL_XTAL_16MHZ| SYSCTL_OSC_MAIN );

	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

	GPIOPinConfigure(GPIO_PA0_U0RX);
	GPIOPinConfigure(GPIO_PA1_U0TX);

	GPIOPinConfigure(GPIO_PB0_U1RX);
	GPIOPinConfigure(GPIO_PB1_U1TX);

	GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 9600,
			(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
					UART_CONFIG_PAR_NONE));

	UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 9600,
	                        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
	                         UART_CONFIG_PAR_NONE));

	//rc = f_mount(0, &Fatfs);
	//rc = f_open(&Fil, "HELLO.TXT", FA_WRITE | FA_CREATE_ALWAYS);

	UARTFIFOLevelSet(UART1_BASE,UART_FIFO_TX7_8,UART_FIFO_RX7_8); //fijo los umbrales para la ocurrencia de la interrupcion
	//UARTTxIntModeSet(UART1_BASE, UART_TXINT_MODE_FIFO);

	// Habilito la interrupcion
	//IntRegister(UART1_BASE, UARTinterrupcion);
	//UARTIntRegister(UART1_BASE, UARTinterrupcion); //registra un manejador de interrupciones para la interrupcion de la UART
	UARTIntClear(UART1_BASE, UART_INT_TX | UART_INT_RX); //limpia los flags de interrupcion
	UARTIntEnable(UART1_BASE, UART_INT_RX);
	UARTFIFOEnable(UART1_BASE);
	IntMasterEnable();
	UARTEnable(UART1_BASE); //habilita transmision y recepcion
	IntEnable(INT_UART1);  //habilita las fuentes de interrupcion de la UART

	while(1){;}

}
开发者ID:joseomar,项目名称:Proyectos_CCS-TI,代码行数:48,代码来源:main.c


示例10: platform_uart_setup

u32 platform_uart_setup( unsigned id, u32 baud, int databits, int parity, int stopbits )
{
  u32 config;

  GPIOPinTypeUART(uart_gpio_base [ id ], uart_gpio_pins[ id ]);

  switch( databits )
  {
    case 5:
      config = UART_CONFIG_WLEN_5;
      break;
    case 6:
      config = UART_CONFIG_WLEN_6;
      break;
    case 7:
      config = UART_CONFIG_WLEN_7;
      break;
    default:
      config = UART_CONFIG_WLEN_8;
      break;
  }
  config |= ( stopbits == PLATFORM_UART_STOPBITS_1 ) ? UART_CONFIG_STOP_ONE : UART_CONFIG_STOP_TWO;
  if( parity == PLATFORM_UART_PARITY_EVEN )
    config |= UART_CONFIG_PAR_EVEN;
  else if( parity == PLATFORM_UART_PARITY_ODD )
    config |= UART_CONFIG_PAR_ODD;
  else
    config |= UART_CONFIG_PAR_NONE;

  return UARTConfigSetExpClk(uart_base[ id ], SysCtlClockGet(), baud, config);
}
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:31,代码来源:platform.c


示例11: initUartPins

/**
 * @brief  Función para inicializar los PINS de la UART.
 *
 * @return    -
 *
 * Inicializa los PINs para poder usar la UART.
*/
static void initUartPins(int nPort)
{
  switch(nPort)
  {
    case 0: SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
			SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
			GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
			break;
    case 1: SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
			SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
			GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_2 | GPIO_PIN_3);
    			break;
	default:
			break;
  }
}
开发者ID:ikerexxe,项目名称:BroadCar,代码行数:23,代码来源:uartDrv.c


示例12: uarts_init

static void uarts_init()
{
  unsigned i;

  for( i = 0; i < NUM_UART; i ++ )
    SysCtlPeripheralEnable(uart_sysctl[ i ]);

  // Special case for UART 0
  // Configure the UART for 115,200, 8-N-1 operation.
  GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
  UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), CON_UART_SPEED,
                     (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                      UART_CONFIG_PAR_NONE));
                      
                      
#if defined( BUF_ENABLE_UART ) && defined( CON_BUF_SIZE )
  // Enable buffering on the console UART
  buf_set( BUF_ID_UART, CON_UART_ID, CON_BUF_SIZE, BUF_DSIZE_U8 );
  // Set interrupt handler and interrupt flag on UART
  
  IntEnable(INT_UART0);

  UARTIntEnable( uart_base[ CON_UART_ID ], UART_INT_RX | UART_INT_RT );
#endif
}
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:25,代码来源:platform.c


示例13: UpdateUARTInit

//*****************************************************************************
//
// Initializes the UART update interface.
//
//*****************************************************************************
void
UpdateUARTInit(void)
{
    //
    // Set the flash programming speed based on the processor speed.
    //
    FlashUsecSet(50);

    //
    // Enable the peripherals used by the UART.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

    //
    // Configure the UART Tx and Rx pins for use by the UART.
    //
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Configure and enable the UART for 115,200, 8-N-1 operation.
    //
    UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
                        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                         UART_CONFIG_PAR_NONE));
    UARTEnable(UART0_BASE);

    //
    // Enable the UART receive interrupts.
    //
    UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
    IntEnable(INT_UART0);
}
开发者ID:yangjunjiao,项目名称:Luminary-Micro-Library,代码行数:38,代码来源:update.c


示例14: main

int main(void) {
    SysCtlClockSet(
    SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
    UARTStdioConfig(0, 115200, 16000000);

    ADCSequenceDisable(ADC0_BASE, 1);
    ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
    ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS);
    ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS);
    ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS);
    ADCSequenceStepConfigure(ADC0_BASE, 1, 3,
    ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END);
    ADCSequenceEnable(ADC0_BASE, 1);

    UARTprintf("This is ADC examlpe");

    while (1) {
        UARTprintf("Temperature is: %d \210 C\n", ADC_getVal());
        SysCtlDelay(40000000 / 3);
    }
}
开发者ID:datho1801,项目名称:TivaC_TUT,代码行数:30,代码来源:main.c


示例15: LogInit

//*****************************************************************************
//
// Initializes the logging interface.
//
//*****************************************************************************
void
LogInit(void)
{
    //
    // Enable the peripherals used to perform logging.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

    //
    // Configure the UART pins appropriately.
    //
    GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_2 | GPIO_PIN_3);

    //
    // Configure the UART for 115,200, 8-N-1 operation.
    //
    UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 115200,
                        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                         UART_CONFIG_PAR_NONE));
    UARTEnable(UART1_BASE);

    //
    // Enable the UART interrupt.
    //
    UARTIntEnable(UART1_BASE, UART_INT_TX);
    IntEnable(INT_UART1);

    //
    // Write a log message to indicate that the application has started.
    //
    LogWrite("Application started");
}
开发者ID:VENGEL,项目名称:StellarisWare,代码行数:38,代码来源:log.c


示例16: PSO_UART0Config

/******************************************************************************
 * UART-0 Configuration VCP (Virtual Com Port)
 * ----------------------------------------------------------------------------
 * UART 0 -> Port A -> Pins PA0(Tx) & PA1(Rx)
 * 9600-8N1
 *
 ******************************************************************************/
void PSO_UART0Config()
{
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);	/* Enable UART Module 0 */
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);	/* Enable GPIO Port A for UART-0 use */

	GPIOPinConfigure(GPIO_PA0_U0RX);
	GPIOPinConfigure(GPIO_PA1_U0TX);
	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
	                    UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
	                    UART_CONFIG_PAR_NONE);

	/* UART-0 interrupt configuration */
	UARTDisable(UART0_BASE);
	UARTFIFOEnable(UART0_BASE);

	IntEnable(INT_UART0);

	UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX1_8, UART_FIFO_RX7_8);

	UARTIntEnable(UART0_BASE, UART_INT_RX);  // | UART_INT_RT
	UARTEnable(UART0_BASE);
	UARTFIFOEnable(UART0_BASE);
}
开发者ID:monkaco,项目名称:PSO,代码行数:32,代码来源:pso_init+(Rogério+Lima's+conflicted+copy+2015-11-22).c


示例17: UART3_Init

void UART3_Init()
{
	//Enable the UART0 and GPIOC peripherals (the UART2 pins are on GPIO Port C)
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

    GPIOPinConfigure(GPIO_PC6_U3RX);
    GPIOPinConfigure(GPIO_PC7_U3TX);
    GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);

    //Initialize the parameters for the UART: baud_rate, 8-1-N
    UARTConfigSetExpClk(UART3_BASE, SysCtlClockGet(), BAUD_RATE,
        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

    //The receiver timeout interrupt is
    IntMasterEnable(); 		//enable processor interrupts
    IntEnable(INT_UART3); 	//enable the UART3 interrupt
   /*
    * receiver interrupts (RX) - generated when a single character has been received (when FIFO is disabled)
    *			or when the specified FIFO level has been reached (when FIFO is enabled)
    * receiver timeout interrupts (RT) - generated when a character has been received,
    * 			and a second character has not been received within a 32-bit period.
    */
    UARTIntEnable(UART3_BASE, UART_INT_RX | UART_INT_RT);
}
开发者ID:PaulinaSadowska,项目名称:INZ_UART3_bluetooth_demo,代码行数:25,代码来源:UART3_conf.c


示例18: LogInit

//*****************************************************************************
//
// Initializes the logging interface.
//
//*****************************************************************************
void
LogInit(void)
{
    //
    // Enable the peripherals used to perform logging.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Configure the UART pins appropriately.
    //
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_1 | GPIO_PIN_0);

    //
    // Initialize the UART as a console for text I/O.
    //
    UARTStdioInit(0);

    //
    // Print hello message to user via the serial port.
    //
    UARTprintf("\n\nQuickstart Keypad Example Program\n");
    UARTprintf("Type \'help\' for help.\n");

    //
    // Write a log message to indicate that the application has started.
    //
    LogWrite("Application started");
}
开发者ID:VENGEL,项目名称:StellarisWare,代码行数:35,代码来源:log.c


示例19: ConfigureXBeeUART

void ConfigureXBeeUART(void) {
	
    //
    // Enable the GPIO Peripheral used by the UART.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

    //
    // Enable UART2
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);

    //
    // Configure GPIO Pins for UART mode.
    //
    GPIOPinConfigure(GPIO_PC6_U3RX);
    GPIOPinConfigure(GPIO_PC7_U3TX);
    GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);

    //
    // Use the internal 16MHz oscillator as the UART clock source.
    //
    UARTClockSourceSet(UART3_BASE, UART_CLOCK_PIOSC);
		UARTConfigSetExpClk(UART3_BASE, 16000000, SERIAL_SPEED,
                        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                         UART_CONFIG_PAR_NONE));
		
		UARTEnable(UART3_BASE);
}
开发者ID:Teider,项目名称:QuIES,代码行数:29,代码来源:serial.c


示例20: main

int main(void)
{
	/*Set the clocking to directly run from the crystal at 8MHz*/
	SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);


    /* Make the UART pins be peripheral controlled. */
	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
	
	/* Sets the configuration of a UART. */
	UARTConfigSetExpClk(UART0_BASE, 8000000, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

    while(1)
    {

    if(UARTCharsAvail(UART0_BASE))
    {
    	/* Unsigned Char */
    	UARTCharPut(UART0_BASE,(unsigned char)(UARTCharGet(UART0_BASE)+1));
    }

    }

}
开发者ID:dhanawadeamit,项目名称:stellaris-guru,代码行数:27,代码来源:main.c



注:本文中的GPIOPinTypeUART函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GPIOSetDir函数代码示例发布时间:2022-05-30
下一篇:
C++ GPIOPinTypeSSI函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap