Buffered graphics routines. More...
#include "pic_utils.h"
Go to the source code of this file.
Defines | |
#define | BOTTOM_LEFT 1 |
#define | draw_paint() drv_paint() |
#define | DRAW_PIXELS_PER_BYTE (8 / DRAW_BITS_PER_PIXEL) |
#define | draw_set_display_brightness(brightness) drv_set_display_brightness(brightness) |
#define | drv_setup() drv_setup_io() |
#define | HORIZONTAL 0 |
#define | TOP_LEFT 0 |
#define | VERTICAL 1 |
Functions | |
void | draw_bitmap (uns8 x, uns8 y, uns8 colour, char *bitmap) |
void | draw_circle (int x_centre, int y_centre, int r, uns8 colour) |
void | draw_circle2 (int x_centre, int y_centre, int r, uns8 colour) |
void | draw_clear_screen () |
uns8 | draw_get_pixel (uns8 x, uns8) |
void | draw_init () |
uns16 | draw_length_str (char *str) |
void | draw_line (uns8 x0, uns8 y0, uns8 x1, uns8 y1, uns8 colour) |
void | draw_print_buffer () |
void | draw_print_str (uns8 x, uns8 y, uns8 width, uns8 start_pixel, uns8 colour, char *str) |
void | draw_rect (uns8 x, uns8 y, uns16 width, uns8 height, uns8 colour) |
void | draw_set_pixel (uns8 x, uns8 y, uns8 colour) |
void | draw_setup_io () |
void | drv_init () |
void | drv_paint () |
void | drv_print_buffer () |
void | drv_refresh () |
void | drv_set_display_brightness (uns8 brightness) |
void | drv_setup_io () |
You will need to pick a hardware buffering mode for the draw routines.
Draw buffer addressing
4 | U V W X Y 3 | P Q R S T 2 | K L M N O 1 | F G H I J 0 | A B C D E --------- 0 1 2 3 4 DRAW_HW_Y_ORIGIN == BOTTOM_LEFT DRAW_HW_BUFFER_ORIENTATION == HORIZONTAL
0 | A B C D E 1 | F G H I J 2 | K L M N O 3 | P Q R S T 4 | U V W X Y --------- 0 1 2 3 4 DRAW_HW_Y_ORIGIN == TOP_LEFT DRAW_HW_BUFFER_ORIENTATION == HORIZONTAL
0 | E J O T Y 1 | D I N S X 2 | C H M R W 3 | B G L Q V 4 | A F K P U --------- 0 1 2 3 4 DRAW_HW_Y_ORIGIN == BOTTOM_LEFT DRAW_HW_BUFFER_ORIENTATION == VERTICAL
0 | A F K P U 1 | B G L Q V 2 | C H M R W 3 | D I N S X 4 | E J O T Y --------- 0 1 2 3 4 DRAW_HW_Y_ORIGIN == TOP_LEFT DRAW_HW_BUFFER_ORIENTATION == VERTICAL
Put the following in your config.h:
// - - - - - - - - - - - - - - - - - - - - // Draw defines // - - - - - - - - - - - - - - - - - - - - #define DRAW_PIXELS_HIGH 24 #define DRAW_PIXELS_WIDE 16 #define DRAW_BITS_PER_PIXEL 1 #define DRAW_HW_Y_ORIGIN TOP_LEFT // or BOTTOM_LEFT #define DRAW_HW_BUFFER_ORIENTATION VERTICAL // or HORIZONTAL //Enable debug to see what's happening under the hood //#define DRAW_DEBUG // - - - - - - - - - - - - - - - - - - - -
Definition in file draw.h.
#define draw_paint | ( | ) | drv_paint() |
Definition at line 136 of file draw.h.
Referenced by draw_tests_run().
#define DRAW_PIXELS_PER_BYTE (8 / DRAW_BITS_PER_PIXEL) |
Definition at line 122 of file draw.h.
Referenced by draw_print_buffer(), and drv_paint().
#define draw_set_display_brightness | ( | brightness | ) | drv_set_display_brightness(brightness) |
void draw_bitmap | ( | uns8 | x, | |
uns8 | y, | |||
uns8 | colour, | |||
char * | bitmap | |||
) |
Definition at line 591 of file draw.c.
References draw_set_pixel(), and uns8.
Referenced by draw_tests_run().
void draw_circle | ( | int | x_centre, | |
int | y_centre, | |||
int | r, | |||
uns8 | colour | |||
) |
Definition at line 390 of file draw.c.
References draw_circle_points().
void draw_circle2 | ( | int | x_centre, | |
int | y_centre, | |||
int | r, | |||
uns8 | colour | |||
) |
Definition at line 426 of file draw.c.
References draw_circle_points2().
Referenced by draw_tests_run().
void draw_clear_screen | ( | ) |
Definition at line 49 of file draw.c.
References draw_buffer0, DRAW_TOTAL_BUFFER_SIZE, and uns8.
Referenced by draw_init(), and draw_tests_run().
void draw_init | ( | ) |
Definition at line 128 of file draw.c.
References draw_clear_screen(), and drv_init().
uns16 draw_length_str | ( | char * | str | ) |
Definition at line 514 of file draw.c.
References PicPack5x7_index, uns16, and uns8.
void draw_line | ( | uns8 | x0, | |
uns8 | y0, | |||
uns8 | x1, | |||
uns8 | y1, | |||
uns8 | colour | |||
) |
Definition at line 307 of file draw.c.
References draw_set_pixel().
Referenced by draw_circle_lines(), and draw_tests_run().
void draw_print_buffer | ( | ) |
Definition at line 266 of file draw.c.
References draw_buffer0, DRAW_PIXELS_PER_BYTE, serial_print_int(), serial_print_int_hex(), serial_print_str(), serial_putc(), uns16, and uns8.
void draw_print_str | ( | uns8 | x, | |
uns8 | y, | |||
uns8 | width, | |||
uns8 | start_pixel, | |||
uns8 | colour, | |||
char * | str | |||
) |
Definition at line 529 of file draw.c.
References draw_set_pixel(), PicPack5x7_bitmap_0, PicPack5x7_bitmap_1, PicPack5x7_index, uns16, and uns8.
Referenced by draw_tests_run().
void draw_rect | ( | uns8 | x, | |
uns8 | y, | |||
uns16 | width, | |||
uns8 | height, | |||
uns8 | colour | |||
) |
Definition at line 251 of file draw.c.
References draw_set_pixel(), and uns16.
Referenced by draw_tests_run().
void draw_set_pixel | ( | uns8 | x, | |
uns8 | y, | |||
uns8 | colour | |||
) |
Definition at line 135 of file draw.c.
References draw_buffer0, uns16, and uns8.
Referenced by draw_bitmap(), draw_circle_points(), draw_circle_points2(), draw_line(), draw_print_str(), draw_rect(), and draw_tests_run().
void draw_setup_io | ( | ) |
Definition at line 124 of file draw.c.
References drv_setup_io().
void drv_init | ( | ) |
Definition at line 287 of file drv_ea_ldp6416.c.
References ea_ldp6416_init(), ea_ldp6432_init(), ea_ldp8008_init(), HT1632_CMD_PMOS_16_COMMON, ht1632_init(), and pcd8544_init().
Referenced by draw_init().
void drv_paint | ( | ) |
Definition at line 73 of file drv_ea_ldp6416.c.
References buffer0, buffer1, clear_pin, draw_buffer0, DRAW_PIXELS_PER_BYTE, end_crit_sec, get_draw_buffer(), pcd8544_send_command(), pcd8544_send_data(), serial_print_str(), set_pin, start_crit_sec, uns16, and uns8.
void drv_print_buffer | ( | ) |
Definition at line 94 of file drv_ea_ldp6416.c.
References buffer0, serial_print_int(), serial_print_nl(), serial_print_spc(), and uns8.
void drv_refresh | ( | ) |
Definition at line 116 of file drv_ea_ldp6416.c.
References bright_count, bright_level, buffer0, buffer1, buffer_position, buffer_position0, clear_pin, current_buffer, current_row, MAX_BRIGHTNESS, set_pin, set_pins_r1_g1, set_pins_r1_g1_r2_g2, set_pins_r_g, and uns8.
void drv_set_display_brightness | ( | uns8 | brightness | ) |
Definition at line 108 of file drv_ea_ldp6416.c.
References bright_level, and MAX_BRIGHTNESS.
void drv_setup_io | ( | ) |
Definition at line 283 of file drv_ea_ldp6416.c.
References ea_ldp6416_setup_io(), ea_ldp6432_setup_io(), ea_ldp8008_setup_io(), ht1632_setup_io(), and pcd8544_setup_io().
Referenced by draw_setup_io().