Display demo process control application. More...
#include <assert.h>#include <gfx/gfx.h>#include <gfx/win.h>#include <gfx/wtk.h>#include <gfx/sysfont.h>#include <mainloop.h>#include <membag.h>#include <physmem.h>#include <status_codes.h>#include <string.h>#include <timer.h>#include <util.h>#include "app_tank.h"#include <workqueue.h>#include "app_desktop.h"#include "file_loader.h"Go to the source code of this file.
Data Structures | |
| struct | tank_context |
| Context for the water tank application. More... | |
Defines | |
Color scheme | |
| #define | COLOR_WIN_BACKGROUND GFX_COLOR(0, 0, 0) |
| Color to initially fill screen with. | |
| #define | COLOR_LEVEL_FILL GFX_COLOR(0, 0, 255) |
| Fill color for tank level indicator. | |
| #define | COLOR_LEVEL_BACKGROUND GFX_COLOR(32, 32, 32) |
| Background color for tank level indicator. | |
| #define | COLOR_DEMAND_NORMAL GFX_COLOR(64, 192, 64) |
| Normal fill color for demand indicator. | |
| #define | COLOR_DEMAND_CRITICAL GFX_COLOR(192, 64, 64) |
| Critical fill color for demand indicator. | |
| #define | COLOR_DEMAND_BACKGROUND GFX_COLOR(32, 32, 32) |
| Background color for demand indicator. | |
Maximum and initial values of process parameters | |
| #define | VALUE_LEVEL_MAXIMUM 127 |
| Maximum level of tank. | |
| #define | VALUE_LEVEL_INITIAL 0 |
| Initial level of tank. | |
| #define | VALUE_SUPPLY_MAXIMUM VALUE_LEVEL_MAXIMUM |
| Maximum value of supply. | |
| #define | VALUE_SUPPLY_INITIAL (VALUE_SUPPLY_MAXIMUM / 2) |
| Initial value of supply. | |
| #define | VALUE_DEMAND_MAXIMUM VALUE_LEVEL_MAXIMUM |
| Maximum value of demand. | |
| #define | VALUE_DEMAND_INITIAL 0 |
| Initial value of demand. | |
Widget sizes and positions | |
| #define | WIDGET_LEVEL_SIZE_X 52 |
| Height of progress bar for tank level. | |
| #define | WIDGET_LEVEL_SIZE_Y 121 |
| Width of progress bar for tank level. | |
| #define | WIDGET_LEVEL_POSITION_X 134 |
| X coordinate of progress bar for tank level. | |
| #define | WIDGET_LEVEL_POSITION_Y 59 |
| Y coordinate of progress bar for tank level. | |
| #define | WIDGET_SUPPLY_SIZE_X 37 |
| Height of slider for supply. | |
| #define | WIDGET_SUPPLY_SIZE_Y 105 |
| Width of slider for supply. | |
| #define | WIDGET_SUPPLY_POSITION_X 39 |
| X coordinate of slider for supply. | |
| #define | WIDGET_SUPPLY_POSITION_Y 85 |
| Y coordinate of slider for supply. | |
| #define | WIDGET_DEMAND_SIZE_X 20 |
| Height of progress bar for demand indication. | |
| #define | WIDGET_DEMAND_SIZE_Y 45 |
| Width of progress bar for demand indication. | |
| #define | WIDGET_DEMAND_POSITION_X 250 |
| X coordinate of progress bar for demand indication. | |
| #define | WIDGET_DEMAND_POSITION_Y 100 |
| Y coordinator of progress bar for demand indication. | |
Bitmap filenames, sizes and positions | |
| #define | BITMAP_BACKGROUND_FILENAME "p_tankbg" |
| Filename of background bitmap. | |
| #define | BITMAP_BACKGROUND_SIZE_X 320 |
| Width of background bitmap. | |
| #define | BITMAP_BACKGROUND_SIZE_Y 240 |
| Height of background bitmap. | |
| #define | BITMAP_BACKGROUND_POSITION_X 0 |
| X coordinate of background bitmap. | |
| #define | BITMAP_BACKGROUND_POSITION_Y 0 |
| Y coordinate of background bitmap. | |
| #define | BITMAP_RED_LIGHT_FILENAME "p_lgtred" |
| Filename of red alarm light bitmap. | |
| #define | BITMAP_GREEN_LIGHT_FILENAME "p_lgtgrn" |
| Filename of green alarm light bitmap. | |
| #define | BITMAP_LIGHT_SIZE_X 38 |
| Width of alarm light bitmap. | |
| #define | BITMAP_LIGHT_SIZE_Y 38 |
| Height of alarm light bitmap. | |
| #define | BITMAP_LIGHT_POSITION_X 241 |
| X coordinate of alarm light bitmap. | |
| #define | BITMAP_LIGHT_POSITION_Y 26 |
| Y coordinate of alarm light bitmap. | |
Application timing configuration | |
| #define | TICK_RATE 30 |
| Application tick rate. | |
| #define | TICKS_PER_RANDOM_UPDATE 9 |
| Application ticks between each update of random variable. | |
Enumerations | |
| enum | tank_loader_state { LOAD_RED_LIGHT, LOAD_GREEN_LIGHT, LOAD_BACKGROUND, LOAD_FINISHED } |
States for the application loader task. More... | |
| enum | tank_bitmap_id { BITMAP_RED_LIGHT, BITMAP_GREEN_LIGHT, NR_OF_BITMAPS } |
Enumeration of bitmaps to load to hugemem. More... | |
| enum | tank_command_id { CMD_NONE, CMD_EXIT } |
Event command ID for application widgets. More... | |
Functions | |
| static bool | tank_frame_handler (struct wtk_basic_frame *basic_frame, win_command_t command_data) |
| Command event handler for the application's frame. | |
| static int32_t | tank_logistic_map (int32_t rand) |
| Compute new random value via a logistic map. | |
| static void | tank_worker (struct workqueue_task *task) |
| Application worker function. | |
| static void | tank_timer_callback (struct timer *timer) |
| Application timer callback function. | |
| static void | tank_loader (struct workqueue_task *task) |
| Application loader. | |
| void | app_tank_launch (struct workqueue_task *task) |
| Launch the water tank application. | |
Variables | |
| static hugemem_ptr_t | tank_bitmap_data [NR_OF_BITMAPS] |
| Pointers to bitmap data in hugemem. | |
| static struct tank_context * | tank_ctx |
| Pointer to water tank application context. | |
Display demo process control application.
Copyright (C) 2010 Atmel Corporation. All rights reserved.
Definition in file app_tank.c.
1.6.3