本文整理汇总了C++中ROM_GPIOPinConfigure函数的典型用法代码示例。如果您正苦于以下问题:C++ ROM_GPIOPinConfigure函数的具体用法?C++ ROM_GPIOPinConfigure怎么用?C++ ROM_GPIOPinConfigure使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ROM_GPIOPinConfigure函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Config_PWM
static void Config_PWM(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_GPIOPinConfigure(GPIO_PB6_T0CCP0);
ROM_GPIOPinConfigure(GPIO_PB2_T3CCP0);
ROM_GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_6);
// Configure timer
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER3);
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, DEFAULT);
ROM_TimerMatchSet(TIMER0_BASE, TIMER_A, DEFAULT); // PWM
ROM_TimerEnable(TIMER0_BASE, TIMER_A);
ROM_TimerConfigure(TIMER3_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
ROM_TimerLoadSet(TIMER3_BASE, TIMER_A, DEFAULT);
ROM_TimerMatchSet(TIMER3_BASE, TIMER_A, DEFAULT); // PWM
ROM_TimerControlLevel(TIMER3_BASE, TIMER_A, true);
ROM_TimerEnable(TIMER3_BASE, TIMER_A);
ROM_SysCtlPeripheralEnable(DRV_ENABLE_LEFT_CHN_PERIPHERAL);
ROM_SysCtlPeripheralEnable(DRV_ENABLE_RIGHT_CHN_PERIPHERAL);
ROM_GPIOPinTypeGPIOOutput(DRV_ENABLE_LEFT_CHN_PORT, DRV_ENABLE_LEFT_CHN_PIN);
ROM_GPIOPinTypeGPIOOutput(DRV_ENABLE_RIGHT_CHN_PORT, DRV_ENABLE_RIGHT_CHN_PIN);
ROM_GPIOPinWrite(DRV_ENABLE_LEFT_CHN_PORT, DRV_ENABLE_LEFT_CHN_PIN, 0);
ROM_GPIOPinWrite(DRV_ENABLE_RIGHT_CHN_PORT, DRV_ENABLE_RIGHT_CHN_PIN, 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.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable UART0
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Configure GPIO Pins for UART mode.
//
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Use the system clock for the UART.
//
UARTClockSourceSet(UART0_BASE, UART_CLOCK_SYSTEM);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 9600, g_ui32SysClock);
}
示例3: UART_setup_gps
void UART_setup_gps(void)
{
//
// Enable the peripherals used by gps.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
//
// Set GPIO B0 and B1 as UART pins for the gps.
//
ROM_GPIOPinConfigure(GPIO_PB0_U1RX);
ROM_GPIOPinConfigure(GPIO_PB1_U1TX);
ROM_GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Configure the GPS for 9600, 8-N-1 operation.
//
ROM_UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 9600,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
//
// Enable the UART interrupt.
//
ROM_IntEnable(INT_UART1);
ROM_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);
}
开发者ID:krishnamannem,项目名称:spacegoldfish---IEEE-project---Google-Space-Balloon-Challenge,代码行数:28,代码来源:gpsParser.c
示例4: xMBTCPPortInit
BOOL xMBTCPPortInit(USHORT port)
{
ROM_SysCtlPeripheralEnable(WIZ610_GPIO_PERIPH);
ROM_GPIODirModeSet(WIZ610_GPIO_BASE,WIZ610_GPIO_PIN_CMD_ENABLE ,GPIO_DIR_MODE_OUT);
ROM_GPIOPadConfigSet(WIZ610_GPIO_BASE,WIZ610_GPIO_PIN_CMD_ENABLE,GPIO_STRENGTH_8MA,GPIO_PIN_TYPE_STD_WPU);
ROM_GPIOPinWrite(WIZ610_GPIO_BASE,WIZ610_GPIO_PIN_CMD_ENABLE,WIZ610_GPIO_PIN_CMD_ENABLE);
// uart setup
ROM_SysCtlPeripheralEnable(WIZ610_UART_PERIPH);
ROM_GPIOPinConfigure(GPIO_PB0_U1RX);
ROM_GPIOPinConfigure(GPIO_PB1_U1TX);
ROM_GPIOPinTypeUART(WIZ610_GPIO_BASE, WIZ610_GPIO_PIN_RX | WIZ610_GPIO_PIN_TX);
ROM_UARTConfigSetExpClk(WIZ610_UART_BASE, ROM_SysCtlClockGet(), 38400,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
ROM_GPIOPinWrite(WIZ610_GPIO_BASE,WIZ610_GPIO_PIN_CMD_ENABLE,WIZ610_GPIO_PIN_CMD_ENABLE);
ROM_UARTFIFOLevelSet(WIZ610_UART_BASE, UART_FIFO_TX4_8, UART_FIFO_RX1_8);
ROM_IntEnable(INT_UART1);
ROM_UARTEnable(WIZ610_UART_BASE);
ROM_UARTDMAEnable(WIZ610_UART_BASE, UART_DMA_TX);
ROM_UARTIntEnable(WIZ610_UART_BASE, UART_INT_RX);
ROM_IntEnable(INT_UDMA);
WIZ610Transfer();
cmd_modbus_switch=0;
g_ulRxBufACount=0;
modbus_tcp_rab=MODBUS_TCP_IDLE;
return TRUE;
}
示例5: ConfigureUART
//*****************************************************************************
//
// Configure the UART and its pins. This must be called before UARTprintf().
//
//*****************************************************************************
void
ConfigureUART(void)
{
//
// Enable the GPIO Peripheral used by the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable UART0
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Configure GPIO Pins for UART mode.
//
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, g_ui32SysClock);
}
示例6: init_base
static int init_base(uart_t uart, uint32_t baudrate)
{
/*The base address of the chosen UART */
unsigned long ulBase = g_ulUARTBase[uart];
ROM_SysCtlPeripheralEnable(g_ulUARTPeriph[uart]);
switch(uart){
#if UART_0_EN
case UART_0:
ROM_SysCtlPeripheralEnable(UART_0_PORT);
ROM_GPIOPinConfigure(UART_0_RX_PIN);
ROM_GPIOPinConfigure(UART_0_TX_PIN);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
break;
#endif
#if UART_1_EN
case UART_1:
ROM_SysCtlPeripheralEnable(UART_1_PORT);
ROM_GPIOPinConfigure(UART_1_RX_PIN);
ROM_GPIOPinConfigure(UART_1_TX_PIN);
ROM_GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
break;
#endif
}
ROM_UARTDisable(ulBase);
ROM_UARTConfigSetExpClk(ulBase,UART_CLK, baudrate,
(UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8));
ROM_UARTEnable(ulBase);
return 0;
}
示例7: MCInitPwm
void MCInitPwm(uint32_t DutyCycle)
{
// Clock PWM peripheral at SysClk/PWMDIV
ROM_SysCtlPWMClockSet(SYSCTL_PWMDIV_64);
// Enable peripherals
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
// Configure pin PD0 as PWM output
ROM_GPIOPinTypePWM(GPIO_PORTD_BASE, GPIO_PIN_0|GPIO_PIN_1);
ROM_GPIOPinConfigure(GPIO_PD0_M1PWM0);
ROM_GPIOPinConfigure(GPIO_PD1_M1PWM1);
// Calculate PWM clock
uint32_t PWMClock = SysCtlClockGet() / 64;
// Value from/to which PWM counter counts (subtract 1 becouse counter counts from 0). This is PWM period
LoadValue = (PWMClock/PWM_FREQUENCY) - 1;
// Configure PWM
ROM_PWMGenConfigure(PWM1_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN);
ROM_PWMGenPeriodSet(PWM1_BASE, PWM_GEN_0, LoadValue);
// Set PWM signal width
ROM_PWMPulseWidthSet(PWM1_BASE, PWM_OUT_1, (DutyCycle*LoadValue)/DUTY_CYCLE_DIVIDER);
ROM_PWMPulseWidthSet(PWM1_BASE, PWM_OUT_0, (DutyCycle*LoadValue)/DUTY_CYCLE_DIVIDER);
// Enable PWM output 0 and 1
ROM_PWMOutputState(PWM1_BASE, PWM_OUT_0_BIT|PWM_OUT_1_BIT, true);
// Enable PWM generator
ROM_PWMGenEnable(PWM1_BASE, PWM_GEN_0);
}
示例8: ROM_SysCtlPeripheralEnable
//Initialize as a slave
void TwoWire::begin(uint8_t address)
{
if(i2cModule == NOT_ACTIVE) {
i2cModule = BOOST_PACK_WIRE;
}
ROM_SysCtlPeripheralEnable(g_uli2cPeriph[i2cModule]);
ROM_GPIOPinConfigure(g_uli2cConfig[i2cModule][0]);
ROM_GPIOPinConfigure(g_uli2cConfig[i2cModule][1]);
ROM_GPIOPinTypeI2C(g_uli2cBase[i2cModule], g_uli2cSDAPins[i2cModule]);
ROM_GPIOPinTypeI2CSCL(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]);
slaveAddress = address;
//Enable slave interrupts
ROM_IntEnable(g_uli2cInt[i2cModule]);
I2CSlaveIntEnableEx(SLAVE_BASE, I2C_SLAVE_INT_DATA | I2C_SLAVE_INT_STOP);
HWREG(SLAVE_BASE + I2C_O_SICR) =
I2C_SICR_DATAIC | I2C_SICR_STARTIC | I2C_SICR_STOPIC;
//Setup as a slave device
ROM_I2CMasterDisable(MASTER_BASE);
I2CSlaveEnable(SLAVE_BASE);
I2CSlaveInit(SLAVE_BASE, address);
ROM_IntMasterEnable();
}
示例9: xMotorDriverInit
int xMotorDriverInit()
{
SYSCTL_RCGCGPIO_R |= SYSCTL_RCGCGPIO_R10 | SYSCTL_RCGCGPIO_R5;
vSemaphoreCreateBinary(changeSpeed);
ROM_GPIOPinTypePWM(MOTOR_L_PWM_PORT, MOTOR_L_PWM_PIN);
ROM_GPIOPinConfigure(GPIO_PF2_M0PWM2);
ROM_GPIOPinTypePWM(MOTOR_R_PWM_PORT, MOTOR_R_PWM_PIN);
ROM_GPIOPinConfigure(GPIO_PF3_M0PWM3);
GPIO_PORTL_DIR_R |= 0xF;
GPIO_PORTL_DEN_R |= 0xF;
PWM0_1_GENA_R = 0x8C;
PWM0_1_GENB_R = 0x8C;
ROM_PWMGenConfigure(PWM0_BASE, PWM_GEN_1, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_GEN_NO_SYNC);
ROM_PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, 256);
ROM_PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2, 25);
ROM_PWMPulseWidthSet(PWM0_BASE, PWM_OUT_3, 25);
ROM_PWMGenEnable(PWM0_BASE, PWM_GEN_1);
MOTOR_L_DIR1_PORT &= ~MOTOR_L_DIR1_PIN;
MOTOR_L_DIR2_PORT |= MOTOR_L_DIR2_PIN;
MOTOR_R_DIR1_PORT &= ~MOTOR_R_DIR1_PIN;
MOTOR_R_DIR2_PORT |= MOTOR_R_DIR2_PIN;
PWM0_1_CTL_R |= 0x5;
PWM0_ENABLE_R |= 0x4 | 0x8;
return 0;
}
示例10: RGBEnable
//*****************************************************************************
//
//! Enable the RGB LED with already configured timer settings
//!
//! This function or RGBDisable should be called during application
//! initialization to configure the GPIO pins to which the LEDs are attached.
//! This function enables the timers and configures the GPIO pins as timer
//! outputs.
//!
//! \return None.
//
//*****************************************************************************
void
RGBEnable(void)
{
//
// Enable timers to begin counting
//
ROM_TimerEnable(RED_TIMER_BASE, TIMER_BOTH);
ROM_TimerEnable(GREEN_TIMER_BASE, TIMER_BOTH);
ROM_TimerEnable(BLUE_TIMER_BASE, TIMER_BOTH);
//
// Reconfigure each LED's GPIO pad for timer control
//
ROM_GPIOPinConfigure(GREEN_GPIO_PIN_CFG);
ROM_GPIOPinTypeTimer(GREEN_GPIO_BASE, GREEN_GPIO_PIN);
MAP_GPIOPadConfigSet(GREEN_GPIO_BASE, GREEN_GPIO_PIN, GPIO_STRENGTH_8MA_SC,
GPIO_PIN_TYPE_STD);
ROM_GPIOPinConfigure(BLUE_GPIO_PIN_CFG);
ROM_GPIOPinTypeTimer(BLUE_GPIO_BASE, BLUE_GPIO_PIN);
MAP_GPIOPadConfigSet(BLUE_GPIO_BASE, BLUE_GPIO_PIN, GPIO_STRENGTH_8MA_SC,
GPIO_PIN_TYPE_STD);
ROM_GPIOPinConfigure(RED_GPIO_PIN_CFG);
ROM_GPIOPinTypeTimer(RED_GPIO_BASE, RED_GPIO_PIN);
MAP_GPIOPadConfigSet(RED_GPIO_BASE, RED_GPIO_PIN, GPIO_STRENGTH_8MA_SC,
GPIO_PIN_TYPE_STD);
}
示例11: ConfigureUART0
//*****************************************************************************
//
// Configure the UART and its pins. This must be called before UARTprintf().
//
//*****************************************************************************
s8 ConfigureUART0(u32 BaudRate, u8 Prio)
{
if (BaudRate > 115200) { /* 波特率太高,错误返回 */
return(AC_RET_ERROR);
}
//
// Enable the GPIO Peripheral used by the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable UART0
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Configure GPIO Pins for UART mode.
//
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Use the internal 16MHz oscillator as the UART clock source.
//
UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, BaudRate, 16000000);
return AC_RET_OK;
}
示例12: svm_init
// * svm_init *****************************************************************
// * setup pins and PWM hardware to talk to servomotors *
// * Assumes system clock already configured *
// ****************************************************************************
void svm_init(void)
{
ROM_SysCtlPeripheralEnable(SVM_OUTPUT_PORT); // enable clock to GPIO port
ROM_SysCtlPeripheralReset(SVM_OUTPUT_PORT); // reset to clear any previous config
// configure output pads
GPIOPinTypeGPIOOutput(SVM_OUTPUT_PORT_BASE, SVM_OUTPUT_PINS);
// configure PWM
ROM_SysCtlPeripheralEnable(SVM_PWM_MODULE); // enable clock to pwm module
ROM_SysCtlPWMClockSet(SVM_PWM_FPWM_DIV); // configure clock divider to derive Fpwm from Fsys
// wrap 16b PWM counter at 1041 for 3kHz pwm output
ROM_PWMDeadBandDisable(SVM_PWM_BASE, SVM_PWM_GEN); // allow PWM0, PWM1 to behave independently
ROM_PWMGenConfigure(SVM_PWM_BASE, SVM_PWM_GEN, // configure pwm generator
PWM_GEN_MODE_DOWN | // up/down count for center timed PWM
PWM_GEN_MODE_NO_SYNC); // outputs from generator behave independently
ROM_PWMGenPeriodSet(SVM_PWM_BASE, SVM_PWM_GEN, // sets period for generator to appropriate period
SVM_PWM_PERIOD_TICKS);
ROM_PWMPulseWidthSet(SVM_PWM_BASE, SVM_1_PWM, 0); // set initial pulse widths to 0 for safety
ROM_PWMPulseWidthSet(SVM_PWM_BASE, SVM_2_PWM, 0); // set initial pulse widths to 0 for safety
ROM_GPIOPinConfigure(SVM_1_PWM_MUX); // select mux for pwm output hbridge 1
ROM_GPIOPinConfigure(SVM_2_PWM_MUX); // select mux for pwm output hbridge 2
ROM_GPIOPinTypePWM(SVM_OUTPUT_PORT_BASE, SVM_1_PWM_PIN);// do some other step configuring pwm...
ROM_GPIOPinTypePWM(SVM_OUTPUT_PORT_BASE, SVM_2_PWM_PIN);// ...exact function is unknown
ROM_PWMOutputState(SVM_PWM_BASE, SVM_1_PWM_BIT | SVM_2_PWM_BIT, true);
// enable outputs from pwm generator to pins
ROM_PWMGenEnable(SVM_PWM_BASE, SVM_PWM_GEN); // enable pwm output generator
}
示例13: SetupForUART
//*****************************************************************************
//
// Initialize UART0 and set the appropriate communication parameters.
//
//*****************************************************************************
void
SetupForUART(void)
{
//
// We need to make sure that UART0 and its associated GPIO port are
// enabled before we pass control to the boot loader. The serial boot
// loader does not enable or configure these peripherals for us if we
// enter it via its SVC vector.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Set GPIO PA0 and PA1 as UART.
//
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Configure the UART for 115200, n, 8, 1
//
ROM_UARTConfigSetExpClk(UART0_BASE, g_ui32SysClockFreq, 115200,
(UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE |
UART_CONFIG_WLEN_8));
//
// Enable the UART operation.
//
ROM_UARTEnable(UART0_BASE);
}
示例14: 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();
}
示例15: ConfigureUART
//*****************************************************************************
//
// Configure the UART and its pins. This must be called before UARTprintf().
//
//*****************************************************************************
void
ConfigureUART(void)
{
//
// Enable the GPIO Peripheral used by the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable UART0
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Configure GPIO Pins for UART mode.
//
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Use the internal 16MHz oscillator as the UART clock source.
//
UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, 16000000);
//
UARTStdioConfig(0, 115200, 16000000);
}