void SysTick_Handler(void) { msTicks++; if (msDelay != 0) msDelay--; if (Stopwatch_active) Stopwatch_ms++; if (msLedRunOff != 0) { if (--msLedRunOff == 0) { BSP_LedSet(0); msLedRunOn = msLedOn; } } if (msLedRunOn != 0) { if (--msLedRunOn == 0) { BSP_LedClear(0); msLedRunOff = msLedOff; } } }
static void prvQueueReceiveTask( void *pvParameters ) { uint32_t ulReceivedValue; const uint32_t ulExpectedValue = 100UL; const TickType_t xShortDelay = pdMS_TO_TICKS( 10 ); /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; for( ;; ) { /* Wait until something arrives in the queue - this task will block indefinitely provided INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* To get here something must have been received from the queue, but is it the expected value? If it is, toggle the LED. */ if( ulReceivedValue == ulExpectedValue ) { /* Turn the LED on for a brief time only so it doens't distort the energy reading. */ BSP_LedSet( mainTASK_LED ); vTaskDelay( xShortDelay ); BSP_LedClear( mainTASK_LED ); ulReceivedValue = 0U; } } }
/***************************************************************************//** * @brief * RxTimer, Timer0 IRQHandler. ******************************************************************************/ void TIMER0_IRQHandler(void) { uint32_t irqFlags; irqFlags = TIMER_IntGet(HIJACK_RX_TIMER); TIMER_IntClear(HIJACK_RX_TIMER, irqFlags); if (TIMER_IF_CC1 & irqFlags) { cur_stamp = TIMER_CaptureGet(HIJACK_RX_TIMER, 1); TIMER_CounterSet(HIJACK_RX_TIMER, 0); edge_occur = true; /* Check what transition it was. */ if (GPIO_PinInGet(HIJACK_RX_GPIO_PORT, HIJACK_RX_GPIO_PIN)) { cur_edge = rising; BSP_LedSet( 0 ); } else { cur_edge = falling; BSP_LedClear( 0 ); } } }
/**************************************************************************//** * @brief RTC Handler * Interrupt Service Routine for Real Time Counter *****************************************************************************/ void RTC_IRQHandler(void) { /* Clear interrupt source */ RTC_IntClear(RTC_IFC_COMP0); /* Toggle the LED */ if (enabled) { BSP_LedClear(0); } else { BSP_LedSet(0); /* Change state */ switch (STATE) { case EM0: STATE = EM1; break; case EM1: STATE = EM2; break; case EM2: STATE = EM0; break; } } enabled = !enabled; }
void LOS_EvbLedInit(void) { #ifdef EFM32PG1B200F256GM48 /* Initialize LED driver */ BSP_LedsInit(); BSP_LedSet(0); BSP_LedClear(1); #endif return ; }
void SetLedPeriod(uint16_t time_off, uint16_t time_on) { __disable_irq(); msLedRunOff = 0; msLedRunOn = 0; __enable_irq(); BSP_LedClear(0); msLedOff = time_off; msLedOn = time_on; msLedRunOff = time_off; }
/************************************************************************************************* * function£ºcontrol led on off * * param (1) index Led's index * * (2) cmd Led on or off * * return : None * * discription: * **************************************************************************************************/ void LOS_EvbLedControl(int index, int cmd) { #ifdef EFM32PG1B200F256GM48 switch (index) { case LOS_LED1: { if (cmd == LED_ON) { BSP_LedSet(0); /*led1 on */ } else { BSP_LedClear(0); /*led1 off */ } break; } case LOS_LED2: { if (cmd == LED_ON) { BSP_LedSet(1); /*led2 on */ } else { BSP_LedClear(1); /*led2 off */ } break; } default: { break; } } #endif return ; }
/*! * Radio Initialization. * * @author Sz. Papp * * @note * */ void vRadio_Init(void) { /* Power Up the radio chip */ vRadio_PowerUp(); /* Load radio configuration */ while (SI446X_SUCCESS != si446x_configuration_init(pRadioConfiguration->Radio_ConfigurationArray)) { /* Error hook */ BSP_LedSet(0); Delay(2); BSP_LedClear(0); /* Power Up the radio chip */ vRadio_PowerUp(); } // Read ITs, clear pending ones si446x_get_int_status(0u, 0u, 0u); }
static void prvSetupHardware( void ) { EMU_DCDCInit_TypeDef xDCDInit = EMU_DCDCINIT_STK_DEFAULT; CMU_HFXOInit_TypeDef xHFXOInit = CMU_HFXOINIT_STK_DEFAULT; /* Chip errata */ CHIP_Init(); /* Init DCDC regulator and HFXO with kit specific parameters */ EMU_DCDCInit( &xDCDInit ); CMU_HFXOInit( &xHFXOInit ); /* Switch HFCLK to HFXO and disable HFRCO */ CMU_ClockSelectSet( cmuClock_HF, cmuSelect_HFXO ); CMU_OscillatorEnable( cmuOsc_HFRCO, false, false ); /* Initialize LED driver. */ BSP_LedsInit(); BSP_LedSet( 0 ); BSP_LedClear( 1 ); }
/**************************************************************************//** * @brief Main function *****************************************************************************/ int main(void) { /* Chip errata */ CHIP_Init(); /* If first word of user data page is non-zero, enable eA Profiler trace */ BSP_TraceProfilerSetup(); /* Initial BSP led driver . **/ BSP_LedsInit(); BSP_LedSet(0); BSP_LedClear(0); /* timer1 intial to generate wave. */ enc_init(); /* Initialize LCD controller without boost */ SegmentLCD_Init(false); /* Disable all segments */ SegmentLCD_AllOff(); /* Copy contents of the userpage (flash) into the userData struct */ //memcpy((void *) &userData, (void *) USERPAGE, sizeof(UserData_TypeDef)); /* Special case for uninitialized data */ if (userData.number > 10000) userData.number = 0; if (userData.numWrites == 0xFFFFFFFF) userData.numWrites = 0; /* Display the number */ SegmentLCD_Number(userData.number); /* Setup GPIO interrupts. PB0 to increase number, PB1 to save to flash */ gpioSetup(); /* No save has occured yet */ recentlySaved = false; /* Main loop - just scroll informative text describing the current state of * the system */ while (1) { EM2Sleep(125); #if 0 switch (currentError) { case mscReturnInvalidAddr: ScrollText(" ERROR: INVALID ADDRESS "); break; case mscReturnLocked: ScrollText(" ERROR: USER PAGE IS LOCKED "); break; case mscReturnTimeOut: ScrollText(" ERROR: TIMEOUT OCCURED "); break; case mscReturnUnaligned: ScrollText(" ERROR: UNALIGNED ACCESS "); default: if (recentlySaved) { recentlySaved = false; SegmentLCD_Number(userData.numWrites); ScrollText(" SAVE NUMBER "); } else { SegmentLCD_Number(userData.number); ScrollText(" PRESS PB0 TO INCREASE NUMBER. PB1 TO SAVE TO INTERNAL FLASH "); } break; } #endif } }
void halClearLed(HalBoardLed led) { BSP_LedClear(led); }