本文整理汇总了C++中UARTStdioInit函数的典型用法代码示例。如果您正苦于以下问题:C++ UARTStdioInit函数的具体用法?C++ UARTStdioInit怎么用?C++ UARTStdioInit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UARTStdioInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: portInit2
void portInit2()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles
//IntMasterEnable(); //Temporarily put here
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 9600,
// (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
// UART_CONFIG_PAR_NONE));
// If interrupts are desired, then enable interrupts on this UART
IntEnable(INT_UART0);
UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
UARTStdioInit(0); //configures this UART0 as the uart to use for UARTprintf
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles
/* Outputs */
GPIOPadConfigSet(GPIO_PORTB_BASE, (GPIO_PIN_0 | GPIO_PIN_1), GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, (GPIO_PIN_0 | GPIO_PIN_1)); //configure LEDs
IntMasterEnable();
}
示例2: main
//*****************************************************************************
//
// This example application demonstrates the use of the timers to generate
// periodic interrupts.
//
//*****************************************************************************
int
main(void)
{
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Initialize the UART and write status.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
UARTprintf("\033[2JTimers example\n");
UARTprintf("T1: 0 T2: 0");
//
// Enable the peripherals used by this example.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
//
// Enable processor interrupts.
//
ROM_IntMasterEnable();
//
// Configure the two 32-bit periodic timers.
//
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
ROM_TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC);
ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet());
ROM_TimerLoadSet(TIMER1_BASE, TIMER_A, ROM_SysCtlClockGet() / 2);
//
// Setup the interrupts for the timer timeouts.
//
ROM_IntEnable(INT_TIMER0A);
ROM_IntEnable(INT_TIMER1A);
ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
ROM_TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
//
// Enable the timers.
//
ROM_TimerEnable(TIMER0_BASE, TIMER_A);
ROM_TimerEnable(TIMER1_BASE, TIMER_A);
//
// Loop forever while the timers run.
//
while(1)
{
}
}
示例3: main
/*
** Main Function.
*/
int main(void)
{
unsigned char choice = 0;
/* Enable the clocks for McSPI0 module.*/
McSPI0ModuleClkConfig();
/* Perform Pin-Muxing for SPI0 Instance.*/
McSPIPinMuxSetup(0);
/* Perform Pin-Muxing for CS0 of SPI0 Instance.*/
McSPI0CSPinMuxSetup(MCSPI_CH_NUM);
/* Initialize the UART utility functions.*/
UARTStdioInit();
/* Enable IRQ in CPSR.*/
IntMasterIRQEnable();
UARTPuts("Here the McSPI controller on the SOC communicates with ",-1);
UARTPuts("the McSPI Flash.\r\n\r\n",-1);
/* Initialize the EDMA3 instance.*/
EDMA3Initialize();
/* Request EDMA3CC for Tx and Rx channels for SPI0. */
RequestEDMA3Channels();
/* Set up the McSPI instance.*/
McSPISetUp();
/* Enable the SPI Flash for writing to it. */
WriteEnable();
UARTPuts("Do you want to erase a sector of the flash before writing to it ?.", -1);
UARTPuts("\r\nInput y(Y)/n(N) to proceed.\r\n", -1);
choice = UARTGetc();
UARTPutc(choice);
if(('y' == choice) || ('Y' == choice))
{
/* Erasing the specified sector of SPI Flash. */
FlashSectorErase();
}
/* Enable the SPI Flash for writing to it. */
WriteEnable();
/* Write data of 1 page size into a page of Flash.*/
FlashPageProgram();
/* Read data of 1 page size from a page of flash.*/
ReadFromFlash();
/* Verify the data written to and read from Flash are same or not.*/
VerifyData();
while(1);
}
示例4: UIInit
//*****************************************************************************
//
//! Initializes the user interface.
//!
//! This function initializes the user interface modules (ethernet),
//! preparing them to operate.
//!
//! \return None.
//
//*****************************************************************************
void
UIInit(void)
{
//
// Initialize the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
UARTprintf("\033[2JEK-LM3S9B92 Plane-Power control board\n");
//
// Initialize the Ethernet user interface. Use DHCP
//
UIEthernetInit( true );
//
// Configure SysTick to provide a periodic user interface interrupt.
//
SysTickPeriodSet( ROM_SysCtlClockGet() / UI_INT_RATE );
SysTickIntEnable();
SysTickEnable();
}
示例5: main
//*****************************************************************************
//
// Print "Hello world!" to the UART on the Stellaris evaluation board.
//
//*****************************************************************************
int
main(void)
{
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Initialize the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
//
// Hello!
//
UARTprintf("\033[2JHello World!\n");
//
// Finished.
//
while(1)
{
}
}
示例6: InitConsole
//*****************************************************************************
//
// This function sets up UART0 to be used for a console to display information
// as the example is running.
//
//*****************************************************************************
void
InitConsole(void)
{
//
// 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);
//
// 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.
//
UARTStdioInit(0);
}
示例7: init
void init()
{
ROM_FPUEnable();
ROM_FPULazyStackingEnable();
ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIO_PORTB_DIR_R = 0x00;
GPIO_PORTB_DEN_R = 0xff;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 1000000);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER);
reset();
}
示例8: 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");
}
示例9: uart_setup
static void uart_setup(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
}
示例10: SerialBegin
// Serial
virtual void SerialBegin(int serialDevice, int baudrate) {
if (serialDevice == 0) {
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
MAP_GPIOPinConfigure(GPIO_PA0_U0RX);
MAP_GPIOPinConfigure(GPIO_PA1_U0TX);
MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
UARTEnable(UART0_BASE);
}
}
示例11: UartInit
void UartInit(void)
{
/* Enable GPIO port A which is used for UART0 pins. */
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);
/* Initialize the UART for console I/O. */
UARTStdioInit(0);
}
示例12: halUartInit
/** Initialize UART0 to use for stdio
* @pre UART0 pins were configured
*/
void halUartInit()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
PERIPHERAL_ENABLE_DELAY();
#ifdef TIVA
//UARTStdioConfig(uint32_t ui32PortNum, uint32_t ui32Baud, uint32_t ui32SrcClock)
UARTStdioConfig(0, 115200, SysCtlClockGet());
#else
UARTStdioInit(0); //configures this UART0 as the uart to use for UARTprintf
#endif
IntEnable(INT_UART0); // If interrupts are desired, then enable interrupts on this UART
UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
}
示例13: cmd_init
void cmd_init(void)
{
//
// Enable and Initialize the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
cmd_printf("\nSplitAlarm - UART Loaded\n");
cmd_printf("> ");
}
示例14: main
int main(void)
{
unsigned int triggerValue = 0;
/* Setup the MMU and do necessary MMU configurations. */
MMUConfigAndEnable();
/* Enable all levels of CACHE. */
CacheEnable(CACHE_ALL);
/* Set up the UART2 peripheral */
UARTStdioInit();
/* Enable the WDT clocks */
WatchdogTimer1ModuleClkConfig();
/* Reset the Watchdog Timer */
WatchdogTimerReset(SOC_WDT_1_REGS);
/* Disable the Watchdog timer */
WatchdogTimerDisable(SOC_WDT_1_REGS);
/* Perform the initial settings for the Watchdog Timer */
WatchdogTimerSetUp();
/* Send the message to UART console */
UARTPuts("Program Reset!", -1);
UARTPuts("Input any key at least once in every 4 seconds to avoid a further reset.\n\r", -1);
/* Enable the Watchdog Timer */
WatchdogTimerEnable(SOC_WDT_1_REGS);
while(1)
{
/* Wait for an input through UART. If no input is given,
** the WDT will timeout and reset will occur.
*/
if(UARTGetc())
{
triggerValue += 1;
/* Write into the trigger register. This will load the value from the
** load register into the counter register and hence timer will start
** from the initial count.
*/
WatchdogTimerTriggerSet(SOC_WDT_1_REGS, triggerValue);
}
}
}
示例15: init
//
//Initialization method
//
void init(void) {
//Necessary inits for chip
LockoutProtection();
InitializeMCU();
//Various driver inits
//initUART
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
//motors
InitializeMotors(false, false);
}