Atmel Software Framework

gfx_mono_spinctrl.c File Reference

Spin control widget Copyright (c) 2011-2015 Atmel Corporation.

All rights reserved.

#include "sysfont.h"
#include "stdio.h"
#include "gfx_mono.h"
#include "gfx_mono_spinctrl.h"

Functions

void gfx_mono_spinctrl_draw (struct gfx_mono_spinctrl *spinner, bool redraw)
 Draw spinner at its position. More...
 
static void gfx_mono_spinctrl_draw_button (bool draw, bool indicator)
 Draw OK button at bottom of screen. More...
 
static void gfx_mono_spinctrl_draw_indicator (struct gfx_mono_spinctrl *spinner, bool draw)
 Draw or delete indicator arrow in front of spinner. More...
 
static void gfx_mono_spinctrl_draw_spin_indicator (struct gfx_mono_spinctrl *spinner, bool draw)
 Draw or delete indicator in front of spinner data. More...
 
void gfx_mono_spinctrl_init (struct gfx_mono_spinctrl *spinner, gfx_mono_spinctrl_type_t datatype, PROGMEM_STRING_T title, PROGMEM_STRING_T *data, int16_t lower_limit, int16_t upper_limit, gfx_coord_t y)
 Initialize a spinner. More...
 
int16_t gfx_mono_spinctrl_process_key (struct gfx_mono_spinctrl *spinner, uint8_t keycode)
 Update single spinner depending on input. More...
 
void gfx_mono_spinctrl_spincollection_add_spinner (struct gfx_mono_spinctrl *spinner, struct gfx_mono_spinctrl_spincollection *spinners)
 Add spinner to spincollection. More...
 
void gfx_mono_spinctrl_spincollection_init (struct gfx_mono_spinctrl_spincollection *collection)
 Initialize a spincollection. More...
 
int16_t gfx_mono_spinctrl_spincollection_process_key (struct gfx_mono_spinctrl_spincollection *spinners, uint8_t keycode, int16_t results[])
 Update spincollection on screen depending on input. More...
 
void gfx_mono_spinctrl_spincollection_show (struct gfx_mono_spinctrl_spincollection *spinners)
 Show spincollection. More...
 
static void gfx_mono_spinctrl_step_down (struct gfx_mono_spinctrl *spinner)
 Step down spinner data. More...
 
static void gfx_mono_spinctrl_step_up (struct gfx_mono_spinctrl *spinner)
 Step up spinner data. More...
 
 PROGMEM_DECLARE (gfx_mono_color_t, spin_indicator_data[])
 
 PROGMEM_DECLARE (gfx_mono_color_t, indicator_data[])
 

Variables

struct gfx_mono_bitmap gfx_mono_spinctrl_bitmap_indicator
 
struct gfx_mono_bitmap gfx_mono_spinctrl_bitmap_spin_indicator
 

static void gfx_mono_spinctrl_draw_button ( bool  draw,
bool  indicator 
)
static

Draw OK button at bottom of screen.

This function draws an OK button at the bottom of the screen. It will also draw an indicator arrow in front of the button if the indicator bool is true. If the draw bool is false, the OK button will be deleted, and if the indicator bool is false, the indicator will be deleted.

Parameters
drawtrue on draw, false on delete
indicatortrue on draw indicator, false on delete

References gfx_mono_draw_filled_rect, gfx_mono_draw_string(), gfx_mono_get_string_bounding_box(), GFX_MONO_LCD_WIDTH, gfx_mono_put_bitmap, GFX_MONO_SPINCTRL_MAX_ELEMENTS_IN_SPINCOLLECTION, GFX_PIXEL_CLR, gfx_mono_bitmap::height, sysfont, SYSFONT_HEIGHT, and gfx_mono_bitmap::width.

Referenced by gfx_mono_spinctrl_spincollection_process_key(), and gfx_mono_spinctrl_spincollection_show().

static void gfx_mono_spinctrl_draw_indicator ( struct gfx_mono_spinctrl spinner,
bool  draw 
)
static

Draw or delete indicator arrow in front of spinner.

Parameters
*spinnerinitialized gfx_mono_spinctrl struct
drawtrue on draw, false on delete

References gfx_mono_draw_filled_rect, gfx_mono_put_bitmap, GFX_PIXEL_CLR, and gfx_mono_spinctrl::y.

Referenced by gfx_mono_spinctrl_spincollection_process_key(), and gfx_mono_spinctrl_spincollection_show().

static void gfx_mono_spinctrl_draw_spin_indicator ( struct gfx_mono_spinctrl spinner,
bool  draw 
)
static

Draw or delete indicator in front of spinner data.

Parameters
spinnerpointer to initialized gfx_mono_spinctrl struct
drawtrue on draw, false on delete

References gfx_mono_draw_filled_rect, GFX_MONO_LCD_WIDTH, gfx_mono_put_bitmap, GFX_PIXEL_CLR, and gfx_mono_spinctrl::y.

Referenced by gfx_mono_spinctrl_draw().

static void gfx_mono_spinctrl_step_down ( struct gfx_mono_spinctrl spinner)
static

Step down spinner data.

  • This function steps down the data, making sure it does not go below the lower limit. Wraps around if it does.
Parameters
spinnerpointer to initialized spinner.

References gfx_mono_spinctrl::datatype, gfx_mono_spinctrl_string::index, gfx_mono_spinctrl::integer_data, gfx_mono_spinctrl::lower_limit, SPINTYPE_INTEGER, SPINTYPE_STRING, gfx_mono_spinctrl::strings, and gfx_mono_spinctrl::upper_limit.

Referenced by gfx_mono_spinctrl_process_key().

static void gfx_mono_spinctrl_step_up ( struct gfx_mono_spinctrl spinner)
static

Step up spinner data.

This function steps up the data, making sure it does not go beyond the upper limit. Wraps around if it does.

Parameters
spinnerpointer to initialized spinner.

References gfx_mono_spinctrl::datatype, gfx_mono_spinctrl_string::index, gfx_mono_spinctrl::integer_data, gfx_mono_spinctrl::lower_limit, SPINTYPE_INTEGER, SPINTYPE_STRING, gfx_mono_spinctrl::strings, and gfx_mono_spinctrl::upper_limit.

Referenced by gfx_mono_spinctrl_process_key().

PROGMEM_DECLARE ( gfx_mono_color_t  ,
spin_indicator_data  [] 
)
PROGMEM_DECLARE ( gfx_mono_color_t  ,
indicator_data  [] 
)

struct gfx_mono_bitmap gfx_mono_spinctrl_bitmap_indicator
Initial value:
= {
.height = GFX_MONO_SPINCTRL_INDICATOR_HEIGHT,
.width = GFX_MONO_SPINCTRL_INDICATOR_WIDTH,
.data.progmem = indicator_data
}
Bitmap stored in progmem.
Definition: gfx_mono.h:106
struct gfx_mono_bitmap gfx_mono_spinctrl_bitmap_spin_indicator
Initial value:
= {
.height = GFX_MONO_SPINCTRL_SPIN_INDICATOR_HEIGHT,
.width = GFX_MONO_SPINCTRL_SPIN_INDICATOR_WIDTH,
.data.progmem = spin_indicator_data
}
Bitmap stored in progmem.
Definition: gfx_mono.h:106