本文整理汇总了C++中GPIOPadConfigSet函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIOPadConfigSet函数的具体用法?C++ GPIOPadConfigSet怎么用?C++ GPIOPadConfigSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPIOPadConfigSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 ***/
示例2: speakerInit
void speakerInit()
{
//
// Enable the GPIO Port H.
//
SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOH );
//
// Configure GPIO_H to drive the Speaker.
//
GPIOPinTypeGPIOOutput( GPIO_PORTH_BASE, GPIO_PIN_1 | GPIO_PIN_0 );
GPIOPadConfigSet( GPIO_PORTH_BASE,GPIO_PIN_1 | GPIO_PIN_0,GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU );
//
// Set PortH<0> ON and PortH<1> OFF.
//
GPIOPinWrite( GPIO_PORTH_BASE, GPIO_PIN_1 | GPIO_PIN_0, 0x01 );
//
// The initial time to execute is Delta SysTicks from now.
//
speakerDelta1 = (SYSTICK_FREQUENCY/(2*buzzFreq1));
speakerDelta2 = (SYSTICK_FREQUENCY/(2*buzzFreq2));
freq= speakerDelta1;
speakerNext = sysTickCount + freq;
}
示例3: RIT128x96x4Enable
//*****************************************************************************
//
//! Enable the SSI component of the OLED display driver.
//!
//! \param ulFrequency specifies the SSI Clock Frequency to be used.
//!
//! This function initializes the SSI interface to the OLED display.
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4Enable(unsigned long ulFrequency)
{
//
// Disable the SSI port.
//
SSIDisable(SSI0_BASE);
//
// Configure the SSI0 port for master mode.
//
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_3,
SSI_MODE_MASTER, ulFrequency, 8);
//
// (Re)Enable SSI control of the FSS pin.
//
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_3);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_STRENGTH_8MA,
GPIO_PIN_TYPE_STD_WPU);
//
// Enable the SSI port.
//
SSIEnable(SSI0_BASE);
//
// Indicate that the RIT driver can use the SSI Port.
//
HWREGBITW(&g_ulSSIFlags, FLAG_SSI_ENABLED) = 1;
}
示例4: RIT128x96x4Disable
//*****************************************************************************
//
//! Enable the SSI component of the OLED display driver.
//!
//! This function initializes the SSI interface to the OLED display.
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4Disable(void)
{
unsigned long ulTemp;
//
// Indicate that the RIT driver can no longer use the SSI Port.
//
HWREGBITW(&g_ulSSIFlags, FLAG_SSI_ENABLED) = 0;
//
// Drain the receive fifo.
//
while(SSIDataGetNonBlocking(SSI0_BASE, &ulTemp) != 0)
{
}
//
// Disable the SSI port.
//
SSIDisable(SSI0_BASE);
//
// Disable SSI control of the FSS pin.
//
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_STRENGTH_8MA,
GPIO_PIN_TYPE_STD_WPU);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_PIN_3);
}
示例5: GPIO_Init
// *************** GPIO_Init ***************
void GPIO_Init( GPIO_PORT_T port, GPIO_PIN_T pins, unsigned long dir_mode,
unsigned long strength, unsigned long pin_type )
{
if( 0 == GPIO_PortStatusFlag[port] )
{
SysCtlPeripheralEnable( GPIO_Peripheral[port] );
GPIO_PortStatusFlag[port] = 1;
}
switch ( pin_type )
{
case CCP:
{
GPIOPinTypeTimer ( GPIO_PortBase[port], pins );
break;
}
case PWM:
{
break;
}
default:
{
// regular GPIOs
GPIOPadConfigSet( GPIO_PortBase[port], pins, strength, pin_type );
GPIODirModeSet( GPIO_PortBase[port], pins, dir_mode );
break;
}
}
}
示例6: GPIOPinTypeGPIOInput
lswitch::lswitch(memory_address_t lswitch_base, memory_address_t lswitch_pin,
semaphore *sem, utimer_t timer_id, subtimer_t timer_subtimer,
uint32_t switch_interrupt, uint32_t interrupt_mask, bool start) {
base = lswitch_base;
pin = lswitch_pin;
ctlsys::enable_periph(base);
GPIOPinTypeGPIOInput(base, pin);
GPIODirModeSet(base, pin, GPIO_DIR_MODE_IN);
if ((base == GPIO_PORTF_BASE) && (pin & GPIO_PIN_0)) {
HWREG(base + GPIO_O_LOCK) = GPIO_LOCK_KEY;
HWREG(base + GPIO_O_CR) = 0x01;
HWREG(base + GPIO_O_LOCK) = 0;
GPIOPadConfigSet(base, pin, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
}
/* other solution: timer scoreboard */
this->tim = timer(timer_id, timer_subtimer, TIMER_CFG_ONE_SHOT, SysCtlClockGet() / 50,
ctlsys::timer_timeout_from_subtimer(timer_subtimer));
GPIOIntTypeSet(base, pin, switch_interrupt);
IntEnable(interrupt_mask);
this->sem = sem;
*(this->sem) = semaphore();
if (start) {
this->start();
}
}
示例7: buttonSetup
void buttonSetup() {
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE, GPIO_PIN_0);
GPIOPadConfigSet(GPIO_PORTJ_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE, GPIO_PIN_1);
//GPIOPadConfigSet(GPIO_PORTJ_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
}
示例8: ButtonsInit
//*****************************************************************************
//
//! Initializes the GPIO pins used by the board pushbuttons.
//!
//! This function must be called during application initialization to
//! configure the GPIO pins to which the pushbuttons are attached. It enables
//! the port used by the buttons and configures each button GPIO as an input
//! with a weak pull-up.
//!
//! \return None.
//
//*****************************************************************************
void ButtonsInit(void) {
//
// Enable the GPIO port to which the pushbuttons are connected.
//
SysCtlPeripheralEnable(BUTTONS_GPIO_PERIPH);
//
// Unlock PF0 so we can change it to a GPIO input
// Once we have enabled (unlocked) the commit register then re-lock it
// to prevent further changes. PF0 is muxed with NMI thus a special case.
//
HWREG(BUTTONS_GPIO_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
HWREG(BUTTONS_GPIO_BASE + GPIO_O_CR) |= 0x01;
HWREG(BUTTONS_GPIO_BASE + GPIO_O_LOCK) = 0;
//
// Set each of the button GPIO pins as an input with a pull-up.
//
GPIODirModeSet(BUTTONS_GPIO_BASE, ALL_BUTTONS, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(BUTTONS_GPIO_BASE, ALL_BUTTONS, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD_WPU);
//
// Initialize the debounced button state with the current state read from
// the GPIO bank.
//
g_ucButtonStates = GPIOPinRead(BUTTONS_GPIO_BASE, ALL_BUTTONS);
}
示例9: prvSetupHardware
void prvSetupHardware( void )
{
/*
If running on Rev A2 silicon, turn the LDO voltage up to 2.75V. This is
a workaround to allow the PLL to operate reliably.
*/
if( DEVICE_IS_REVA2 )
{
SysCtlLDOSet( SYSCTL_LDO_2_75V );
}
// Set the clocking to run from the PLL at 50 MHz
SysCtlClockSet( SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ );
/*
Enable Port F for Ethernet LEDs
LED0 Bit 3 Output
LED1 Bit 2 Output
*/
SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOF );
GPIODirModeSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_DIR_MODE_HW );
GPIOPadConfigSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3 ), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD );
}
示例10: OSRAM128x64x4Disable
//*****************************************************************************
//
//! Enable the SSI component of the OLED display driver.
//!
//! \param ulFrequency specifies the SSI Clock Frequency to be used.
//!
//! This function initializes the SSI interface to the OLED display.
//!
//! This function is contained in <tt>osram128x64x4.c</tt>, with
//! <tt>osram128x64x4.h</tt> containing the API definition for use by
//! applications.
//!
//! \return None.
//
//*****************************************************************************
void
OSRAM128x64x4Disable(void)
{
unsigned long ulTemp;
//
// Indicate that the OSRAM driver can no longer use the SSI Port.
//
g_bSSIEnabled = false;
//
// Drain the receive fifo.
//
while(SSIDataNonBlockingGet(SSI0_BASE, &ulTemp) != 0)
{
}
//
// Disable the SSI port.
//
SSIDisable(SSI0_BASE);
//
// Disable SSI control of the FSS pin.
//
GPIODirModeSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_STRENGTH_8MA,
GPIO_PIN_TYPE_STD_WPU);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_PIN_3);
}
示例11: ctl_buttons_isr_init
//ISR INIT
void ctl_buttons_isr_init(CTL_ISR_FN_t fn)
{
int en; int32u proba;
en=ctl_global_interrupts_set(0);
buttons_isr=fn;
SysCtlPeripheralEnable(PUSHBUTTON_PERIPH);
//UNLOCKOLNI KELL A PF0 REGISZTERT MERT NMI-RE VAN ALLITVA
HWREG(PUSHBUTTON_PORT + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
HWREG(PUSHBUTTON_PORT + GPIO_O_CR) |= 0x01;
HWREG(PUSHBUTTON_PORT + GPIO_O_LOCK) = 0;
GPIODirModeSet(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH , GPIO_DIR_MODE_IN);
GPIOPadConfigSet(PUSHBUTTON_PORT,LEFT_SWITCH | RIGHT_SWITCH , GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPinIntDisable(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH);
if((GPIOPinIntStatus(PUSHBUTTON_PORT, 1)) == LEFT_SWITCH )
{
GPIOPinIntClear(PUSHBUTTON_PORT, LEFT_SWITCH );
}
if((GPIOPinIntStatus(PUSHBUTTON_PORT, 1)) == RIGHT_SWITCH )
{
GPIOPinIntClear(PUSHBUTTON_PORT, RIGHT_SWITCH );
}
ctl_set_priority(PUSHBUTTON_IRQ_PRIORITY, 1);
ctl_unmask_isr(PUSHBUTTON_IRQ_PRIORITY);
ctl_global_interrupts_set(en);
GPIOIntTypeSet(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH , GPIO_BOTH_EDGES); //GPIO_BOTH_EDGES
GPIOPinIntEnable(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH );
}
示例12: Task_HeaterOn
extern void Task_HeaterOn( void *pvParameters ) {
//
// Enable (power-on) PortG
//
SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOG );
//
// Enable the GPIO Port N.
//
SysCtlPeripheralEnable( SYSCTL_PERIPH_GPION );
//
// Configure GPIO_G to drive the HeaterOn_H.
//
GPIOPinTypeGPIOOutput( GPIO_PORTG_BASE, GPIO_PIN_0 );
GPIOPadConfigSet( GPIO_PORTG_BASE,
GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD );
//
// Configure GPIO_N to drive the Status LED.
//
GPIOPinTypeGPIOOutput( GPIO_PORTN_BASE, GPIO_PIN_0 );
GPIOPadConfigSet( GPIO_PORTN_BASE,
GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD );
while ( 1 ) {
OffTime_mS = (TimeBase_mS - OnTime_mS);
//
// Set HeaterOn_H and D2 for OnTime_mS.
//
GPIOPinWrite( GPIO_PORTG_BASE, GPIO_PIN_0, 0x01 );
GPIOPinWrite( GPIO_PORTN_BASE, GPIO_PIN_0, 0x01 );
//Could seta global variable to control this amount of time
vTaskDelay( ( OnTime_mS * configTICK_RATE_HZ ) / TimeBase_mS );
//
// Turn-off HeaterOn_H and D2 for 750 mS.
//
GPIOPinWrite( GPIO_PORTG_BASE, GPIO_PIN_0, 0x00 );
GPIOPinWrite( GPIO_PORTN_BASE, GPIO_PIN_0, 0x00 );
//Could seta global variable to control this amount of time
vTaskDelay( ( OffTime_mS * configTICK_RATE_HZ ) / TimeBase_mS );
}
}
示例13: SCCBInit
void SCCBInit(unsigned long setbase,
unsigned char setscl,
unsigned char setsda
){
// memset(&SCCBMaster, 0, sizeof(SCCBMaster));
SCCBMaster.currentBit=0;
SCCBMaster.GpioBase=setbase;
SCCBMaster.sclGpio=setscl;
SCCBMaster.sdaGpio=setsda;
SCCBMaster.state=SCCB_DONE;
//MAP_GPIOPinTypeI2C(GPIO_PORTA_BASE,GPIO_PIN_6|GPIO_PIN_7);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
GPIODirModeSet(SCCBMaster.GpioBase,SCCBMaster.sclGpio, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(SCCBMaster.GpioBase,SCCBMaster.sclGpio,GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_OD);
//
// Set the SCL pin high.
//
GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sclGpio,255);
//
// Configure the SDA pin.
//
GPIODirModeSet(SCCBMaster.GpioBase,SCCBMaster.sdaGpio,GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(SCCBMaster.GpioBase ,SCCBMaster.sdaGpio,GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_OD);
//
// Set the SDA pin high.
//
GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sdaGpio,255);
//
// Configure the timer to generate an interrupt at a rate of 40KHz. This
// will result in a I2C rate of 100 KHz.
// TODO: change this to whichever timer you are using.
// TODO: change this to whichever I2C rate you require.
//
TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER);
TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet() / 400000);
// TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
// TimerEnable(TIMER0_BASE, TIMER_A);
// IntEnable(INT_TIMER0A);
}
示例14: ledSetup
// Functions
void ledSetup() {
uint32_t ui32Strength;
uint32_t ui32PinType;
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPadConfigGet(GPIO_PORTN_BASE, GPIO_PIN_1, &ui32Strength, &ui32PinType);
GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_1, ui32Strength, GPIO_PIN_TYPE_STD);
GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_0, ui32Strength, GPIO_PIN_TYPE_STD);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, ui32Strength, GPIO_PIN_TYPE_STD);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4, ui32Strength, GPIO_PIN_TYPE_STD);
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1);
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_4);
}
示例15: MasterI2C0Init
/*
Set up I2C pins and clock slow/fast
rate400 true = 400KHz, false 100KHz
*/
void MasterI2C0Init(int rate400)
{
//I2CMasterEnable(I2C0_MASTER_BASE); // causes fault
//
// Enable the I2C and GPIO port B blocks as they are needed by this driver.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
//Setup Mux
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3); //Set up direction
//Reconfigure for correct operation
GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_OD);
//
// Configure the I2C SCL and SDA pins for I2C operation.
//
//GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
//GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
//
// Initialize the I2C master.
//
I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(), true);
SysCtlDelay(10000); // delay mandatory here - otherwise portion of SlaveAddrSet() lost!
// Register interrupt handler
// or we could just edit the startup.c file
//I2CIntRegister(I2C0_MASTER_BASE,I2C0IntHandler);
//
// Enable the I2C interrupt.
//
IntEnable(INT_I2C0); // already done via I2CIntRegister
I2CMasterIntEnableEx(I2C0_MASTER_BASE,I2C_MASTER_INT_DATA | I2C_MASTER_INT_TIMEOUT);
//
// Enable the I2C master interrupt.
//
I2CMasterIntEnable(I2C0_MASTER_BASE);
}