static void LP_ChangeClock(LP_ClockMode mode) { LP_clock = mode; if (LP_clock==LP_SPEED_FAST) { (void)Cpu_SetClockConfiguration(CPU_CLOCK_CONFIG_0); } else if (LP_clock==LP_SPEED_MEDIUM) { (void)Cpu_SetClockConfiguration(CPU_CLOCK_CONFIG_1); } }
void set_event_interrupt(void) { awake_value = 0; if(SetVLP == TRUE){ PE_low_level_init(); Cpu_SetClockConfiguration(1); need_display = true; SetVLP = FALSE; } EInt1_Disable(); set_event(&event,EVENT_MSG_TO_FETCH); }
/* ** =================================================================== ** Method : _bsp_set_clock_configuration ** ** Description : ** Placeholder for clock configuration setting ** Parameters : clock configuration ** Returns : ** --- zero ** =================================================================== */ _mqx_int _bsp_set_clock_configuration(BSP_CLOCK_CONFIGURATION clock_configuration) { uint16_t cpu_error = ERR_OK; uint32_t result; cpu_error = Cpu_SetClockConfiguration((uint8_t)clock_configuration); if (cpu_error != ERR_OK) { return cpu_error; } /* Change frequency for system timer */ result = hwtimer_set_freq(&systimer, BSP_SYSTIMER_SRC_CLK, BSP_ALARM_FREQUENCY); if (MQX_OK != result) { return ERR_FAILED; } return ERR_OK; }
void set_timer_interrupt() { if(in_transaction == false) { awake_value++; if(awake_value >= SLEEP_TIME && SetVLP == FALSE){ //On eteint tout OLED_RESET_PutVal(NULL,0); OLED_SUPPLY_PutVal(NULL,0); spi_next_free(); //puis on passe en VLP SetVLP = TRUE; Cpu_SetClockConfiguration(0); Cpu_VLPModeEnable(); } if(awake_value >= SLEEP_TIME && SetVLP == TRUE){ //awake_value = 0; } } }
uint16_t _bsp_set_clock_configuration ( /* [IN] runtime clock configuration */ const BSP_CLOCK_CONFIGURATION clock_configuration ) { uint32_t system_clock; uint16_t cpu_error = ERR_OK; cpu_error = Cpu_SetClockConfiguration((uint8_t)clock_configuration); if (cpu_error != ERR_OK) { return cpu_error; } /* Get system clock for active clock configuration */ system_clock = _cm_get_clock(clock_configuration, CM_CLOCK_SOURCE_CORE); systick_config(system_clock, BSP_ALARM_FREQUENCY); return ERR_OK; }
int main(void) { byte ret = MAIN_SUCCESS; event = EVENT_NOTHING_TO_DO; PE_low_level_init(); Cpu_SetClockConfiguration(1); back_to_first_screen(); do{ if(event!=EVENT_NOTHING_TO_DO) ret = parse_event(&event); else{ __asm("WFI\n\t"); //Waitms(100); } //Waitms(100); if(ret!=MAIN_SUCCESS) { ret = reset_ST(); } }while(TRUE); for(;;){} return 0; /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ }