/**************************************************************************//** * @brief LCD Blink Test *****************************************************************************/ void BlinkTest(void) { SegmentLCD_EnergyMode(0, 1); SegmentLCD_EnergyMode(1, 1); SegmentLCD_EnergyMode(2, 1); SegmentLCD_EnergyMode(3, 1); SegmentLCD_EnergyMode(4, 1); /* 2 minutes to midnight */ SegmentLCD_Number(2358); SegmentLCD_Symbol(LCD_SYMBOL_COL10, 1); SegmentLCD_Symbol(LCD_SYMBOL_GECKO, 1); SegmentLCD_Symbol(LCD_SYMBOL_EFM32, 1); SegmentLCD_Write(" EFM32 "); LCD_BlinkEnable(true); LCD_SyncBusyDelay(0xFFFFFFFF) ; EM2Sleep(2000); SegmentLCD_EnergyMode(4, 0); EM2Sleep(62); SegmentLCD_EnergyMode(3, 0); EM2Sleep(62); SegmentLCD_EnergyMode(2, 0); EM2Sleep(62); SegmentLCD_EnergyMode(1, 0); EM2Sleep(62); SegmentLCD_EnergyMode(0, 0); LCD_BlinkEnable(false); LCD_SyncBusyDelay(0xFFFFFFFF); }
/**************************************************************************//** * @brief LESENSE_IRQHandler * Interrupt Service Routine for LESENSE Interrupt Line *****************************************************************************/ void LESENSE_IRQHandler(void) { /* Read interrupts flags */ uint32_t intFlags = LESENSE_IntGet(); /* Clear interrupts */ LESENSE_IntClear(LESENSE_IFC_DEC | LESENSE_IFC_DECERR); /* Enable clock for LCD. */ CMU_ClockEnable(cmuClock_LCD, true); /* Wait until SYNCBUSY_CTRL flag is cleared. */ LCD_SyncBusyDelay(LCD_SYNCBUSY_CTRL); /* Enable LCD. */ LCD_Enable(true); /* If there is a decoder error stop trap execution in this loop */ if (intFlags & LESENSE_IF_DECERR) { /* DECODER ERROR */ SegmentLCD_Write(LCSENSE_ERROR_STRING); while (1) ; } /* Write PCNT counter number the LCD */ SegmentLCD_Number(PCNT_CounterGet(PCNT0)); /* Disable RTC first to reset counter */ RTC_Enable(false); /* Set compare value */ RTC_CompareSet(0, RTC_COMP_VALUE); /* Enable RTC */ RTC_Enable(true); }
/**************************************************************************//** * @brief RTC_IRQHandler * Interrupt Service Routine for RTC Interrupt Line *****************************************************************************/ void RTC_IRQHandler(void) { /* Clear interrupt flag */ RTC_IntClear(RTC_IFS_COMP0); /* Disable RTC */ RTC_Enable(false); /* Turn off all segments */ SegmentLCD_AllOff(); /* Disable LCD to avoid excessive current consumption */ LCD_Enable(false); /* Wait until SYNCBUSY_CTRL flag is cleared. */ LCD_SyncBusyDelay(LCD_SYNCBUSY_CTRL); /* Disable clock for LCD. */ CMU_ClockEnable(cmuClock_LCD, false); }
/**************************************************************************//** * @brief PCNT0_IRQHandler * Interrupt Service Routine for PCNT0 Interrupt Line *****************************************************************************/ void PCNT0_IRQHandler(void) { PCNT_IntGet(PCNT0); PCNT_IntClear(PCNT0, PCNT_IEN_DIRCNG); /* Enable clock for LCD. */ CMU_ClockEnable(cmuClock_LCD, true); /* Wait until SYNCBUSY_CTRL flag is cleared. */ LCD_SyncBusyDelay(LCD_SYNCBUSY_CTRL); /* Enable LCD. */ LCD_Enable(true); /* Write PCNT counter number the LCD */ SegmentLCD_Write(PCNT_DIRCHANGE_STRING); /* Disable RTC first to reset counter */ RTC_Enable(false); /* Set compare value */ RTC_CompareSet(0, RTC_COMP_VALUE); /* Enable RTC */ RTC_Enable(true); }