本文整理汇总了C++中GPIOPinTypeUART函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIOPinTypeUART函数的具体用法?C++ GPIOPinTypeUART怎么用?C++ GPIOPinTypeUART使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPIOPinTypeUART函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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 ***/
示例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 );
}
示例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
}
示例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){;}
}
示例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();
}
示例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){;}
}
示例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);
}
示例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;
}
}
示例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
}
示例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);
}
示例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);
}
}
示例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");
}