本文整理汇总了C++中SysCtlPeripheralEnable函数的典型用法代码示例。如果您正苦于以下问题:C++ SysCtlPeripheralEnable函数的具体用法?C++ SysCtlPeripheralEnable怎么用?C++ SysCtlPeripheralEnable使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SysCtlPeripheralEnable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SysCtlPeripheralEnable
//Initialize as a master
void TwoWire::begin(void)
{
if(i2cModule == NOT_ACTIVE) {
i2cModule = BOOST_PACK_WIRE;
}
SysCtlPeripheralEnable(g_uli2cPeriph[i2cModule]);
//Configure GPIO pins for I2C operation
GPIOPinConfigure(g_uli2cConfig[i2cModule][0]);
GPIOPinConfigure(g_uli2cConfig[i2cModule][1]);
GPIOPinTypeI2C(g_uli2cBase[i2cModule], g_uli2cSDAPins[i2cModule]);
GPIOPinTypeI2CSCL(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]);
I2CMasterInitExpClk(MASTER_BASE, F_CPU, false);//max bus speed=400kHz for gyroscope
//force a stop condition
if(!GPIOPinRead(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]))
forceStop();
//Handle any startup issues by pulsing SCL
if(I2CMasterBusBusy(MASTER_BASE) || I2CMasterErr(MASTER_BASE)
|| !GPIOPinRead(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule])){
uint8_t doI = 0;
GPIOPinTypeGPIOOutput(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]);
unsigned long mask = 0;
do{
for(unsigned long i = 0; i < 10 ; i++) {
SysCtlDelay(F_CPU/100000/3);//100Hz=desired frequency, delay iteration=3 cycles
mask = (i%2) ? g_uli2cSCLPins[i2cModule] : 0;
GPIOPinWrite(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule], mask);
}
doI++;
}while(I2CMasterBusBusy(MASTER_BASE) && doI < 100);
GPIOPinTypeI2CSCL(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]);
if(!GPIOPinRead(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]))
forceStop();
}
}
示例2: LEDInit
/*
* The initialization and execution functions for this task
*/
void LEDInit() {
// Enable GPIO Port G and configure it to drive the Status LED
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
// The Status LED is attached to G<2> (Port G pin 2) it must be set as output
GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2);
/*
* Start G<2> signal HIGH so the LED is lit at the start
* The GPIOPinWrite function requires the Port and pins as the first arguments
* the third argument has to be a bit-packed byte that represents the
* desired state of the given pins.
* The least-significant-bit of this byte (bit 0) represents pin 0 on the specified port,
* the next LSB (bit 1) represents pin 1 and so on...
* To write pin G<2> HIGH we have to pass the value 0x04 (or the constant representing the pin),
* For example, if we wanted pin G<1> HIGH =>
* GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_1, GPIO_PIN_1)
* and if we wanted pin G<7> LOW =>
* GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_7, 0x00)
* The function can be used to write multiple pins as well,
* if we wanted pins G<1> and G<2> HIGH =>
* GPIOPinWrite(GPIO_PORTG_BASE, (GPIO_PIN_1 | GPIO_PIN_2), (GPIO_PIN_1 | GPIO_PIN_2))
* or G<1> HIGH and G<2> LOW =>
* GPIOPinWrite(GPIO_PORTG_BASE, (GPIO_PIN_1 | GPIO_PIN_2), GPIO_PIN_1)
* the pin arguments are combined with a bit-wise OR operation
* and the desired signal value given is a bit-wise OR'ing of the individual pin values.
*/
// This sets G<2> to LOW
GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, 0x00);
/*
* NOTICE the way numerical values are written here,
* for instance 0x00 = 0, the prefix 0x tells the compiler that the
* number is written in hexadecimal notation.
* So, 0x02 = 2, 0x0F = 15, and 0x10 = 16
*
* Likewise binary values can be given with the prefix 0b
* So, 0b0 = 0, 0b10 = 2, and 0b111 = 7
*
* These notations can make the code easier to understand in some cases
*/
printf("%ul", sysTickCount);
// Initialize the first execution time for the task by adding to the current SysTickCount
timeToExec = sysTickCount + delay;
}
示例3: LEDTask
// The LED task definition
void LEDTask(void *pvParameters) {
// FreeRTOS uses function definitions to define tasks
// The first part of each task is the initializations steps for that task
// Enable Port G which is connected to the LED
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
// The Status LED is attached to G<2> (Port G pin 2) it must be set as output
GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2);
/*
* Start G<2> signal HIGH so the LED is lit at the start
* The GPIOPinWrite function requires the Port and pins as the first arguments
* the third argument has to be a bit-packed byte that represents the
* desired state of the given pins.
* The least-significant-bit of this byte (bit 0) represents pin 0 on the specified port,
* the next LSB (bit 1) represents pin 1 and so on...
* To write pin G<2> HIGH we have to pass the value 0x04,
* if we wanted pin G<1> HIGH => GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_1, 0x02)
* and if we wanted pin G<7> HIGH => GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_7, 0x80)
* The function can be used to write multiple pins as well,
* if we wanted pins G<1> and G<2> HIGH =>
* write GPIOPinWrite(GPIO_PORTG_BASE, (GPIO_PIN_1 | GPIO_PIN_2), 0x06)
* the pin arguments are combined with a bit-wise OR operation
* and the desired signal value given is a bit-wise OR'ing of the individual pin values.
*/
// This sets G<2> to LOW
GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, 0x00);
// FreeRTOS task definitions also require an infinite loop to house execution steps
while(true) {
/*
* Toggle the LED.
* First pin G<2> is read and that value is XOR'd with the constant value GPIO_PIN_2
* so that the bit representing G<2> is toggled
* to either 0x00 or 0x04 depending on its current state
* then the new value is written back to G<2>
*/
GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_2) ^ GPIO_PIN_2);
// Advance next execution time for the LED task
vTaskDelay(ONE_MS * 250.0);
}
}
示例4: main
int main() {
//Enable Peripherals
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
//Start specific Pin Ports
GPIOPinTypeGPIOOutput(port_A, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4);
GPIOPinTypeGPIOOutput(port_C, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
GPIOPinTypeGPIOOutput(port_D, GPIO_PIN_6);
GPIOPinTypeGPIOOutput(port_E, GPIO_PIN_0);
GPIOPinTypeGPIOOutput(port_F, GPIO_PIN_4);
GPIOPinTypeGPIOInput(port_F, GPIO_PIN_2 | GPIO_PIN_3);
//Timer Configuration
TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
TimerLoadSet(TIMER0_BASE, TIMER_A, frequency);
TimerControlEvent(TIMER0_BASE, TIMER_A, TIMER_EVENT_POS_EDGE);
TimerEnable(TIMER0_BASE, TIMER_A);
//Enable pin for interrupt
GPIOIntEnable(GPIO_PORTF_BASE, (GPIO_INT_PIN_2 | GPIO_INT_PIN_3));
//Set ISR
GPIOIntRegister(GPIO_PORTF_BASE, the_taco_meter);
//Set interrupt type
GPIOIntTypeSet(GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3) , GPIO_BOTH_EDGES);
//Initialize the display
initializeDisplay();
//RS High
GPIOPinWrite(port_C, GPIO_PIN_5, pin_5);
write_string("Speed = #### RPM");
while(1) {
taco_display();
}
}
示例5: initAsTimer1
void CommutationControllerClass::configurePeripherals(uint32_t channel)
{
channel ? initAsTimer1() : initAsTimer0();
// Enable the timer peripheral
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER);
// Ensure the timer is disabled
TimerDisable(TIMER_BASE, TIMER_A);
// Configure the timer as a periodic up counter
TimerConfigure(TIMER_BASE, TIMER_CFG_PERIODIC_UP);
// Ensure the timer interrupt is disabled
TimerIntDisable(TIMER_BASE, TIMER_TIMA_TIMEOUT);
// Clear the interrupt now it is disabled
TimerIntClear(TIMER_BASE, TIMER_TIMA_TIMEOUT);
// Register one of the two static interrupt handlers to the peripheral
TimerIntRegister(TIMER_BASE, TIMER_A, channel ? ISR1Static : ISR0Static);
// Set the interrupt priority
IntPrioritySet(INT_TIMERnA_TM4C123, 0); // @TODO - What should this actually be?
}
示例6: hwInitWatchdog
void hwInitWatchdog(long intervalMilliseconds) {
if (SysCtlPeripheralPresent(SYSCTL_PERIPH_WDOG)){
SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG);
WatchdogUnlock(WATCHDOG_BASE); // unlock WD register
WatchdogResetEnable(WATCHDOG_BASE); // enable reset capability on second timeout
/* watchdog resets the system on the second timeout!
* -> so we have to divide the time by 2
* -> on the first time-out only an interrupt is generated
*/
glWDLoad = (SysCtlClockGet()/1000) * (intervalMilliseconds/2);
WatchdogReloadSet(WATCHDOG_BASE, glWDLoad);
WatchdogStallEnable(WATCHDOG_BASE); // stops the watchdog during debug break
WatchdogIntUnregister(WATCHDOG_BASE); // mask interrupt -> interrupts are not seen and handled by processor
WatchdogEnable(WATCHDOG_BASE);
WatchdogLock(WATCHDOG_BASE); // lock WD register
}
}
示例7: vSerialInit
static void vSerialInit( void )
{
/* Enable the UART. GPIOA has already been initialised. */
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
/* Set GPIO A0 and A1 as peripheral function. They are used to output the
UART signals. */
GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW );
/* Configure the UART for 8-N-1 operation. */
UARTConfigSet( UART0_BASE, mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE );
/* We dont want to use the fifo. This is for test purposes to generate
as many interrupts as possible. */
HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET;
/* Enable both Rx and Tx interrupts. */
HWREG( UART0_BASE + UART_O_IM ) |= ( UART_INT_TX | UART_INT_RX );
IntEnable( INT_UART0 );
}
示例8: 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 );
vParTestInitialise();
}
示例9: EKS_LM4F232_initSDSPI
/*
* ======== EKS_LM4F232_initSDSPI ========
*/
Void EKS_LM4F232_initSDSPI(Void)
{
/* Enable the peripherals used by the SD Card */
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
/* Configure pad settings */
GPIOPadConfigSet(GPIO_PORTH_BASE,
GPIO_PIN_4 | GPIO_PIN_7,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
GPIOPadConfigSet(GPIO_PORTH_BASE,
GPIO_PIN_6,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(GPIO_PORTH_BASE,
GPIO_PIN_5,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
SDSPI_init();
}
示例10: bsp_pwm0_init
void bsp_pwm0_init(void)
{
/*Enable device*/
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
/*Set clock divider*/
PWMClockSet(PWM0_BASE,PWM_SYSCLK_DIV_64);
/*Enable PWM pin*/
GPIOPinConfigure(LCD_PWM_CHANNEL);
GPIOPinTypePWM(LCD_PWM_PORT, LCD_PWM_PIN);
/*Configure PWM generator*/
PWMGenConfigure(PWM0_BASE, PWM_GEN_0,(PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC));
/*Set PWM timer period*/
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0,gSysClock/10000);
/*Set width for PWM0*/
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, 50*PWMGenPeriodGet(PWM0_BASE,PWM_GEN_0)/100);
/*Enable output*/
PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, 0);
/*Enable Generator*/
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
}
示例11: uartStdioConfig
void uartStdioConfig (uint32_t ui32PortNum, uint32_t ui32Baud, uint32_t ui32SrcClock)
{
// Check the arguments.
ASSERT((ui32PortNum == 0) || (ui32PortNum == 1) || (ui32PortNum == 2));
// Check to make sure the UART peripheral is present.
if (!SysCtlPeripheralPresent(SYSCTL_PERIPH_UART0)) {
return;
}
// Enable the UART peripheral for use.
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
// Configure the UART for 115200, n, 8, 1
UARTConfigSetExpClk(UART0_BASE, ui32SrcClock, ui32Baud, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE |
UART_CONFIG_WLEN_8));
// Enable the UART operation.
UARTEnable(UART0_BASE);
}
示例12: initializeTimebase
void initializeTimebase() {
// Enable it
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
// Configure TimerA as periodic
TimerConfigure(TIMER0_BASE, TIMER_CFG_A_PERIODIC);
// Determine minor cycle
TimerLoadSet(TIMER0_BASE, TIMER_A, (SysCtlClockGet() / 1000) * MINOR_CYCLE );
// Enable Interrupt
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
// Enable the intterupt (again?)
IntEnable(INT_TIMER0A);
// Enable the timer
TimerEnable(TIMER0_BASE, TIMER_A);
}
示例13: main
/*****************************************************************************
Main function performs init and manages system.
Called automatically after the system and compiler pre-init sequences.
*****************************************************************************/
int main(void)
{
//To set the clock frequency to be 40MHz.
SysCtlClockSet(SYSCTL_SYSDIV_16|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
//Enable GPIO peripheral
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
//create a while(1) loop to send a “1” and “0” to the selected GPIO pin, with an
//equal delay between the two.
while(1)
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1| GPIO_PIN_2| GPIO_PIN_3, ui8PinData);
SysCtlDelay(2000000);
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,0x00);
SysCtlDelay(2000000);
if(ui8PinData==2) {ui8PinData=8;} else {ui8PinData=ui8PinData/2;}
}
}
示例14: tempSensInit
void tempSensInit() {
SysCtlPeripheralEnable(TEMP_SENS_ADC_PERIPH) ;
SysCtlDelay(3) ;
ADCSequenceConfigure(
TEMP_SENS_ADC_BASE,
TEMP_SENS_SEQ_NUM,
ADC_TRIGGER_PROCESSOR, // triggered by mcu
3 ) ; // 3 - The lowest priority
ADCSequenceStepConfigure(
TEMP_SENS_ADC_BASE,
TEMP_SENS_SEQ_NUM,
TEMP_SENS_STEP_NUM,
ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END) ;
// Temperature sensor | interrupt enable | only one step
ADCSequenceEnable(TEMP_SENS_ADC_BASE, TEMP_SENS_SEQ_NUM) ;
ADCIntClear(TEMP_SENS_ADC_BASE, TEMP_SENS_SEQ_NUM) ;
}
示例15: main
//*****************************************************************************
//
// Main 'C' Language entry point. Toggle an LED using TivaWare.
// See http://www.ti.com/tm4c123g-launchpad/project0 for more information and
// tutorial videos.
//
//*****************************************************************************
int
main(void)
{
//
// Setup the system clock to run at 50 Mhz from PLL with crystal reference
//
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
//
// Enable and configure the GPIO port for the LED operation.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED);
//
// Loop Forever
//
while(1)
{
//
// Turn on the LED
//
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, RED_LED);
//
// Delay for a bit
//
SysCtlDelay(2000000);
//
// Turn on the LED
//
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, BLUE_LED);
//
// Delay for a bit
//
SysCtlDelay(2000000);
}
}