Datasheet
Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
Energy Saving Usage Example
Here is a simple power saving example, using Serial commands to switch from normal operation to
hibernate or sleep, and then use the RTCC or External interrupt 2 to wake up from Sleep mode.
NOTE: remember to enable RTCC Library from IDE wizard before to use this example
#include "taskFlyport.h"
char rtccString[50];
struct tm mytime;
struct tm myalarm;
// Function called by event on External Interrupt 2
void external_interrupt_function()
{
IOPut(p19, toggle);
}
void FlyportTask()
{
vTaskDelay(200);
UARTWrite(1,"\r\nPower saving mode test...\r\n");
// Set external interrupt
IOInit(p5,indown);
IOInit(p5, EXT_INT2);
INTInit(2, external_interrupt_function, 1);
INTEnable(2);
// Set RTCC
mytime.tm_hour = 20;
mytime.tm_min = 1;
mytime.tm_sec = 2;
mytime.tm_mday = 6;
mytime.tm_mon = 3;
mytime.tm_year = 113;
mytime.tm_wday = SATURDAY;
// Set up and start RTCC
RTCCSet(&mytime);
// Create alarm configuration
myalarm = mytime;
myalarm.tm_sec = mytime.tm_sec + 20;
// Setup Alarm Configuration
RTCCAlarmConf(&myalarm, REPEAT_INFINITE, EVERY_TEN_SEC, NO_ALRM_EVENT);
// Start Alarm
RTCCAlarmSet(TRUE);
while(1)
{
// Check RTCC Alarm flag
if(RTCCAlarmStat())
{
72










