Microchip® Advanced Software Framework

widget_scr_lpm.c File Reference

Low power mode widget for SAM toolkit demo application.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include "demo.h"
#include <asf.h>
#include "string.h"
#include "bitmaps.h"

Data Structures

struct  widget_context_lpm
 Widget application context. More...
 

Enumerations

enum  command_id {
  DUMMY_ID,
  ICON_BUTTON_1_ID,
  ICON_BUTTON_2_ID,
  ICON_BUTTON_3_ID,
  BUTTON_PREV_ID,
  BUTTON_NEXT_ID,
  BUTTON_SELECT_ID,
  DUMMY_ID,
  SLIDER_ID,
  CHECK_BOX_ID,
  RADIO_BUTTON_1_ID,
  RADIO_BUTTON_2_ID,
  BUTTON_ID,
  DUMMY_ID,
  SLIDER_ID,
  BUTTON_ID,
  ICON_DUMMY_ID = 0,
  ICON_AUDIO_RECORD_ID,
  ICON_AUDIO_MIC_ID,
  ICON_AUDIO_PLAY_PAUSE_ID,
  ICON_AUDIO_STOP_ID,
  ICON_AUDIO_VOLUME_ID,
  ICON_AUDIO_RET_ID,
  ICON_AUDIO_MAX_ID,
  ICON_DUMMY_ID = 0,
  ICON_LPM_WAIT_ID,
  ICON_LPM_SLEEP_ID,
  ICON_LPM_BACKUP_ID,
  ICON_LPM_RET_ID,
  ICON_LPM_MAX
}
 Command event IDs for low power mode widget. More...
 

Functions

static void app_widget_launch_lpm (void)
 Setup low power mode widget. More...
 
void app_widget_lpm_on (uint8_t on)
 Enable/disable low power mode widget. More...
 
static bool widget_lpm_command_handler (struct wtk_basic_frame *frame, win_command_t command_data)
 Frame handler for the low power mode widget. More...
 

Variables

static char demo_func_name [] = "Low Power Mode"
 Low power mode function name string. More...
 
static char lpm_backup [] = "Backup"
 Backup mode string. More...
 
static char lpm_sleep [] = "Sleep"
 Sleep mode string. More...
 
static char lpm_wait [] = "Wait"
 Wait mode string. More...
 
static struct widget_context_lpmwidget_ctx_lpm
 Statically allocated context pointer. More...
 
static struct gfx_bitmap win_lpm_backup_icon
 Backup mode bitmap. More...
 
static struct gfx_bitmap win_lpm_ret_icon
 Return bitmap. More...
 
static struct gfx_bitmap win_lpm_sleep_icon
 Sleep mode bitmap. More...
 
static struct gfx_bitmap win_lpm_wait_icon
 Wait mode bitmap. More...
 
static struct gfx_bitmap win_root_logo_icon
 Logo bitmap. More...
 

enum command_id

Command event IDs for low power mode widget.

Enumerator
DUMMY_ID 

Unused command event ID.

ICON_BUTTON_1_ID 

Command event ID for first icon button.

ICON_BUTTON_2_ID 

Command event ID for second icon button.

ICON_BUTTON_3_ID 

Command event ID for third icon button.

BUTTON_PREV_ID 

Command event ID for previous icon button.

BUTTON_NEXT_ID 

Command event ID for next icon button.

BUTTON_SELECT_ID 

Command event ID for select icon button.

DUMMY_ID 

Unused command event ID.

SLIDER_ID 

Command event ID for slider.

CHECK_BOX_ID 

Command event ID for check box.

RADIO_BUTTON_1_ID 

Command event ID for radio button 1.

RADIO_BUTTON_2_ID 

Command event ID for radio button 2.

BUTTON_ID 

Command event ID for button.

DUMMY_ID 

Unused command event ID.

SLIDER_ID 
BUTTON_ID 
ICON_DUMMY_ID 

Dummy icon.

ICON_AUDIO_RECORD_ID 

Command event ID for audio record icon button.

ICON_AUDIO_MIC_ID 

Command event ID for microphone icon button.

ICON_AUDIO_PLAY_PAUSE_ID 

Command event ID for pause icon button.

ICON_AUDIO_STOP_ID 

Command event ID for stop icon button.

ICON_AUDIO_VOLUME_ID 

Command event ID for volume icon button.

ICON_AUDIO_RET_ID 

Command event ID for return icon button.

ICON_AUDIO_MAX_ID 
ICON_DUMMY_ID 

Dummy icon.

ICON_LPM_WAIT_ID 

Command event ID for wait mode icon button.

ICON_LPM_SLEEP_ID 

Command event ID for sleep mode icon button.

ICON_LPM_BACKUP_ID 

Command event ID for backup mode icon button.

ICON_LPM_RET_ID 

Command event ID for second icon button.

ICON_LPM_MAX 

Max information icon number.

void app_widget_lpm_on ( uint8_t  on)

Enable/disable low power mode widget.

Parameters
onTurn on/off low power mode widget.

References app_widget_launch_lpm(), widget_context_lpm::frame, win_destroy(), and wtk_basic_frame_as_child().

Referenced by task_win(), widget_frame_command_handler(), and widget_lpm_command_handler().

static bool widget_lpm_command_handler ( struct wtk_basic_frame frame,
win_command_t  command_data 
)
static

Frame handler for the low power mode widget.

Handles all command events from the widgets in the application frame.

Parameters
framePointer to the application frame
command_dataCommand event ID
Returns
True if exiting, to destroy the window

References app_widget_lpm_backup_on(), app_widget_lpm_on(), app_widget_lpm_sleep_on(), app_widget_lpm_wait_on(), app_widget_main_on(), ICON_LPM_BACKUP_ID, ICON_LPM_RET_ID, ICON_LPM_SLEEP_ID, ICON_LPM_WAIT_ID, and UNUSED.

Referenced by app_widget_launch_lpm().

char demo_func_name[] = "Low Power Mode"
static

Low power mode function name string.

Referenced by app_widget_launch_lpm().

char lpm_backup[] = "Backup"
static

Backup mode string.

Referenced by app_widget_launch_lpm().

char lpm_sleep[] = "Sleep"
static

Sleep mode string.

Referenced by app_widget_launch_lpm().

char lpm_wait[] = "Wait"
static

Wait mode string.

Referenced by app_widget_launch_lpm().

struct widget_context_lpm* widget_ctx_lpm
static

Statically allocated context pointer.

struct gfx_bitmap win_lpm_backup_icon
static
Initial value:
= {
.width = 64, .height = 64,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BACKUP_MODE
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BACKUP_MODE
Definition: bitmaps.h:58

Backup mode bitmap.

struct gfx_bitmap win_lpm_ret_icon
static
Initial value:
= {
.width = 48, .height = 48,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BTN_BACK
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_BACK
Definition: bitmaps.h:44

Return bitmap.

struct gfx_bitmap win_lpm_sleep_icon
static
Initial value:
= {
.width = 64, .height = 64,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_SLEEP_MODE
}
Definition: gfx_generic.h:68
#define DEMO_BMP_SLEEP_MODE
Definition: bitmaps.h:60

Sleep mode bitmap.

struct gfx_bitmap win_lpm_wait_icon
static
Initial value:
= {
.width = 64, .height = 64,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_WAIT_MODE
}
Definition: gfx_generic.h:68
#define DEMO_BMP_WAIT_MODE
Definition: bitmaps.h:59

Wait mode bitmap.

struct gfx_bitmap win_root_logo_icon
static
Initial value:
= {
.width = 87, .height = 40,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_LOGO_ATMEL
}
Definition: gfx_generic.h:68
#define DEMO_BMP_LOGO_ATMEL
Definition: bitmaps.h:43

Logo bitmap.