本文整理汇总了C++中GPIO_IF_LedOff函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIO_IF_LedOff函数的具体用法?C++ GPIO_IF_LedOff怎么用?C++ GPIO_IF_LedOff使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPIO_IF_LedOff函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OOBTask
//****************************************************************************
//
//! \brief OOB Application Main Task - Initializes SimpleLink Driver and
//! Handles HTTP Requests
//! \param[in] pvParameters is the data passed to the Task
//!
//! \return None
//
//****************************************************************************
static void OOBTask(void *pvParameters)
{
//Read Device Mode Configuration
ReadDeviceConfiguration();
//Connect to Network
ConnectToNetwork();
//Handle Async Events
while(1)
{
//LED Actions
if(g_ucLEDStatus == LED_ON)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
osi_Sleep(500);
}
if(g_ucLEDStatus == LED_OFF)
{
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
osi_Sleep(500);
}
if(g_ucLEDStatus==LED_BLINK)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
osi_Sleep(500);
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
osi_Sleep(500);
}
}
}
示例2: LEDBlinkyRoutine
//*****************************************************************************
//
//! Configures the pins as GPIOs and peroidically toggles the lines
//!
//! \param None
//!
//! This function
//! 1. Configures 3 lines connected to LEDs as GPIO
//! 2. Sets up the GPIO pins as output
//! 3. Periodically toggles each LED one by one by toggling the GPIO line
//!
//! \return None
//
//*****************************************************************************
void LEDBlinkyRoutine()
{
//
// Toggle the lines initially to turn off the LEDs.
// The values driven are as required by the LEDs on the LP.
//
GPIO_IF_LedOff(MCU_ALL_LED_IND);
while(1)
{
//
// Alternately toggle hi-low each of the GPIOs
// to switch the corresponding LED on/off.
//
MAP_UtilsDelay(8000000);
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOn(MCU_ORANGE_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOff(MCU_ORANGE_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOn(MCU_GREEN_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);
}
}
示例3: main
//*****************************************************************************
//
//! main function demonstrates the use of the timers to generate
//! periodic interrupts.
//!
//! \param None
//!
//! \return none
//
//*****************************************************************************
int
main(void)
{
//
// Initialize board configurations
BoardInit();
//
// Pinmuxing for LEDs
//
PinMuxConfig();
//
// configure the LED RED and GREEN
//
GPIO_IF_LedConfigure(LED1|LED3);
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);
//
// Base address for first timer
//
g_ulBase = TIMERA0_BASE;
//
// Base address for second timer
//
g_ulRefBase = TIMERA1_BASE;
//
// Configuring the timers
//
Timer_IF_Init(PRCM_TIMERA0, g_ulBase, TIMER_CFG_PERIODIC, TIMER_A, 0);
Timer_IF_Init(PRCM_TIMERA1, g_ulRefBase, TIMER_CFG_PERIODIC, TIMER_A, 0);
//
// Setup the interrupts for the timer timeouts.
//
Timer_IF_IntSetup(g_ulBase, TIMER_A, TimerBaseIntHandler);
Timer_IF_IntSetup(g_ulRefBase, TIMER_A, TimerRefIntHandler);
//
// Turn on the timers feeding values in mSec
//
Timer_IF_Start(g_ulBase, TIMER_A, 500);
Timer_IF_Start(g_ulRefBase, TIMER_A, 1000);
//
// Loop forever while the timers run.
//
while(FOREVER)
{
}
}
示例4: MicroPhoneControl
//*****************************************************************************
//
//! MicroPhone Control Routine
//!
//! \param pValue - pointer to a memory structure that is passed
//! to the interrupt handler.
//!
//! \return None
//
//*****************************************************************************
void MicroPhoneControl(void* pValue)
{
int iCount=0;
unsigned long ulPin5Val = 1;
//Check whether GPIO Level is Stable As No Debouncing Circuit in LP
for(iCount=0;iCount<3;iCount++)
{
osi_Sleep(200);
ulPin5Val = MAP_GPIOPinRead(GPIOA1_BASE,GPIO_PIN_5);
if(ulPin5Val)
{
//False Alarm
return;
}
}
if (g_ucMicStartFlag == 0)
{
for(iCount = 0; iCount<3; iCount++)
{
//Blink LED 3 times to Indicate ON
GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);
osi_Sleep(50);
GPIO_IF_LedOn(MCU_GREEN_LED_GPIO);
osi_Sleep(50);
}
g_ucMicStartFlag = 1;
}
else
{
//Blink LED 3 times to Indicate OFF
for(iCount = 0; iCount<3; iCount++)
{
GPIO_IF_LedOn(MCU_GREEN_LED_GPIO);
osi_Sleep(50);
GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);
osi_Sleep(50);
}
g_ucMicStartFlag = 0;
}
//Enable GPIO Interrupt
MAP_GPIOIntClear(GPIOA1_BASE,GPIO_PIN_5);
MAP_IntPendClear(INT_GPIOA1);
MAP_IntEnable(INT_GPIOA1);
MAP_GPIOIntEnable(GPIOA1_BASE,GPIO_PIN_5);
}
示例5: WlanConnect
//****************************************************************************
//
//! \brief Connecting to a WLAN Accesspoint
//!
//! This function connects to the required AP (SSID_NAME) with Security
//! parameters specified in te form of macros at the top of this file
//!
//! \param None
//!
//! \return 0 on success else error code
//!
//! \warning If the WLAN connection fails or we don't aquire an IP
//! address, It will be stuck in this function forever.
//
//****************************************************************************
long WlanConnect()
{
long lRetVal = -1;
SlSecParams_t secParams;
secParams.Key = SECURITY_KEY;
secParams.KeyLen = strlen(SECURITY_KEY);
secParams.Type = SECURITY_TYPE;
lRetVal = sl_WlanConnect(SSID_NAME,strlen(SSID_NAME),0,&secParams,0);
ASSERT_ON_ERROR(lRetVal);
while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
{
// Toggle LEDs to Indicate Connection Progress
GPIO_IF_LedOff(MCU_IP_ALLOC_IND);
MAP_UtilsDelay(800000);
GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
MAP_UtilsDelay(800000);
}
//
// Red LED on to indicate AP connection
//
GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
return SUCCESS;
}
示例6: TimerPeriodicIntHandler
//*****************************************************************************
//
//! Periodic Timer Interrupt Handler
//!
//! \param None
//!
//! \return None
//
//*****************************************************************************
void
TimerPeriodicIntHandler(void)
{
unsigned long ulInts;
//
// Clear all pending interrupts from the timer we are
// currently using.
//
ulInts = MAP_TimerIntStatus(TIMERA0_BASE, true);
MAP_TimerIntClear(TIMERA0_BASE, ulInts);
//
// Increment our interrupt counter.
//
g_usTimerInts++;
if(!(g_usTimerInts & 0x1))
{
//
// Off Led
//
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
}
else
{
//
// On Led
//
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
}
}
示例7: SmartConfigTask
//*****************************************************************************
//
//! \brief Starts Smart Configuration
//!
//! \param none
//!
//! \return void
//! \note
//! \warning
//*****************************************************************************
void SmartConfigTask(void* pValue)
{
long lRetVal = -1;
DispatcherUartSendPacket((char*)pucUARTSmartConfigString,
sizeof(pucUARTSmartConfigString));
//Turn off the Network Status LED
GPIO_IF_LedOff(MCU_IP_ALLOC_IND);
LedTimerConfigNStart();
//Reset the Network Status before Entering Smart Config
Network_IF_UnsetMCUMachineState(STATUS_BIT_CONNECTION);
Network_IF_UnsetMCUMachineState(STATUS_BIT_IP_AQUIRED);
lRetVal = SmartConfigConnect();
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Wait until IP is acquired
//
while (!(IS_CONNECTED(Network_IF_CurrentMCUState())) ||
!(IS_IP_ACQUIRED(Network_IF_CurrentMCUState())));
LedTimerDeinitStop();
// Red LED on
GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
//Enable GPIO Interrupt
Button_IF_EnableInterrupt(SW2);
}
示例8: WatchdogIntHandler
//*****************************************************************************
//
//! The interrupt handler for the watchdog timer
//!
//! \param None
//!
//! \return None
//
//*****************************************************************************
void WatchdogIntHandler(void)
{
//
// If we have been told to stop feeding the watchdog, return immediately
// without clearing the interrupt. This will cause the system to reset
// next time the watchdog interrupt fires.
//
if(!g_bFeedWatchdog)
{
return;
}
//
// After 10 interrupts, switch On LED6 to indicate system reset
// and don't clear watchdog interrupt which causes system reset
//
if(g_ulWatchdogCycles >= 10)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
MAP_UtilsDelay(800000);
return;
}
//
// Clear the watchdog interrupt.
//
MAP_WatchdogIntClear(WDT_BASE);
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
MAP_UtilsDelay(800000);
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
//
// Increment our interrupt counter.
//
g_ulWatchdogCycles++;
}
示例9: WlanConnect
//****************************************************************************
//
//! \brief Connecting to a WLAN Accesspoint
//!
//! This function connects to the required AP (SSID_NAME) with Security
//! parameters specified in te form of macros at the top of this file
//!
//! \param None
//!
//! \return 0 on success else error code
//!
//! \warning If the WLAN connection fails or we don't aquire an IP
//! address, It will be stuck in this function forever.
//
//****************************************************************************
static long WlanConnect()
{
SlSecParams_t secParams = {0};
long lRetVal = 0;
secParams.Key = SECURITY_KEY;
secParams.KeyLen = strlen(SECURITY_KEY);
secParams.Type = SECURITY_TYPE;
lRetVal = sl_WlanConnect(SSID_NAME, strlen(SSID_NAME), 0, &secParams, 0);
ASSERT_ON_ERROR(lRetVal);
// Wait for WLAN Event
while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
{
// Toggle LEDs to Indicate Connection Progress
_SlNonOsMainLoopTask();
GPIO_IF_LedOff(MCU_IP_ALLOC_IND);
MAP_UtilsDelay(800000);
_SlNonOsMainLoopTask();
GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
MAP_UtilsDelay(800000);
}
return SUCCESS;
}
示例10: fm_player
int fm_player(void)
{
char song_url[128] = {0}; // It's very tricky douban encoding track name into sequence number, so the url is pretty formated
int index = 0;
Report("Douban FM is ready\r\n");
while(1)
{
//fm_get_channel();
if(index >= 10)
index = 0;
else
index++;
memset(song_url, 0, sizeof(song_url));
fm_get_song(song_url, "1", index);
if (strlen(song_url))
{
Report("Going to play : %s\r\n", song_url);
GPIO_IF_LedOn(MCU_ORANGE_LED_GPIO);
fm_play_song(song_url);
GPIO_IF_LedOff(MCU_ORANGE_LED_GPIO);
}
else
{
// wait for next try
Report("Cannot fitch a song to play, waiting for next try\r\n");
osi_Sleep(1000);
}
}
}
示例11: process_command
static void process_command(struct mg_connection *nc, unsigned char *data,
size_t len) {
// TODO(lsm): use proper JSON parser
int cmd, val;
if (sscanf((char *) data, "{\"t\":%d,\"v\":%d}", &cmd, &val) != 2) {
LOG(LL_ERROR, ("Invalid request: %.*s", (int) len, data));
return;
}
if (cmd == 1) {
switch (val) {
case '0': {
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
break;
}
case '1': {
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
break;
}
case '2': {
GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
break;
}
default: {
LOG(LL_ERROR, ("Invalid value: %.*s", (int) len, data));
return;
}
}
} else {
LOG(LL_ERROR, ("Unknown command: %.*s", (int) len, data));
return;
}
}
示例12: ToggleLedState
//****************************************************************************
//
//! Toggles the state of GPIOs(LEDs)
//!
//! \param LedNum is the enumeration for the GPIO to be toggled
//!
//! \return none
//
//****************************************************************************
void ToggleLedState(ledEnum LedNum)
{
unsigned char ledstate = 0;
switch(LedNum)
{
case LED1:
ledstate = GPIO_IF_LedStatus(MCU_RED_LED_GPIO);
if(!ledstate)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
}
else
{
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
}
break;
case LED2:
ledstate = GPIO_IF_LedStatus(MCU_ORANGE_LED_GPIO);
if(!ledstate)
{
GPIO_IF_LedOn(MCU_ORANGE_LED_GPIO);
}
else
{
GPIO_IF_LedOff(MCU_ORANGE_LED_GPIO);
}
break;
case LED3:
ledstate = GPIO_IF_LedStatus(MCU_GREEN_LED_GPIO);
if(!ledstate)
{
GPIO_IF_LedOn(MCU_GREEN_LED_GPIO);
}
else
{
GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);
}
break;
default:
break;
}
}
示例13: main
int main(void)
{
long lRetVal = -1;
//
// initialize board configurations
//
BoardInit();
//
// Pinmux GPIO for LEDs
//
PinMuxConfig();
#ifndef NOTERM
//
// Configuring UART
//
InitTerm();
#endif
//
// Configure LEDs
//
GPIO_IF_LedConfigure(LED1|LED2|LED3);
GPIO_IF_LedOff(MCU_ALL_LED_IND);
//
// Simplelinkspawntask
//
lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
lRetVal = osi_TaskCreate(XmppClient, (const signed char*)"XmppClient",\
OSI_STACK_SIZE, NULL, 1, NULL );
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
osi_start();
while(1)
{
}
}
示例14: initBoard
void initBoard() {
#ifndef USE_TIRTOS
#if defined(ccs) || defined(gcc)
MAP_IntVTableBaseSet((unsigned long) &g_pfnVectors[0]);
#endif
#if defined(ewarm)
MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
#endif
MAP_IntMasterEnable();
MAP_IntEnable(FAULT_SYSTICK);
PRCMCC3200MCUInit();
PinMuxConfig();
GPIO_IF_LedConfigure(LED1);
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
InitTerm();
ClearTerm();
UART_PRINT("Blink - Parse for IoT sample application\r\n");
UART_PRINT("----------------------------------------\r\n");
UART_PRINT("\r\n");
UART_PRINT("[Blink] Board init\r\n");
// start the spawn task
short status = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if (status < 0) {
UART_PRINT("[Blink] Spawn task failed\r\n");
ERR_PRINT(status);
LOOP_FOREVER();
}
// initialize the I2C bus
status = I2C_IF_Open(I2C_MASTER_MODE_FST);
if (status < 0) {
UART_PRINT("[Blink] I2C opening error\r\n");
ERR_PRINT(status);
LOOP_FOREVER();
}
UART_PRINT("[Blink] Device : TI SimpleLink CC3200\r\n");
#ifdef USE_TIRTOS
UART_PRINT("[Blink] Operating system : TI-RTOS\r\n");
#endif
#ifdef USE_FREERTOS
UART_PRINT("[Blink] Operating system : FreeRTOS\r\n");
#endif
#ifndef SL_PLATFORM_MULTI_THREADED
UART_PRINT("[Blink] Operating system : None\r\n");
#endif
}
示例15: InfiniteLoopTask
void InfiniteLoopTask(void *pvParameters)
{
// GPIO Configuration
GPIO_IF_LedConfigure(LED1|LED3);
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
TimerConfigNStart();
while(1);
}