本文整理汇总了C++中GPIOPinConfigure函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIOPinConfigure函数的具体用法?C++ GPIOPinConfigure怎么用?C++ GPIOPinConfigure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPIOPinConfigure函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: EK_LM4F120XL_initSDSPI
/*
* ======== EK_LM4F120XL_initSDSPI ========
*/
Void EK_LM4F120XL_initSDSPI(Void)
{
/* Enable the peripherals used by the SD Card */
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
/* Configure pad settings */
GPIOPadConfigSet(GPIO_PORTB_BASE,
GPIO_PIN_4 | GPIO_PIN_7,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
GPIOPadConfigSet(GPIO_PORTB_BASE,
GPIO_PIN_6,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(GPIO_PORTA_BASE,
GPIO_PIN_5,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
GPIOPinConfigure(GPIO_PB4_SSI2CLK);
GPIOPinConfigure(GPIO_PB6_SSI2RX);
GPIOPinConfigure(GPIO_PB7_SSI2TX);
/*
* These GPIOs are connected to PB6 and PB7 and need to be brought into a
* GPIO input state so they don't interfere with SPI communications.
*/
GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_0);
GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_1);
SDSPI_init();
}
示例3: 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);
}
示例4: SysCtlPeripheralEnable
//Initialize as a slave
void TwoWire::begin(uint8_t address)
{
if(i2cModule == NOT_ACTIVE) {
i2cModule = BOOST_PACK_WIRE;
}
SysCtlPeripheralEnable(g_uli2cPeriph[i2cModule]);
GPIOPinConfigure(g_uli2cConfig[i2cModule][0]);
GPIOPinConfigure(g_uli2cConfig[i2cModule][1]);
GPIOPinTypeI2C(g_uli2cBase[i2cModule], g_uli2cSDAPins[i2cModule]);
GPIOPinTypeI2CSCL(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]);
slaveAddress = address;
//Enable slave interrupts
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
I2CMasterDisable(MASTER_BASE);
I2CSlaveEnable(SLAVE_BASE);
I2CSlaveInit(SLAVE_BASE, address);
IntMasterEnable();
}
示例5: motors_init
void motors_init(void) {
int i;
uint8_t pin_mask;
uint32_t motor_per;
// Set Pins to output/PWM in GPIO
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1);
GPIOPinConfigure(GPIO_PF2_M1PWM6);
GPIOPinConfigure(GPIO_PF3_M1PWM7);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_3);
// Configure the pin for standby control
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6);
SysCtlPWMClockSet(SYSCTL_PWMDIV_64);
// Configure the PWM for each pin:
// Turn on the generators and set the PW to 0
// The output is still OFF. Turn on with set_motor_pwm_state
for (i = 0; i < NUM_MOTORS; i++) {
PWMGenConfigure(motors[i].pwm_base_module, motors[i].pwm_generator, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
motor_per = calc_cycles(MOTOR_PERIOD);
PWMGenPeriodSet(motors[i].pwm_base_module, motors[i].pwm_generator, motor_per);
PWMPulseWidthSet(motors[i].pwm_base_module, motors[i].pwm_pin, 0);
PWMGenEnable(motors[i].pwm_base_module, motors[i].pwm_generator);
pin_mask = 1 << (0x0000000F & motors[i].pwm_pin);
PWMOutputState(motors[i].pwm_base_module, pin_mask, 0);
}
}
示例6: EK_LM4F120XL_initI2C
/*
* ======== LM4F120H5QR_initI2C ========
*/
Void EK_LM4F120XL_initI2C(Void)
{
/* I2C1 Init */
/* Enable the peripheral */
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
/* Configure the appropriate pins to be I2C instead of GPIO. */
GPIOPinConfigure(GPIO_PA6_I2C1SCL);
GPIOPinConfigure(GPIO_PA7_I2C1SDA);
GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);
/* I2C3 Init */
/* Enable the peripheral */
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3);
/* Configure the appropriate pins to be I2C instead of GPIO. */
GPIOPinConfigure(GPIO_PD0_I2C3SCL);
GPIOPinConfigure(GPIO_PD1_I2C3SDA);
GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0);
GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1);
/*
* These GPIOs are connected to PD0 and PD1 and need to be brought into a
* GPIO input state so they don't interfere with I2C communications.
*/
GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_6);
GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_7);
I2C_init();
}
示例7: ConfigureUARTSensores
void ConfigureUARTSensores() {
//
// Enable the GPIO Peripheral used by the UART.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
//
// Enable UART2
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART4);
//
// Configure GPIO Pins for UART mode.
//
GPIOPinConfigure(GPIO_PC4_U4RX);
GPIOPinConfigure(GPIO_PC5_U4TX);
GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
//
// Use the internal 16MHz oscillator as the UART clock source.
//
UARTClockSourceSet(UART4_BASE, UART_CLOCK_PIOSC);
UARTConfigSetExpClk(UART4_BASE, 16000000, SERIAL_SPEED,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
UARTEnable(UART4_BASE);
}
示例8: main
int main(void)
{
uint32_t ui32Index;
uint32_t ui32Data;
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
GPIOPinTypeSSI(GPIO_PORTA_BASE,GPIO_PIN_5|GPIO_PIN_3|GPIO_PIN_2);
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 10000, 16);
SSIEnable(SSI0_BASE);
while(1)
{
for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++)
{
ui32Data = (Reverse(pui8DataTx[ui32Index]) << 8) + (1 << ui32Index);
SSIDataPut(SSI0_BASE, ui32Data);
while(SSIBusy(SSI0_BASE))
{
}
}
}
}
示例9: I2C_Init0
void I2C_Init0(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
//reset I2C module
SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);
//enable GPIO peripheral that contains I2C
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
// Configure the pin muxing for I2C0 functions on port B2 and B3.
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
// Select the I2C function for these pins.
GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
// Enable and initialize the I2C0 master module. Use the system clock for
// the I2C0 module. The last parameter sets the I2C data transfer rate.
// If false the data rate is set to 100kbps and if true the data rate will
// be set to 400kbps.
I2CMasterInitExpClk(I2C0_BASE, SysCtlClockGet(), false);
//Thrasher - Why was this here?
//clear I2C FIFOs
//HWREG(I2C0_BASE + I2C_O_FIFOCTL) = 80008000;
}
示例10: main
int main()
{
SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
GPIOPinConfigure(GPIO_PB4_SSI2CLK);
GPIOPinConfigure(GPIO_PB7_SSI2TX);
GPIOPinTypeSSI(GPIO_PORTB_BASE,GPIO_PIN_4|GPIO_PIN_7);
SSIConfigSetExpClk(SSI2_BASE,SysCtlClockGet(),SSI_FRF_MOTO_MODE_0,SSI_MODE_MASTER,2000000,8);
SSIEnable(SSI2_BASE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3);
GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_2,0);
GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,0);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_6);
GPIOPinWrite(GPIO_PORTB_BASE,GPIO_PIN_6,0);
while(1)
{
SSIDataPut(SSI2_BASE,0xAA);
latch();
SysCtlDelay(SysCtlClockGet()/10);
SSIDataPut(SSI2_BASE,0x55);
latch();
SysCtlDelay(SysCtlClockGet()/10);
}
}
示例11: 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);
}
示例12: tm4c129EthInitGpio
void tm4c129EthInitGpio(NetInterface *interface)
{
//DK-TM4C129X evaluation board?
#if defined(USE_DK_TM4C129X)
//Enable GPIO clocks
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
//Select the relevant alternate function for PF1, PK4 and PK6
GPIOPinConfigure(GPIO_PF1_EN0LED2);
GPIOPinConfigure(GPIO_PK4_EN0LED0);
GPIOPinConfigure(GPIO_PK6_EN0LED1);
//Configure Ethernet LED pins for proper operation
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_1);
GPIOPinTypeEthernetLED(GPIO_PORTK_BASE, GPIO_PIN_4 | GPIO_PIN_6);
//EK-TM4C1294XL evaluation board?
#elif defined(USE_EK_TM4C1294XL)
//Enable GPIO clock
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
//Select the relevant alternate function for PF0 and PF4
GPIOPinConfigure(GPIO_PF0_EN0LED0);
GPIOPinConfigure(GPIO_PF4_EN0LED1);
//Configure Ethernet LED pins for proper operation
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4);
#endif
}
示例13: 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_GPIOA);
//
// Enable UART0
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Configure GPIO Pins for UART mode.
//
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
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);
UARTConfigSetExpClk(UART0_BASE, 16000000, SERIAL_SPEED,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
UARTEnable(UART0_BASE);
}
示例14: 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)
{
}
}
示例15: main
int main(void) {
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_SYSDIV_5| SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_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);
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
ledPinConfig();
while (1)
{
Test2();
//print_temc();
SysCtlDelay(SysCtlClockGet()/3);
}
}