Hi,
You may use the CirceOS as an API, but it is usefull for the hardware initialization.
You can also launch automatically an application on startup. We have forseen to add a "autorun" option for future CircleOs versions.
You can find hereafter the code to launch the last application, you can add at the end of initialization phase of main.c, before the "AUDIO_Welcome_Msg" :
s32 CurrentApplicationIndex = -1;
long unsigned addr;
tMenuItem* ((*ApplicationTable) []);
// Retrieve the last appli index
CurrentApplicationIndex = UTIL_ReadBackupRegister(BKP_SYS1);
// Search the adress of the selected application
unsigned long *lptr = (unsigned long *) CIRCLEOS_FAT_ADDRESS;
ApplicationTable = (tMenuItem * ((*) [])) (*lptr);
// First, we search for extra applications;
if( (*ApplicationTable) [ -CurrentApplicationIndex ] != APP_VOID )
{
addr = (long unsigned) (*ApplicationTable) [ -CurrentApplicationIndex ] ;
addr &= 0x00FFFFFF;
addr |= 0x08000000;
CurrentCommand = (tMenuItem*) addr;
// Disable menu and screen rotation
fDisplayTime = 0;
CurrentMenu = 0;
BUTTON_SetMode( BUTTON_ONOFF );
POINTER_SetMode( POINTER_OFF );
LCD_SetRotateScreen( 0 );
DRAW_Clear();
// Disable scribble touchscreen mode
TOUCHSCR_SetMode( TS_NORMAL );
// Restore the menu divider
MENU_RestoreAppliDivider();
// Launch the selected application
return CurrentCommand->Fct_Init()
}
Concerning the wakeup, the STM32 possesses several modes : sleep (CPU clock off), stop (all clocks stopped), and standby (regulator powered-off).
Any interrupt can go out from sleep mode, any EXTI line can go out from Stop mode, WKUP pin rising edge (= pin 14 extension connector), RTC alarm, or external reset in NRST pin, or IWDG reset can go out from standby.
For wakeup the STM32 with the WKUP pin, you must set the EWUP bit (Enable WKUP pin) in the Power control/status register (PWR_CSR).
You can take a look to the "Power control" paragraph of the STM32 documentation (reference manual RM0008).
Yves