Microchip® Advanced Software Framework

app.h File Reference

Application layer for low power and full features demo initialization.

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

#include "asf.h"
#include "conf_board.h"
#include "conf_clock.h"
#include "exceptions.h"
#include "sysclk.h"
#include "sleepmgr.h"
#include "ast.h"
#include "eic.h"
#include "bpm.h"
#include "board_monitor.h"
#include "ui.h"
#include "event.h"
#include <math.h>
#include <time.h>

Functions

void app_enter_sleep_mode (sleep_mode_t sleep_mode)
 Enter into sleep mode. More...
 
void app_init (void)
 Application initialization: at startup the application run in full demo mode (all features on, includes QTouch and segment LCD). More...
 
void app_init_lowpower (void)
 Initialize the app in low power: now PB0 push button has been pressed once, the application switches in low power mode: Stop LCD controller, stop LCD backlight, stop QTouch acquisition, switch SAM4L in power scaling PS1 mode. More...
 
void app_prime_number_run (void)
 Prime Number function. More...
 
void app_switch_power_scaling (power_scaling_t power_scaling)
 Switch into selected Power Scaling. More...
 

void app_enter_sleep_mode ( sleep_mode_t  sleep_mode)

Enter into sleep mode.

Parameters
sleep_modeselected sleep mode.

References SLEEPMGR_ACTIVE, SLEEPMGR_BACKUP, SLEEPMGR_RET, sleepmgr_sleep(), and SLEEPMGR_WAIT.

Referenced by main().

void app_init ( void  )

Application initialization: at startup the application run in full demo mode (all features on, includes QTouch and segment LCD).

Initialize the board IO configuration, clocks, QTouch library, xternal interrupts, NVIC and UI. SAM4L is running at 12 MHz from internal RCFAST (configured at 12MHz).

References board_init(), event_button_init(), event_qtouch_init(), IOPORT_PIN_LEVEL_HIGH, ioport_set_pin_level(), sysclk_init(), ui_bm_init(), ui_lcd_init(), and ui_set_mcu_status().

Referenced by main().

void app_init_lowpower ( void  )

Initialize the app in low power: now PB0 push button has been pressed once, the application switches in low power mode: Stop LCD controller, stop LCD backlight, stop QTouch acquisition, switch SAM4L in power scaling PS1 mode.

SAM4L is in RUN mode.

References app_switch_power_scaling(), board_init(), IOPORT_PIN_LEVEL_LOW, ioport_set_pin_level(), lcdca_disable(), sysclk_disable_peripheral_clock(), touch_sensors_deinit(), ui_bm_send_mcu_status(), ui_get_power_scaling_mcu_status(), and ui_set_mcu_status().

Referenced by main().

void app_prime_number_run ( void  )

Prime Number function.

References PRIM_NUMS.

void app_switch_power_scaling ( power_scaling_t  power_scaling)

Switch into selected Power Scaling.

Parameters
power_scalingselected Power Scaling.

References bpm_configure_power_scaling(), bpm_get_status(), BPM_PS_0, BPM_PS_1, and BPM_PS_2.

Referenced by app_init_lowpower(), and main().