本文整理汇总了C++中GPIOPadConfigSet函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIOPadConfigSet函数的具体用法?C++ GPIOPadConfigSet怎么用?C++ GPIOPadConfigSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPIOPadConfigSet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 ***/
开发者ID:x893,项目名称:OpenBLT,代码行数:40,代码来源:main.c
示例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;
}
开发者ID:chinmay-ratnaparkhi,项目名称:EECS388-Embedded-Systems,代码行数:25,代码来源:PushButton.c
示例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;
}
开发者ID:serikovigor,项目名称:surd,代码行数:42,代码来源:rit128x96x4.c
示例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);
}
开发者ID:serikovigor,项目名称:surd,代码行数:39,代码来源:rit128x96x4.c
示例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;
}
}
}
开发者ID:yguo89,项目名称:CodeBrain,代码行数:32,代码来源:GPIO_Driver.c
示例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();
}
}
开发者ID:r2labs,项目名称:uncleos,代码行数:33,代码来源:switchpp.cpp
示例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);
}
开发者ID:akerenyi,项目名称:ess,代码行数:7,代码来源:main.c
示例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);
}
开发者ID:vortex314,项目名称:projects,代码行数:37,代码来源:Board.cpp
示例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 );
}
开发者ID:eeshanl,项目名称:ee472,代码行数:27,代码来源:main.c
示例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);
}
开发者ID:AldenHiggins,项目名称:ELEC424-Lab06-Scheduling-with-FreeRTOS,代码行数:46,代码来源:osram128x64x4.c
示例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 );
}
开发者ID:fegyizoli,项目名称:zolcsirobot,代码行数:29,代码来源:robot_buttons.c
示例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 );
}
}
开发者ID:DSoliz,项目名称:EECS690-Black-Box-Oven-Controller,代码行数:47,代码来源:Task_HeaterOn.c
示例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);
}
开发者ID:Robotonics,项目名称:tinkering,代码行数:47,代码来源:softsccb.c
示例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);
}
开发者ID:akerenyi,项目名称:ess,代码行数:18,代码来源:main.c
示例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);
}
开发者ID:EranSegal,项目名称:ek-lm4f230H5QR,代码行数:50,代码来源:MasterI2C.c
示例16: main
int main(void)
{
volatile uint32_t ui32Load;
volatile uint32_t ui32PWMClock;
volatile uint8_t ui8Adjust;
ui8Adjust = 254;
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
SysCtlPWMClockSet(SYSCTL_PWMDIV_64);
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_1);
GPIOPinConfigure(GPIO_PF1_M1PWM5);
HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01;
HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0;
GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_4|GPIO_PIN_0, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4|GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
ui32PWMClock = SysCtlClockGet() / 64;
ui32Load = (ui32PWMClock / PWM_FREQUENCY) - 1;
PWMGenConfigure(PWM1_BASE, PWM_GEN_2, PWM_GEN_MODE_DOWN);
PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, ui32Load);
PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5, ui8Adjust * ui32Load / 1000);
PWMOutputState(PWM1_BASE, PWM_OUT_5_BIT, true);
PWMGenEnable(PWM1_BASE, PWM_GEN_2);
while(1)
{
if(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4)==0x00)
{
ui8Adjust--;
if (ui8Adjust < 10)
{
ui8Adjust = 10;
}
PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5, ui8Adjust * ui32Load / 1000);
}
if(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0)==0x00)
{
ui8Adjust++;
if (ui8Adjust > 254)
{
ui8Adjust = 254;
}
PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5, ui8Adjust * ui32Load / 1000);
}
SysCtlDelay(100000);
}
}
开发者ID:CS308-2016,项目名称:SafeOvertake,代码行数:58,代码来源:lab3_1.c
示例17: rt_hw_luminaryif_init
int rt_hw_luminaryif_init(void)
{
rt_err_t result;
unsigned long ulUser0, ulUser1;
/* Enable and Reset the Ethernet Controller. */
SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);
SysCtlPeripheralReset(SYSCTL_PERIPH_ETH);
/*
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);
FlashUserSet(0x12345678, 0x12345678);
/* Configure the hardware MAC address */
FlashUserGet(&ulUser0, &ulUser1);
if((ulUser0 == 0xffffffff) || (ulUser1 == 0xffffffff))
{
rt_kprintf("Fatal error in geting MAC address\n");
}
/* init rt-thread device interface */
luminaryif_dev_entry.parent.parent.init = luminaryif_init;
luminaryif_dev_entry.parent.parent.open = luminaryif_open;
luminaryif_dev_entry.parent.parent.close = luminaryif_close;
luminaryif_dev_entry.parent.parent.read = luminaryif_read;
luminaryif_dev_entry.parent.parent.write = luminaryif_write;
luminaryif_dev_entry.parent.parent.control = luminaryif_control;
luminaryif_dev_entry.parent.eth_rx = luminaryif_rx;
luminaryif_dev_entry.parent.eth_tx = luminaryif_tx;
/*
Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
address needed to program the hardware registers, then program the MAC
address into the Ethernet Controller registers.
*/
luminaryif_dev_entry.dev_addr[0] = ((ulUser0 >> 0) & 0xff);
luminaryif_dev_entry.dev_addr[1] = ((ulUser0 >> 8) & 0xff);
luminaryif_dev_entry.dev_addr[2] = ((ulUser0 >> 16) & 0xff);
luminaryif_dev_entry.dev_addr[3] = ((ulUser1 >> 0) & 0xff);
luminaryif_dev_entry.dev_addr[4] = ((ulUser1 >> 8) & 0xff);
luminaryif_dev_entry.dev_addr[5] = ((ulUser1 >> 16) & 0xff);
/* Program the hardware with it's MAC address (for filtering). */
EthernetMACAddrSet(ETH_BASE, luminaryif_dev_entry.dev_addr);
rt_sem_init(&tx_sem, "emac", 1, RT_IPC_FLAG_FIFO);
result = eth_device_init(&(luminaryif_dev->parent), "E0");
return result;
}
开发者ID:bright-pan,项目名称:smart-lock,代码行数:58,代码来源:luminaryif.c
示例18: 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 );
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
/* Enable Port F for Ethernet LEDs
LED0 Bit 3 Output
LED1 Bit 2 Output */
// Enable the peripherals used by this example.
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); //UART1
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); //UART1 pins
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //Select button
/* Enable peripherals */
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIODirModeSet( GPIO_PORTF_BASE, (LED | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3), GPIO_DIR_MODE_HW );
GPIOPadConfigSet( GPIO_PORTF_BASE, (LED | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 ), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD );
// Enable the GPIO pin to read the select button.
GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
// Set GPIO D2 and D3 as UART pins.
GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_2 | GPIO_PIN_3);
//GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
// Configure the UART for 57,600, 8-N-1 operation.
UARTConfigSetExpClk(UART1_BASE, 8000000, 57600,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
//Enable the UART interrupt.
//UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);
UARTEnable(UART1_BASE);
/* Configure push buttons as inputs */
GPIOPadConfigSet(GPIO_PORTE_BASE, BUTTON, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
GPIODirModeSet (GPIO_PORTE_BASE, BUTTON, GPIO_DIR_MODE_IN);
}
开发者ID:blickly,项目名称:ptii,代码行数:45,代码来源:PNDirector.c
示例19: init
void init(){
// Init OLED
RIT128x96x4Init(1000000);
// Set the clock to 50 MHz
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
// Select
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_1);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
// Navigation Switches
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
// CAN Connection
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);
GPIOPinTypeCAN(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1);
CANInit(CAN0_BASE);
CANBitRateSet(CAN0_BASE, 8000000, 250000);
CANIntEnable(CAN0_BASE, CAN_INT_MASTER);
IntEnable(INT_CAN0);
CANEnable(CAN0_BASE);
// CAN Objects
transmit.ulMsgID= 0x200;
transmit.ulMsgIDMask= 0;
transmit.ulMsgLen= 2*sizeof(unsigned long);
// IR Receiver
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
GPIOPinTypeTimer(GPIO_PORTD_BASE, GPIO_PIN_4);
// Timer
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerConfigure(TIMER0_BASE, TIMER_CFG_A_CAP_TIME);
TimerControlEvent(TIMER0_BASE, TIMER_A, TIMER_EVENT_NEG_EDGE);
TimerLoadSet(TIMER0_BASE, TIMER_A, TIME_WIDTH);
TimerIntEnable(TIMER0_BASE, TIMER_CAPA_EVENT | TIMER_TIMA_TIMEOUT);
TimerEnable(TIMER0_BASE, TIMER_A);
IntEnable(INT_TIMER0A);
}
开发者ID:rchristy0,项目名称:EEC170,代码行数:45,代码来源:lab3main8962.c
示例20: initializeKeyPadTask
/* Initialize the StatusData task values */
void initializeKeyPadTask() {
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD_WPU);
GPIODirModeSet(GPIO_PORTE_BASE, GPIO_PIN_0, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD);
GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_4, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_5, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD);
GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_5, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD);
GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_7, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD);
GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_7, GPIO_DIR_MODE_IN);
//for ack switch
/* GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_3, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD_WPU);
GPIODirModeSet(GPIO_PORTE_BASE, GPIO_PIN_3, GPIO_DIR_MODE_IN);*/
// Load data
data.mode = &(global.mode);
data.measurementSelection = &(global.measurementSelection);
data.scroll = &(global.scroll);
data.alarmAcknowledge = &(global.alarmAcknowledge);
data.select = &(global.select);
// Load TCB
keyPadTask.runTaskFunction = &keyPadRunFunction;
keyPadTask.taskDataPtr = &data;
}
开发者ID:ellingjp,项目名称:ee472,代码行数:46,代码来源:keyPad.c
注:本文中的GPIOPadConfigSet函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论