Microchip® Advanced Software Framework

widget_scr_audio.c File Reference

Audio 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_audio
 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 audio widget. More...
 

Functions

void app_widget_audio_on (uint8_t on)
 Enable/disable audio widget. More...
 
static void app_widget_launch_audio (void)
 Setup audio widget. More...
 
static bool widget_audio_command_handler (struct wtk_basic_frame *frame, win_command_t command_data)
 Frame handler for the application. More...
 

Variables

static char demo_func_name [] = "Audio"
 String for function name. More...
 
static char demo_idc [] = " This module is\nunder construction\n Press any icon\n to return!"
 Indication string. More...
 
static struct
widget_context_audio
widget_ctx_audio
 Statically allocated context pointer. More...
 
static struct gfx_bitmap win_audio_mic_icon
 Microphone bitmap. More...
 
static struct gfx_bitmap win_audio_play_pause_icon
 Play pause bitmap. More...
 
static struct gfx_bitmap win_audio_record_icon
 Audio record bitmap. More...
 
static struct gfx_bitmap win_audio_ret_icon
 Audio return bitmap. More...
 
static struct gfx_bitmap win_audio_stop_icon
 Audio stop bitmap. More...
 
static struct gfx_bitmap win_audio_vol_disable_icon
 Volume disable bitmap. More...
 
static struct gfx_bitmap win_root_logo_icon
 Logo bitmap. More...
 

enum command_id

Command event IDs for audio 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_audio_on ( uint8_t  on)

Enable/disable audio widget.

Parameters
onTurn on/off audio widget.

References app_widget_launch_audio(), widget_context_audio::frame, win_destroy(), and wtk_basic_frame_as_child().

Referenced by widget_audio_command_handler(), and widget_frame_command_handler().

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

Frame handler for the application.

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_audio_on(), app_widget_main_on(), ICON_AUDIO_MIC_ID, ICON_AUDIO_PLAY_PAUSE_ID, ICON_AUDIO_RECORD_ID, ICON_AUDIO_RET_ID, ICON_AUDIO_STOP_ID, ICON_AUDIO_VOLUME_ID, and UNUSED.

Referenced by app_widget_launch_audio().

char demo_func_name[] = "Audio"
static

String for function name.

Referenced by app_widget_launch_audio().

char demo_idc[] = " This module is\nunder construction\n Press any icon\n to return!"
static

Indication string.

Referenced by app_widget_launch_audio().

struct widget_context_audio* widget_ctx_audio
static

Statically allocated context pointer.

struct gfx_bitmap win_audio_mic_icon
static
Initial value:
= {
.width = 48, .height=48,
.type = GFX_BITMAP_EXT,
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_MICROPHONE_DISABLED
Definition: bitmaps.h:74

Microphone bitmap.

struct gfx_bitmap win_audio_play_pause_icon
static
Initial value:
= {
.width = 48, .height=48,
.type = GFX_BITMAP_EXT,
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_PLAY_PAUSE_DISABLED
Definition: bitmaps.h:62

Play pause bitmap.

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

Audio record bitmap.

struct gfx_bitmap win_audio_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

Audio return bitmap.

struct gfx_bitmap win_audio_stop_icon
static
Initial value:
= {
.width = 48, .height=48,
.type = GFX_BITMAP_EXT,
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_STOP_DISABLED
Definition: bitmaps.h:65

Audio stop bitmap.

struct gfx_bitmap win_audio_vol_disable_icon
static
Initial value:
= {
.width = 48, .height=48,
.type = GFX_BITMAP_EXT,
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_VOLUME_DISABLED
Definition: bitmaps.h:68

Volume disable 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.