dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
osd_utils.h File Reference

OSD Utility Functions. More...

#include "openpilot.h"
#include "fonts.h"
#include "images.h"
#include "misc_math.h"
#include "pios_video.h"

Go to the source code of this file.

Data Structures

struct  FontDimensions
 
struct  point_t
 

Macros

#define SIZEOF_ARRAY(x)   (sizeof(x) / sizeof((x)[0]))
 
#define HUD_VSCALE_FLAG_CLEAR   1
 
#define HUD_VSCALE_FLAG_NO_NEGATIVE   2
 
#define PIXELS_PER_BIT   (8 / PIOS_VIDEO_BITS_PER_PIXEL)
 
#define CALC_BIT_IN_WORD(x)   (2 * ((x) & 3))
 
#define CALC_BITSHIFT_WORD(x)   (2 * ((x) & 3))
 
#define CALC_BIT_MASK(x)   (3 << (6 - CALC_BITSHIFT_WORD(x)))
 
#define PACK_BITS(mask, level)   (level << 7 | mask << 6 | level << 5 | mask << 4 | level << 3 | mask << 2 | level << 1 | mask)
 
#define CALC_BIT0_IN_WORD(x)   (2 * ((x) & 3))
 
#define CALC_BIT1_IN_WORD(x)   (2 * ((x) & 3) + 1)
 
#define COMPUTE_HLINE_EDGE_L_MASK(b)   ((1 << (7 - (b))) - 1)
 
#define COMPUTE_HLINE_EDGE_R_MASK(b)   (~((1 << (6 - (b))) - 1))
 
#define CALC_BUFF_ADDR(x, y)   (((x) / PIXELS_PER_BIT) + ((y) * BUFFER_WIDTH))
 
#define DEBUG_DELAY
 
#define WRITE_WORD_MODE(buff, addr, mask, mode)
 
#define WRITE_WORD_NAND(buff, addr, mask)   { buff[addr] &= ~mask; DEBUG_DELAY; }
 
#define WRITE_WORD_OR(buff, addr, mask)   { buff[addr] |= mask; DEBUG_DELAY; }
 
#define WRITE_WORD_XOR(buff, addr, mask)   { buff[addr] ^= mask; DEBUG_DELAY; }
 
#define WRITE_WORD(buff, addr, mask, value)   { buff[addr] = (buff[addr] & ~mask) | (value & mask);}
 
#define COMPUTE_HLINE_ISLAND_MASK(b0, b1)   (COMPUTE_HLINE_EDGE_L_MASK(b0) ^ COMPUTE_HLINE_EDGE_L_MASK(b1));
 
#define SETUP_STROKE_FILL(stroke, fill, mode)
 
#define ENDCAP_NONE   0
 
#define ENDCAP_ROUND   1
 
#define ENDCAP_FLAT   2
 
#define DRAW_ENDCAP_HLINE(e, x, y, s, f, l)
 
#define DRAW_ENDCAP_VLINE(e, x, y, s, f, l)
 
#define CIRCLE_PLOT_8(buff, cx, cy, x, y, mode)
 
#define CIRCLE_PLOT_4(buff, cx, cy, x, y, mode)
 
#define FONT_BOLD   1
 
#define FONT_INVERT   2
 
#define TEXT_VA_TOP   0
 
#define TEXT_VA_MIDDLE   1
 
#define TEXT_VA_BOTTOM   2
 
#define TEXT_HA_LEFT   0
 
#define TEXT_HA_CENTER   1
 
#define TEXT_HA_RIGHT   2
 
#define MAX3(a, b, c)   MAX(a, MAX(b, c))
 
#define MIN3(a, b, c)   MIN(a, MIN(b, c))
 
#define LIMIT(x, l, h)   MAX(l, MIN(x, h))
 
#define CHECK_COORDS(x, y)   if (x < GRAPHICS_LEFT || x > GRAPHICS_RIGHT || y < GRAPHICS_TOP || y > GRAPHICS_BOTTOM) { return; }
 
#define CHECK_COORD_X(x)   if (x < GRAPHICS_LEFT || x > GRAPHICS_RIGHT) { return; }
 
#define CHECK_COORD_Y(y)   if (y < GRAPHICS_TOP || y > GRAPHICS_BOTTOM) { return; }
 
#define CLIP_COORDS(x, y)   { CLIP_COORD_X(x); CLIP_COORD_Y(y); }
 
#define CLIP_COORD_X(x)   { x = x < GRAPHICS_LEFT ? GRAPHICS_LEFT : x > GRAPHICS_RIGHT ? GRAPHICS_RIGHT : x; }
 
#define CLIP_COORD_Y(y)   { y = y < GRAPHICS_TOP ? GRAPHICS_TOP : y > GRAPHICS_BOTTOM ? GRAPHICS_BOTTOM : y; }
 
#define SWAP(a, b)   { a ^= b; b ^= a; a ^= b; }
 

Functions

void clearGraphics ()
 
void draw_image (uint16_t x, uint16_t y, const struct Image *image)
 
void plotFourQuadrants (int32_t centerX, int32_t centerY, int32_t deltaX, int32_t deltaY)
 
void ellipse (int centerX, int centerY, int horizontalRadius, int verticalRadius)
 
void drawArrow (uint16_t x, uint16_t y, uint16_t angle, uint16_t size_quarter)
 
void drawBox (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
 
void write_pixel_lm (int x, int y, int mmode, int lmode)
 
void write_hline_lm (int x0, int x1, int y, int lmode, int mmode)
 
void write_hline_outlined (int x0, int x1, int y, int endcap0, int endcap1, int mode, int mmode)
 
void write_vline_lm (int x, int y0, int y1, int lmode, int mmode)
 
void write_vline_outlined (int x, int y0, int y1, int endcap0, int endcap1, int mode, int mmode)
 
void write_filled_rectangle_lm (int x, int y, int width, int height, int lmode, int mmode)
 
void write_rectangle_outlined (int x, int y, int width, int height, int mode, int mmode)
 
void write_circle_outlined (int cx, int cy, int r, int dashp, int bmode, int mode, int mmode)
 
void write_line_lm (int x0, int y0, int x1, int y1, int mmode, int lmode)
 
void write_line_outlined (int x0, int y0, int x1, int y1, __attribute__((unused)) int endcap0, __attribute__((unused)) int endcap1, int mode, int mmode)
 
void write_line_outlined_dashed (int x0, int y0, int x1, int y1, __attribute__((unused)) int endcap0, __attribute__((unused)) int endcap1, int mode, int mmode, int dots)
 
const struct FontEntryget_font_info (int font)
 
void calc_text_dimensions (char *str, const struct FontEntry *font, int xs, int ys, struct FontDimensions *dim)
 
void write_string (char *str, int x, int y, int xs, int ys, int va, int ha, int flags, int font)
 
void draw_polygon (int16_t x, int16_t y, float angle, const point_t *points, uint8_t n_points, int mode, int mmode)
 
void lla_to_ned (int32_t lat, int32_t lon, float alt, float *NED)
 

Detailed Description

OSD Utility Functions.

Author
Tau Labs, http://taulabs.org, Copyright (C) 2013-2015
The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2014.
See Also
The GNU Public License (GPL) Version 3

Definition in file osd_utils.h.