From 8cc876d02a292e71331139327ae180c546369152 Mon Sep 17 00:00:00 2001 From: Sambas Date: Sun, 12 Feb 2012 22:29:42 +0200 Subject: [PATCH] OSD branch --- flight/Modules/Osd/osdgen/inc/osdgen.h | 199 + flight/Modules/Osd/osdgen/osdgen.c | 2321 ++++ flight/Modules/Osd/osdinput/inc/osdinput.h | 15 + flight/Modules/Osd/osdinput/osdinput.c | 285 + flight/OSD/Makefile | 502 + flight/OSD/System/alarms.c | 210 + flight/OSD/System/font_outlined8x14.c | 268 + flight/OSD/System/font_outlined8x14.h | 12 + flight/OSD/System/font_outlined8x8.c | 182 + flight/OSD/System/font_outlined8x8.h | 12 + flight/OSD/System/fonts.c | 34 + flight/OSD/System/fonts.h | 48 + flight/OSD/System/inc/FreeRTOSConfig.h | 99 + flight/OSD/System/inc/alarms.h | 50 + flight/OSD/System/inc/font12x18.h | 9744 +++++++++++++++++ flight/OSD/System/inc/font_outlined6x8.h | 1041 ++ flight/OSD/System/inc/oem6x8.h | 1041 ++ flight/OSD/System/inc/op_config.h | 39 + flight/OSD/System/inc/openpilot.h | 53 + flight/OSD/System/inc/oposd.h | 74 + flight/OSD/System/inc/pios_board_posix.h | 84 + flight/OSD/System/inc/pios_config.h | 72 + flight/OSD/System/inc/pios_config_posix.h | 54 + flight/OSD/System/inc/pios_usb_board_data.h | 45 + flight/OSD/System/inc/pios_usb_hid_desc.h | 56 + flight/OSD/System/inc/pios_usssb.h | 79 + flight/OSD/System/inc/taskmonitor.h | 43 + flight/OSD/System/inc/usb_conf.h | 186 + flight/OSD/System/inc/watchdog.h | 32 + flight/OSD/System/inc/xconvert.h | 264 + flight/OSD/System/osd.c | 320 + flight/OSD/System/pios_board.c | 1263 +++ flight/OSD/System/pios_usb_board_data.c | 120 + flight/OSD/System/pios_usb_hid_desc.c | 220 + flight/OSD/System/taskmonitor.c | 150 + flight/OSD/System/watchdog.c | 71 + flight/PiOS/Boards/STM32F4xx_OSD.h | 467 + flight/PiOS/Boards/pios_board.h | 2 + flight/PiOS/Common/pios_video.c | 264 + .../STM32F4xx/Source/osd/system_stm32f4xx.c | 552 + .../{ => revolution}/system_stm32f4xx.c | 0 flight/PiOS/STM32F4xx/library.mk | 148 +- .../STM32F4xx/link_STM32F4xx_OP_memory.ld | 2 +- flight/PiOS/STM32F4xx/pios_sys.c | 2 +- flight/PiOS/inc/pios_usb_defs.h | 1 + flight/PiOS/inc/pios_video.h | 93 + flight/PiOS/pios.h | 3 + make/boards/osd/board-info.mk | 23 + 48 files changed, 20769 insertions(+), 76 deletions(-) create mode 100644 flight/Modules/Osd/osdgen/inc/osdgen.h create mode 100644 flight/Modules/Osd/osdgen/osdgen.c create mode 100644 flight/Modules/Osd/osdinput/inc/osdinput.h create mode 100644 flight/Modules/Osd/osdinput/osdinput.c create mode 100644 flight/OSD/Makefile create mode 100644 flight/OSD/System/alarms.c create mode 100644 flight/OSD/System/font_outlined8x14.c create mode 100644 flight/OSD/System/font_outlined8x14.h create mode 100644 flight/OSD/System/font_outlined8x8.c create mode 100644 flight/OSD/System/font_outlined8x8.h create mode 100644 flight/OSD/System/fonts.c create mode 100644 flight/OSD/System/fonts.h create mode 100644 flight/OSD/System/inc/FreeRTOSConfig.h create mode 100644 flight/OSD/System/inc/alarms.h create mode 100644 flight/OSD/System/inc/font12x18.h create mode 100644 flight/OSD/System/inc/font_outlined6x8.h create mode 100644 flight/OSD/System/inc/oem6x8.h create mode 100644 flight/OSD/System/inc/op_config.h create mode 100644 flight/OSD/System/inc/openpilot.h create mode 100644 flight/OSD/System/inc/oposd.h create mode 100644 flight/OSD/System/inc/pios_board_posix.h create mode 100644 flight/OSD/System/inc/pios_config.h create mode 100644 flight/OSD/System/inc/pios_config_posix.h create mode 100644 flight/OSD/System/inc/pios_usb_board_data.h create mode 100644 flight/OSD/System/inc/pios_usb_hid_desc.h create mode 100644 flight/OSD/System/inc/pios_usssb.h create mode 100644 flight/OSD/System/inc/taskmonitor.h create mode 100644 flight/OSD/System/inc/usb_conf.h create mode 100644 flight/OSD/System/inc/watchdog.h create mode 100644 flight/OSD/System/inc/xconvert.h create mode 100644 flight/OSD/System/osd.c create mode 100644 flight/OSD/System/pios_board.c create mode 100644 flight/OSD/System/pios_usb_board_data.c create mode 100644 flight/OSD/System/pios_usb_hid_desc.c create mode 100644 flight/OSD/System/taskmonitor.c create mode 100644 flight/OSD/System/watchdog.c create mode 100644 flight/PiOS/Boards/STM32F4xx_OSD.h create mode 100644 flight/PiOS/Common/pios_video.c create mode 100644 flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/osd/system_stm32f4xx.c rename flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/{ => revolution}/system_stm32f4xx.c (100%) create mode 100644 flight/PiOS/inc/pios_video.h create mode 100644 make/boards/osd/board-info.mk diff --git a/flight/Modules/Osd/osdgen/inc/osdgen.h b/flight/Modules/Osd/osdgen/inc/osdgen.h new file mode 100644 index 000000000..12b570e35 --- /dev/null +++ b/flight/Modules/Osd/osdgen/inc/osdgen.h @@ -0,0 +1,199 @@ +/* + * osdgen.h + * + * Created on: 2.10.2011 + * Author: Samba + */ + +#ifndef OSDGEN_H_ +#define OSDGEN_H_ + +#include "openpilot.h" + +#include "xconvert.h" +#include "oem6x8.h" + +int32_t osdgenInitialize(void); + + +// Size of an array (num items.) +#define SIZEOF_ARRAY(x) (sizeof(x) / sizeof((x)[0])) + + +#define DISP_HEIGHT GRAPHICS_HEIGHT_REAL +#define DISP_WIDTH GRAPHICS_WIDTH_REAL +#define HUD_VSCALE_FLAG_CLEAR 1 +#define HUD_VSCALE_FLAG_NO_NEGATIVE 2 + +// Macros for computing addresses and bit positions. +// NOTE: /16 in y is because we are addressing by word not byte. +#define CALC_BUFF_ADDR(x, y) (((x) / 16) + ((y) * (DISP_WIDTH / 16))) +#define CALC_BIT_IN_WORD(x) ((x) & 15) +#define DEBUG_DELAY +// Macro for writing a word with a mode (NAND = clear, OR = set, XOR = toggle) +// at a given position +#define WRITE_WORD_MODE(buff, addr, mask, mode) \ + switch(mode) { \ + case 0: buff[addr] &= ~mask; break; \ + case 1: buff[addr] |= mask; break; \ + case 2: buff[addr] ^= mask; break; } + +#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; } + +// Horizontal line calculations. +// Edge cases. +#define COMPUTE_HLINE_EDGE_L_MASK(b) ((1 << (16 - (b))) - 1) +#define COMPUTE_HLINE_EDGE_R_MASK(b) (~((1 << (15 - (b))) - 1)) +// This computes an island mask. +#define COMPUTE_HLINE_ISLAND_MASK(b0, b1) (COMPUTE_HLINE_EDGE_L_MASK(b0) ^ COMPUTE_HLINE_EDGE_L_MASK(b1)); + +// Macro for initializing stroke/fill modes. Add new modes here +// if necessary. +#define SETUP_STROKE_FILL(stroke, fill, mode) \ + stroke = 0; fill = 0; \ + if(mode == 0) { stroke = 0; fill = 1; } \ + if(mode == 1) { stroke = 1; fill = 0; } \ + +// Line endcaps (for horizontal and vertical lines.) +#define ENDCAP_NONE 0 +#define ENDCAP_ROUND 1 +#define ENDCAP_FLAT 2 + +#define DRAW_ENDCAP_HLINE(e, x, y, s, f, l) \ + if((e) == ENDCAP_ROUND) /* single pixel endcap */ \ + { write_pixel_lm(x, y, f, l); } \ + else if((e) == ENDCAP_FLAT) /* flat endcap: FIXME, quicker to draw a vertical line(?) */ \ + { write_pixel_lm(x, y - 1, s, l); write_pixel_lm(x, y, s, l); write_pixel_lm(x, y + 1, s, l); } + +#define DRAW_ENDCAP_VLINE(e, x, y, s, f, l) \ + if((e) == ENDCAP_ROUND) /* single pixel endcap */ \ + { write_pixel_lm(x, y, f, l); } \ + else if((e) == ENDCAP_FLAT) /* flat endcap: FIXME, quicker to draw a horizontal line(?) */ \ + { write_pixel_lm(x - 1, y, s, l); write_pixel_lm(x, y, s, l); write_pixel_lm(x + 1, y, s, l); } + +// Macros for writing pixels in a midpoint circle algorithm. +#define CIRCLE_PLOT_8(buff, cx, cy, x, y, mode) \ + CIRCLE_PLOT_4(buff, cx, cy, x, y, mode); \ + if((x) != (y)) CIRCLE_PLOT_4(buff, cx, cy, y, x, mode); + +#define CIRCLE_PLOT_4(buff, cx, cy, x, y, mode) \ + write_pixel(buff, (cx) + (x), (cy) + (y), mode); \ + write_pixel(buff, (cx) - (x), (cy) + (y), mode); \ + write_pixel(buff, (cx) + (x), (cy) - (y), mode); \ + write_pixel(buff, (cx) - (x), (cy) - (y), mode); + + + +// Font flags. +#define FONT_BOLD 1 // bold text (no outline) +#define FONT_INVERT 2 // invert: border white, inside black + +// Text alignments. +#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 + +// Text dimension structures. +struct FontDimensions +{ + int width, height; +}; + + +// Max/Min macros. +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX3(a, b, c) MAX(a, MAX(b, c)) +#define MIN3(a, b, c) MIN(a, MIN(b, c)) + +// Check if coordinates are valid. If not, return. +#define CHECK_COORDS(x, y) if(x < 0 || x >= DISP_WIDTH || y < 0 || y >= DISP_HEIGHT) return; +#define CHECK_COORD_X(x) if(x < 0 || x >= DISP_WIDTH) return; +#define CHECK_COORD_Y(y) if(y < 0 || y >= DISP_HEIGHT) return; + +// Clip coordinates out of range. +#define CLIP_COORD_X(x) { x = MAX(0, MIN(x, DISP_WIDTH)); } +#define CLIP_COORD_Y(y) { y = MAX(0, MIN(y, DISP_HEIGHT)); } +#define CLIP_COORDS(x, y) { CLIP_COORD_X(x); CLIP_COORD_Y(y); } + +// Macro to swap two variables using XOR swap. +#define SWAP(a, b) { a ^= b; b ^= a; a ^= b; } + + +// Line triggering +#define LAST_LINE 312 //625/2 //PAL +#define UPDATE_LINE GRAPHICS_LINE+GRAPHICS_HEIGHT_REAL+1 +//#define LAST_LINE 525/2 //NTSC + +// Global vars + +#define DELAY_1_NOP() asm("nop\r\n") +#define DELAY_2_NOP() asm("nop\r\nnop\r\n") +#define DELAY_3_NOP() asm("nop\r\nnop\r\nnop\r\n") +#define DELAY_4_NOP() asm("nop\r\nnop\r\nnop\r\nnop\r\n") +#define DELAY_5_NOP() asm("nop\r\nnop\r\nnop\r\nnop\r\nnop\r\n") +#define DELAY_6_NOP() asm("nop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\n") +#define DELAY_7_NOP() asm("nop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\n") +#define DELAY_8_NOP() asm("nop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\n") +#define DELAY_9_NOP() asm("nop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\n") +#define DELAY_10_NOP() asm("nop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\nnop\r\n") + + + +uint8_t getCharData(uint16_t charPos); +void introText(); + +void clearGraphics(); +uint8_t validPos(uint16_t x, uint16_t y); +void setPixel(uint16_t x, uint16_t y, uint8_t state); +void drawCircle(uint16_t x0, uint16_t y0, uint16_t radius); +void swap(uint16_t* a, uint16_t* b); +void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); +void drawBox(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); +void drawArrow(uint16_t x, uint16_t y, uint16_t angle, uint16_t size); +void drawAttitude(uint16_t x, uint16_t y, int16_t pitch, int16_t roll, uint16_t size); +void introGraphics(); +void updateGraphics(); +void drawGraphicsLine(); + +void write_char16(char ch, unsigned int x, unsigned int y); +void write_pixel(uint16_t *buff, unsigned int x, unsigned int y, int mode); +void write_pixel_lm(unsigned int x, unsigned int y, int mmode, int lmode); +void write_hline(uint16_t *buff, unsigned int x0, unsigned int x1, unsigned int y, int mode); +void write_hline_lm(unsigned int x0, unsigned int x1, unsigned int y, int lmode, int mmode); +void write_hline_outlined(unsigned int x0, unsigned int x1, unsigned int y, int endcap0, int endcap1, int mode, int mmode); +void write_vline(uint16_t *buff, unsigned int x, unsigned int y0, unsigned int y1, int mode); +void write_vline_lm(unsigned int x, unsigned int y0, unsigned int y1, int lmode, int mmode); +void write_vline_outlined(unsigned int x, unsigned int y0, unsigned int y1, int endcap0, int endcap1, int mode, int mmode); +void write_filled_rectangle(uint16_t *buff, unsigned int x, unsigned int y, unsigned int width, unsigned int height, int mode); +void write_filled_rectangle_lm(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int lmode, int mmode); +void write_rectangle_outlined(unsigned int x, unsigned int y, int width, int height, int mode, int mmode); +void write_circle(uint16_t *buff, unsigned int cx, unsigned int cy, unsigned int r, unsigned int dashp, int mode); +void write_circle_outlined(unsigned int cx, unsigned int cy, unsigned int r, unsigned int dashp, int bmode, int mode, int mmode); +void write_circle_filled(uint16_t *buff, unsigned int cx, unsigned int cy, unsigned int r, int mode); +void write_line(uint16_t *buff, unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, int mode); +void write_line_lm(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, int mmode, int lmode); +void write_line_outlined(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, int endcap0, int endcap1, int mode, int mmode); +void write_word_misaligned(uint16_t *buff, uint16_t word, unsigned int addr, unsigned int xoff, int mode); +void write_word_misaligned_NAND(uint16_t *buff, uint16_t word, unsigned int addr, unsigned int xoff); +void write_word_misaligned_OR(uint16_t *buff, uint16_t word, unsigned int addr, unsigned int xoff); +void write_word_misaligned_lm(uint16_t wordl, uint16_t wordm, unsigned int addr, unsigned int xoff, int lmode, int mmode); +//int fetch_font_info(char ch, int font, struct FontEntry *font_info, char *lookup); +void write_char(char ch, unsigned int x, unsigned int y, int flags, int font); +//void calc_text_dimensions(char *str, struct FontEntry font, int xs, int ys, struct FontDimensions *dim); +void write_string(char *str, unsigned int x, unsigned int y, unsigned int xs, unsigned int ys, int va, int ha, int flags, int font); +void write_string_formatted(char *str, unsigned int x, unsigned int y, unsigned int xs, unsigned int ys, int va, int ha, int flags); + +void setAttitudeOsd(int16_t pitch, int16_t roll, int16_t yaw); +void setGpsOsd(uint8_t status, int32_t lat, int32_t lon, float alt, float spd); +void updateOnceEveryFrame(); + + + + +#endif /* OSDGEN_H_ */ diff --git a/flight/Modules/Osd/osdgen/osdgen.c b/flight/Modules/Osd/osdgen/osdgen.c new file mode 100644 index 000000000..de1001732 --- /dev/null +++ b/flight/Modules/Osd/osdgen/osdgen.c @@ -0,0 +1,2321 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotModules OpenPilot Modules + * @{ + * @addtogroup OSDGENModule osdgen Module + * @brief Process OSD information + * @{ + * + * @file osdgen.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief OSD gen module, handles OSD draw + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +// **************** + +#include "openpilot.h" +#include "osdgen.h" +#include "attitudeactual.h" +#include "gpsposition.h" +#include "homelocation.h" +#include "gpstime.h" +#include "gpssatellites.h" + +#include "fonts.h" +#include "font12x18.h" + +static uint16_t angleA=0; +static int16_t angleB=90; +static int16_t angleC=0; +static int16_t sum=2; + +static int16_t m_pitch=0; +static int16_t m_roll=0; +static int16_t m_yaw=0; +static int16_t m_batt=0; +static int16_t m_alt=0; + +static uint8_t m_gpsStatus=0; +static int32_t m_gpsLat=0; +static int32_t m_gpsLon=0; +static float m_gpsAlt=0; +static float m_gpsSpd=0; + +extern uint16_t *draw_buffer_level; +extern uint16_t *draw_buffer_mask; +extern uint16_t *disp_buffer_level; +extern uint16_t *disp_buffer_mask; + + +TTime time; + +// **************** +// Private functions + +static void osdgenTask(void *parameters); + +// **************** +// Private constants +xSemaphoreHandle osdSemaphore; + +#define STACK_SIZE_BYTES 1024 + +#define TASK_PRIORITY (tskIDLE_PRIORITY + 4) +#define UPDATE_PERIOD 100 + +// **************** +// Private variables + +static xTaskHandle osdgenTaskHandle; + + + + +// simple routines +/* +uint8_t getCharData(uint16_t charPos) { + if (charPos >= CHAR_ARRAY_OFFSET && charPos < CHAR_ARRAY_MAX) { + return (oem6x8[charPos - CHAR_ARRAY_OFFSET]); + } + else { + return 0x00; + } +}*/ + +// prints text into draw_buffer_level, 8x2 +/*uint8_t printTextFB(uint16_t x, uint16_t y, const char* str) { + uint8_t length = strlen(str); + if (x + length >= TEXT_LINE_MAX_CHARS) { + length = TEXT_LINE_MAX_CHARS; + } + for(uint8_t i = 0; i < TEXT_CHAR_HEIGHT; i++) + { + uint8_t c=0; + uint16_t charPos; + for(int j=0; j DISP_WIDTH) + return; + // Load data pointer. + row = ch * 18; + row_temp = row; + addr_temp = addr; + xshift = 16 - 16; + // We can write mask words easily. + for(yy = y; yy < y + 18; yy++) + { + write_word_misaligned_OR(draw_buffer_mask, font_mask16x18[row] << xshift, addr, wbit); + addr += DISP_WIDTH / 16; + row++; + } + // Level bits are more complicated. We need to set or clear + // level bits, but only where the mask bit is set; otherwise, + // we need to leave them alone. To do this, for each word, we + // construct an AND mask and an OR mask, and apply each individually. + row = row_temp; + addr = addr_temp; + for(yy = y; yy < y + 18; yy++) + { + level_bits = font_frame16x18[row]; + //if(!(flags & FONT_INVERT)) // data is normally inverted + level_bits = ~level_bits; + or_mask = font_mask16x18[row] << xshift; + and_mask = (font_mask16x18[row] & level_bits) << xshift; + write_word_misaligned_OR(draw_buffer_level, or_mask, addr, wbit); + // If we're not bold write the AND mask. + //if(!(flags & FONT_BOLD)) + write_word_misaligned_NAND(draw_buffer_level, and_mask, addr, wbit); + addr += DISP_WIDTH / 16; + row++; + } + } +} + + + +static unsigned short logo_bits[] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0700, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3fc0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff0, 0x0001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xfff0, 0x0007, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xfff8, 0x000f, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xfff8, 0x001f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xfff8, 0x007f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xfffc, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffc, + 0x01ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffc, 0x07ff, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffe, 0x07ff, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffe, 0x1fff, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xfffe, 0x3fff, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xfffe, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xffff, 0xffff, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xffff, 0xffff, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xffff, 0xfff0, 0x000f, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x7fff, + 0xffc0, 0x001f, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff, 0xff80, + 0x003f, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff, 0xfe00, 0x00ff, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff, 0xf800, 0x00ff, 0x0000, + 0x0000, 0x0000, 0x0003, 0xc000, 0x3fff, 0xf000, 0x03ff, 0x0000, 0x0008, + 0xc000, 0x001f, 0xc000, 0x1fff, 0xe000, 0x07ff, 0x0000, 0x00f8, 0xf800, + 0x003f, 0xc000, 0x1fff, 0x8000, 0x0fff, 0x0000, 0x07e0, 0xfe00, 0x00ff, + 0xe000, 0x1fff, 0x0000, 0x3fff, 0x0000, 0xbfc0, 0xffc0, 0x00ff, 0xe000, + 0x1fff, 0x0000, 0x7ffc, 0x0000, 0xff00, 0xfff7, 0x007f, 0xe000, 0x0fff, + 0x0000, 0xfff0, 0x0000, 0xfe00, 0xffff, 0x007f, 0xf000, 0x0fff, 0x0000, + 0xffe0, 0x0001, 0xf800, 0xffff, 0xc07f, 0xf000, 0x0fff, 0x0000, 0xffc0, + 0x0001, 0xf000, 0xffff, 0xc07f, 0xf003, 0x0fff, 0x0000, 0xff00, 0x0003, + 0xc000, 0xffff, 0xe03f, 0xf00f, 0x0fff, 0x0000, 0xfe00, 0x0007, 0x8000, + 0xffff, 0xe03f, 0xf83f, 0x07ff, 0x0000, 0xf800, 0x0007, 0x0000, 0xffff, + 0xe03f, 0xf87f, 0x07ff, 0x0000, 0xf000, 0x000f, 0x0000, 0xfffc, 0xf03f, + 0xe1ff, 0x03ff, 0x0000, 0xf000, 0x000f, 0x0000, 0xfffc, 0xf07f, 0x87ff, + 0x03ff, 0x0000, 0xf000, 0x0007, 0x0000, 0xfffc, 0xf0ff, 0x1fff, 0x03ff, + 0x0000, 0xe000, 0x000f, 0x0000, 0xfff8, 0xf0ff, 0x3fff, 0x03f8, 0x0000, + 0xe000, 0x001f, 0x0000, 0xfff0, 0xf07f, 0xffff, 0x01e0, 0x0000, 0xe000, + 0x000f, 0x0000, 0xfff0, 0xf87f, 0xffff, 0x03c7, 0x0000, 0xe000, 0x000f, + 0x0000, 0xfff0, 0xf87f, 0xffff, 0x010f, 0x0000, 0xe000, 0x001f, 0x0000, + 0xffe0, 0xf87f, 0xffff, 0x003f, 0x0000, 0xe000, 0x000f, 0x0000, 0xffe0, + 0xfc7f, 0xffff, 0x00ff, 0x0000, 0xe000, 0x000f, 0x0000, 0xffc0, 0xfc0f, + 0xffff, 0x01ff, 0x0000, 0xf000, 0x000f, 0x0000, 0xffc0, 0xfc07, 0xffff, + 0x0fff, 0x0000, 0xf000, 0x001f, 0x0000, 0xffc0, 0xfc07, 0xffff, 0x3fff, + 0x0000, 0xf000, 0x000f, 0x0000, 0xff80, 0xfe07, 0xffff, 0xffff, 0x0000, + 0xf000, 0x000f, 0x0000, 0xff80, 0xfc03, 0xffff, 0xffff, 0x0001, 0xf000, + 0x000f, 0x0000, 0xff00, 0xfe03, 0xffff, 0xffff, 0x0007, 0xf000, 0x001f, + 0x0000, 0xff00, 0xfe03, 0xffff, 0xffff, 0x001f, 0xf000, 0x000f, 0x0000, + 0xfc00, 0xfe01, 0xffff, 0xffff, 0x007f, 0xf000, 0x000f, 0x0000, 0xf000, + 0xff03, 0xffff, 0xffff, 0x01ff, 0xf000, 0x000f, 0x0000, 0x8000, 0xff00, + 0xffff, 0xffff, 0x03ff, 0xf000, 0x001f, 0x0000, 0x0000, 0xff00, 0xffff, + 0xffff, 0x0fff, 0xf000, 0x000f, 0x0000, 0x0000, 0xff80, 0xffff, 0xffff, + 0x3fff, 0xf000, 0x000f, 0x0000, 0x0000, 0xfc00, 0xffff, 0xffff, 0xffff, + 0xf800, 0x000f, 0x0000, 0x0000, 0xf000, 0xffff, 0xffff, 0xffff, 0xf003, + 0x001f, 0x0000, 0x0000, 0x8000, 0xffff, 0xffff, 0xffff, 0xf007, 0x000f, + 0x0000, 0x0000, 0x0000, 0xfffc, 0xffff, 0xffff, 0xf83f, 0x000f, 0x0000, + 0x0000, 0x0000, 0xfff0, 0xffff, 0xffff, 0xf87f, 0x000f, 0x0000, 0x0000, + 0x0000, 0xff00, 0xffff, 0xffff, 0xffff, 0x001f, 0x0000, 0x0000, 0x0000, + 0xf800, 0xffff, 0xffff, 0xffff, 0x000f, 0x0000, 0x0000, 0x0000, 0xe000, + 0xffff, 0xffff, 0xffff, 0x000f, 0x0000, 0x0000, 0x0000, 0x8000, 0xfffe, + 0xffff, 0xffff, 0x000f, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xffff, + 0xffff, 0x001f, 0x0000, 0x0000, 0x0000, 0x002e, 0xffe0, 0xffff, 0xffff, + 0x000f, 0x0000, 0x0000, 0x0000, 0x00fc, 0xff00, 0xffff, 0xffff, 0x000f, + 0x0000, 0x0000, 0x0000, 0x07fe, 0xf800, 0xffff, 0xffff, 0x000f, 0x0000, + 0x0000, 0x0000, 0x5ffe, 0xc000, 0xffff, 0xffff, 0x001f, 0x0000, 0x0000, + 0x0000, 0xffff, 0x0001, 0xffff, 0xffff, 0x000f, 0x0000, 0x0000, 0x0000, + 0xffff, 0x0001, 0xfff8, 0xffff, 0x000f, 0x0000, 0x0000, 0x0000, 0xffff, + 0x0001, 0xffc0, 0xffff, 0x000f, 0x0000, 0x0000, 0x8000, 0xffff, 0x0001, + 0xfe00, 0xffff, 0x000f, 0x0000, 0x0000, 0x8000, 0xffff, 0x0000, 0xf800, + 0xffff, 0x0007, 0x0000, 0x0000, 0x8000, 0xffff, 0x0000, 0x8000, 0xffff, + 0x0007, 0x0000, 0x0000, 0x8000, 0xffff, 0x0000, 0x0000, 0xfffe, 0x0003, + 0x0000, 0x0000, 0xc000, 0x7fff, 0x0000, 0x0000, 0xfff0, 0x0003, 0x0000, + 0x0000, 0xc000, 0x7fff, 0x0000, 0x0000, 0xff80, 0x0001, 0x0000, 0x0000, + 0xc000, 0x7fff, 0x0000, 0x0000, 0xfe00, 0x0000, 0x0000, 0x0000, 0xe000, + 0x7fff, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0xe000, 0x7fff, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xe000, 0x3fff, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xf000, 0x3fff, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xf000, 0x3fff, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf000, 0x1fff, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xc000, 0x1fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8000, 0x1fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0ffe, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0ff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fe0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fc0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0400, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8800, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9c00, 0x0001, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xc800, 0x0001, 0x0060, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8000, 0x0001, 0x0060, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xc000, 0x0001, 0x07f0, 0xf800, 0xf07f, 0xf07f, 0xf07f, 0xf07f, + 0x8c7f, 0xffc1, 0x07f1, 0xf800, 0xf87f, 0xf87f, 0xf8ff, 0xf8ff, 0xccff, + 0xffc1, 0x00e3, 0x1c00, 0x1ce0, 0x1ce0, 0x1ce0, 0x3ce0, 0x8ce0, 0x00e1, + 0x0067, 0x0c00, 0x0cc0, 0x0cc0, 0x1cc0, 0x1dc0, 0xcdc0, 0x0061, 0x0066, + 0x0c00, 0x0cc0, 0xfdc0, 0x0dff, 0x0dc0, 0x8dc0, 0x0071, 0x0066, 0x0c00, + 0x0cc0, 0xfdc0, 0x0dff, 0x0dc0, 0xcdc0, 0x0071, 0x0066, 0x1c00, 0x1cc0, + 0x1cc0, 0x0c00, 0x0dc0, 0x8dc0, 0x0061, 0x00e6, 0x1c00, 0x0ce8, 0x5ce8, + 0x1c55, 0x1dc0, 0xcce8, 0x20e1, 0x00c7, 0xf800, 0xffff, 0xf8ff, 0x0c7f, + 0xffc0, 0x8cff, 0xffe7, 0x07c3, 0xf000, 0xffff, 0xf07f, 0x0c7f, 0xffc0, + 0x0c7f, 0xff87, 0x0781, 0x0000, 0x0c00, 0x0000, 0x0c00, 0xdf40, 0x000d, + 0x0000, 0x0000, 0x0000, 0x0c00, 0x0000, 0x0000, 0x0c00, 0x0000, 0x0000, + 0x0000, 0x0000, 0x1c00, 0x0000, 0x0000, 0x0c00, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0c00, 0x0000, 0x0000, 0x1c00, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; + + +uint16_t mirror(uint16_t source) +{ + int result = ((source & 0x8000) >> 15) | ((source & 0x4000) >> 13) | + ((source & 0x2000) >> 11) | ((source & 0x1000) >> 9) | + ((source & 0x0800) >> 7) | ((source & 0x0400) >> 5) | + ((source & 0x0200) >> 3) | ((source & 0x0100) >> 1) | + ((source & 0x0080) << 1) | ((source & 0x0040) << 3) | + ((source & 0x0020) << 5) | ((source & 0x0010) << 7) | + ((source & 0x0008) << 9) | ((source & 0x0004) << 11) | + ((source & 0x0002) << 13) | ((source & 0x0001) << 15); + + return result; +} + +void clearGraphics() { + for (uint16_t x = 0; x < GRAPHICS_WIDTH*GRAPHICS_HEIGHT; ++x) { + draw_buffer_level[x] = 0x0000; + draw_buffer_mask[x] = 0x0000; + } +} + +void copyimage(uint16_t offsetx, uint16_t offsety) { + offsetx=offsetx/16; + int i=0; + for (uint16_t y = offsety; y < (128+offsety); y++) { + for (uint16_t x = offsetx; x < (8+offsetx); x++) { + draw_buffer_level[y*GRAPHICS_WIDTH+x] = draw_buffer_mask[y*GRAPHICS_WIDTH+x] = mirror(logo_bits[(y-offsety)*8+(x-offsetx)]); + i+=2; + } + } +} + +uint8_t validPos(uint16_t x, uint16_t y) { + if (x >= GRAPHICS_WIDTH_REAL || y >= GRAPHICS_HEIGHT) { + return 0; + } + return 1; +} + +void setPixel(uint16_t x, uint16_t y, uint8_t state) { + if (!validPos(x, y)) { + return; + } + uint8_t bitPos = 15-(x%16); + uint16_t tempf = draw_buffer_level[y*GRAPHICS_WIDTH+x/16]; + uint16_t tempm = draw_buffer_mask[y*GRAPHICS_WIDTH+x/16]; + if (state == 0) { + tempf &= ~(1<= 0) + { + y--; + ddF_y += 2; + f += ddF_y; + } + x++; + ddF_x += 2; + f += ddF_x; + setPixel(x0 + x, y0 + y,1); + setPixel(x0 - x, y0 + y,1); + setPixel(x0 + x, y0 - y,1); + setPixel(x0 - x, y0 - y,1); + setPixel(x0 + y, y0 + x,1); + setPixel(x0 - y, y0 + x,1); + setPixel(x0 + y, y0 - x,1); + setPixel(x0 - y, y0 - x,1); + } +} + +void swap(uint16_t* a, uint16_t* b) { + uint16_t temp = *a; + *a = *b; + *b = temp; +} + + +void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { + uint8_t steep = abs(y1 - y0) > abs(x1 - x0); + if (steep) { + swap(&x0, &y0); + swap(&x1, &y1); + } + if (x0 > x1) { + swap(&x0, &x1); + swap(&y0, &y1); + } + int16_t deltax = x1 - x0; + int16_t deltay = abs(y1 - y0); + int16_t error = deltax / 2; + int16_t ystep; + int16_t y = y0; + if (y0 < y1) { + ystep = 1; + } + else { + ystep = -1; + } + for (uint16_t x = x0; x <= x1; ++x) { + if (steep) { + setPixel(y, x, 1); + } + else { + setPixel(x, y, 1); + } + error = error - deltay; + if (error < 0) { + y = y + ystep; + error = error + deltax; + } + } +} + +const static int8_t sinData[91] = { + 0, 2, 3, 5, 7, 9, 10, 12, 14, 16, 17, 19, 21, 22, 24, 26, 28, 29, 31, 33, + 34, 36, 37, 39, 41, 42, 44, 45, 47, 48, 50, 52, 53, 54, 56, 57, 59, 60, 62, + 63, 64, 66, 67, 68, 69, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 87, 88, 89, 90, 91, 91, 92, 93, 93, 94, 95, 95, 96, 96, 97, 97, + 97, 98, 98, 98, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100}; + +static int8_t mySin(uint16_t angle) { + uint16_t pos = 0; + pos = angle % 360; + int8_t mult = 1; + // 180-359 is same as 0-179 but negative. + if (pos >= 180) { + pos = pos - 180; + mult = -1; + } + // 0-89 is equal to 90-179 except backwards. + if (pos >= 90) { + pos = 180 - pos; + } + return mult * (int8_t)(sinData[pos]); +} + +static int8_t myCos(uint16_t angle) { + return mySin(angle + 90); +} + +//fill the draw_buffer_level with junk, used for debugging +/*void fillFrameBuffer(void) +{ + uint16_t i; + uint16_t j; + for(i = 0; i<(BUFFER_VERT_SIZE); i++) + { + for(j = 0; j<(BUFFER_LINE_LENGTH); j++) + { + if(j < LEFT_MARGIN) + { + draw_buffer_level[i*GRAPHICS_WIDTH+j] = 0; + } else if (j > 32){ + draw_buffer_level[i*GRAPHICS_WIDTH+j] = 0; + } else { + draw_buffer_level[i*GRAPHICS_WIDTH+j] = i*j; + } + } + } +}*/ + + +/// Draws four points relative to the given center point. +/// +/// \li centerX + X, centerY + Y +/// \li centerX + X, centerY - Y +/// \li centerX - X, centerY + Y +/// \li centerX - X, centerY - Y +/// +/// \param centerX the x coordinate of the center point +/// \param centerY the y coordinate of the center point +/// \param deltaX the difference between the centerX coordinate and each pixel drawn +/// \param deltaY the difference between the centerY coordinate and each pixel drawn +/// \param color the color to draw the pixels with. +void plotFourQuadrants(int32_t centerX, int32_t centerY, int32_t deltaX, int32_t deltaY) +{ + setPixel(centerX + deltaX, centerY + deltaY,1); // Ist Quadrant + setPixel(centerX - deltaX, centerY + deltaY,1); // IInd Quadrant + setPixel(centerX - deltaX, centerY - deltaY,1); // IIIrd Quadrant + setPixel(centerX + deltaX, centerY - deltaY,1); // IVth Quadrant +} + +/// Implements the midpoint ellipse drawing algorithm which is a bresenham +/// style DDF. +/// +/// \param centerX the x coordinate of the center of the ellipse +/// \param centerY the y coordinate of the center of the ellipse +/// \param horizontalRadius the horizontal radius of the ellipse +/// \param verticalRadius the vertical radius of the ellipse +/// \param color the color of the ellipse border +void ellipse(int centerX, int centerY, int horizontalRadius, int verticalRadius) +{ + int64_t doubleHorizontalRadius = horizontalRadius * horizontalRadius; + int64_t doubleVerticalRadius = verticalRadius * verticalRadius; + + int64_t error = doubleVerticalRadius - doubleHorizontalRadius * verticalRadius + (doubleVerticalRadius >> 2); + + int x = 0; + int y = verticalRadius; + int deltaX = 0; + int deltaY = (doubleHorizontalRadius << 1) * y; + + plotFourQuadrants(centerX, centerY, x, y); + + while(deltaY >= deltaX) + { + x++; + deltaX += (doubleVerticalRadius << 1); + + error += deltaX + doubleVerticalRadius; + + if(error >= 0) + { + y--; + deltaY -= (doubleHorizontalRadius << 1); + + error -= deltaY; + } + plotFourQuadrants(centerX, centerY, x, y); + } + + error = (int64_t)(doubleVerticalRadius * (x + 1 / 2.0) * (x + 1 / 2.0) + doubleHorizontalRadius * (y - 1) * (y - 1) - doubleHorizontalRadius * doubleVerticalRadius); + + while (y>=0) + { + error += doubleHorizontalRadius; + y--; + deltaY -= (doubleHorizontalRadius<<1); + error -= deltaY; + + if(error <= 0) + { + x++; + deltaX += (doubleVerticalRadius << 1); + error += deltaX; + } + + plotFourQuadrants(centerX, centerY, x, y); + } +} + + +void drawArrow(uint16_t x, uint16_t y, uint16_t angle, uint16_t size) +{ + int16_t a = myCos(angle); + int16_t b = mySin(angle); + a = (a * (size/2)) / 100; + b = (b * (size/2)) / 100; + drawLine((x)-1 - b, (y)-1 + a, (x)-1 + b, (y)-1 - a); //Direction line + //drawLine((GRAPHICS_SIZE/2)-1 + a/2, (GRAPHICS_SIZE/2)-1 + b/2, (GRAPHICS_SIZE/2)-1 - a/2, (GRAPHICS_SIZE/2)-1 - b/2); //Arrow bottom line + drawLine((x)-1 + b, (y)-1 - a, (x)-1 - a/2, (y)-1 - b/2); // Arrow "wings" + drawLine((x)-1 + b, (y)-1 - a, (x)-1 + a/2, (y)-1 + b/2); +} + +void drawBox(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) +{ + drawLine(x1, y1, x2, y1); //top + drawLine(x1, y1, x1, y2); //left + drawLine(x2, y1, x2, y2); //right + drawLine(x1, y2, x2, y2); //bottom +} + +// simple routines + +// SUPEROSD routines, modified + +/** + * write_pixel: Write a pixel at an x,y position to a given surface. + * + * @param buff pointer to buffer to write in + * @param x x coordinate + * @param y y coordinate + * @param mode 0 = clear bit, 1 = set bit, 2 = toggle bit + */ +void write_pixel(uint16_t *buff, unsigned int x, unsigned int y, int mode) +{ + CHECK_COORDS(x, y); + // Determine the bit in the word to be set and the word + // index to set it in. + int bitnum = CALC_BIT_IN_WORD(x); + int wordnum = CALC_BUFF_ADDR(x, y); + // Apply a mask. + uint16_t mask = 1 << (15 - bitnum); + WRITE_WORD_MODE(buff, wordnum, mask, mode); +} + +/** + * write_pixel_lm: write the pixel on both surfaces (level and mask.) + * Uses current draw buffer. + * + * @param x x coordinate + * @param y y coordinate + * @param mmode 0 = clear, 1 = set, 2 = toggle + * @param lmode 0 = black, 1 = white, 2 = toggle + */ +void write_pixel_lm(unsigned int x, unsigned int y, int mmode, int lmode) +{ + CHECK_COORDS(x, y); + // Determine the bit in the word to be set and the word + // index to set it in. + int bitnum = CALC_BIT_IN_WORD(x); + int wordnum = CALC_BUFF_ADDR(x, y); + // Apply the masks. + uint16_t mask = 1 << (15 - bitnum); + WRITE_WORD_MODE(draw_buffer_mask, wordnum, mask, mmode); + WRITE_WORD_MODE(draw_buffer_level, wordnum, mask, lmode); +} + + +/** + * write_hline: optimised horizontal line writing algorithm + * + * @param buff pointer to buffer to write in + * @param x0 x0 coordinate + * @param x1 x1 coordinate + * @param y y coordinate + * @param mode 0 = clear, 1 = set, 2 = toggle + */ +void write_hline(uint16_t *buff, unsigned int x0, unsigned int x1, unsigned int y, int mode) +{ + CLIP_COORDS(x0, y); + CLIP_COORDS(x1, y); + if(x0 > x1) + { + SWAP(x0, x1); + } + if(x0 == x1) return; + /* This is an optimised algorithm for writing horizontal lines. + * We begin by finding the addresses of the x0 and x1 points. */ + int addr0 = CALC_BUFF_ADDR(x0, y); + int addr1 = CALC_BUFF_ADDR(x1, y); + int addr0_bit = CALC_BIT_IN_WORD(x0); + int addr1_bit = CALC_BIT_IN_WORD(x1); + int mask, mask_l, mask_r, i; + /* If the addresses are equal, we only need to write one word + * which is an island. */ + if(addr0 == addr1) + { + mask = COMPUTE_HLINE_ISLAND_MASK(addr0_bit, addr1_bit); + WRITE_WORD_MODE(buff, addr0, mask, mode); + } + /* Otherwise we need to write the edges and then the middle. */ + else + { + mask_l = COMPUTE_HLINE_EDGE_L_MASK(addr0_bit); + mask_r = COMPUTE_HLINE_EDGE_R_MASK(addr1_bit); + WRITE_WORD_MODE(buff, addr0, mask_l, mode); + WRITE_WORD_MODE(buff, addr1, mask_r, mode); + // Now write 0xffff words from start+1 to end-1. + for(i = addr0 + 1; i <= addr1 - 1; i++) + { + WRITE_WORD_MODE(buff, i, 0xffff, mode); + } + } +} + +/** + * write_hline_lm: write both level and mask buffers. + * + * @param x0 x0 coordinate + * @param x1 x1 coordinate + * @param y y coordinate + * @param lmode 0 = clear, 1 = set, 2 = toggle + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_hline_lm(unsigned int x0, unsigned int x1, unsigned int y, int lmode, int mmode) +{ + // TODO: an optimisation would compute the masks and apply to + // both buffers simultaneously. + write_hline(draw_buffer_level, x0, x1, y, lmode); + write_hline(draw_buffer_mask, x0, x1, y, mmode); +} + +/** + * write_hline_outlined: outlined horizontal line with varying endcaps + * Always uses draw buffer. + * + * @param x0 x0 coordinate + * @param x1 x1 coordinate + * @param y y coordinate + * @param endcap0 0 = none, 1 = single pixel, 2 = full cap + * @param endcap1 0 = none, 1 = single pixel, 2 = full cap + * @param mode 0 = black outline, white body, 1 = white outline, black body + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_hline_outlined(unsigned int x0, unsigned int x1, unsigned int y, int endcap0, int endcap1, int mode, int mmode) +{ + int stroke, fill; + SETUP_STROKE_FILL(stroke, fill, mode) + if(x0 > x1) + { + SWAP(x0, x1); + } + // Draw the main body of the line. + write_hline_lm(x0 + 1, x1 - 1, y - 1, stroke, mmode); + write_hline_lm(x0 + 1, x1 - 1, y + 1, stroke, mmode); + write_hline_lm(x0 + 1, x1 - 1, y, fill, mmode); + // Draw the endcaps, if any. + DRAW_ENDCAP_HLINE(endcap0, x0, y, stroke, fill, mmode); + DRAW_ENDCAP_HLINE(endcap1, x1, y, stroke, fill, mmode); +} + +/** + * write_vline: optimised vertical line writing algorithm + * + * @param buff pointer to buffer to write in + * @param x x coordinate + * @param y0 y0 coordinate + * @param y1 y1 coordinate + * @param mode 0 = clear, 1 = set, 2 = toggle + */ +void write_vline(uint16_t *buff, unsigned int x, unsigned int y0, unsigned int y1, int mode) +{ + unsigned int a; + CLIP_COORDS(x, y0); + CLIP_COORDS(x, y1); + if(y0 > y1) + { + SWAP(y0, y1); + } + if(y0 == y1) return; + /* This is an optimised algorithm for writing vertical lines. + * We begin by finding the addresses of the x,y0 and x,y1 points. */ + int addr0 = CALC_BUFF_ADDR(x, y0); + int addr1 = CALC_BUFF_ADDR(x, y1); + /* Then we calculate the pixel data to be written. */ + int bitnum = CALC_BIT_IN_WORD(x); + uint16_t mask = 1 << (15 - bitnum); + /* Run from addr0 to addr1 placing pixels. Increment by the number + * of words n each graphics line. */ + for(a = addr0; a <= addr1; a += DISP_WIDTH / 16) + { + WRITE_WORD_MODE(buff, a, mask, mode); + } +} + +/** + * write_vline_lm: write both level and mask buffers. + * + * @param x x coordinate + * @param y0 y0 coordinate + * @param y1 y1 coordinate + * @param lmode 0 = clear, 1 = set, 2 = toggle + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_vline_lm(unsigned int x, unsigned int y0, unsigned int y1, int lmode, int mmode) +{ + // TODO: an optimisation would compute the masks and apply to + // both buffers simultaneously. + write_vline(draw_buffer_level, x, y0, y1, lmode); + write_vline(draw_buffer_mask, x, y0, y1, mmode); +} + +/** + * write_vline_outlined: outlined vertical line with varying endcaps + * Always uses draw buffer. + * + * @param x x coordinate + * @param y0 y0 coordinate + * @param y1 y1 coordinate + * @param endcap0 0 = none, 1 = single pixel, 2 = full cap + * @param endcap1 0 = none, 1 = single pixel, 2 = full cap + * @param mode 0 = black outline, white body, 1 = white outline, black body + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_vline_outlined(unsigned int x, unsigned int y0, unsigned int y1, int endcap0, int endcap1, int mode, int mmode) +{ + int stroke, fill; + if(y0 > y1) + { + SWAP(y0, y1); + } + SETUP_STROKE_FILL(stroke, fill, mode); + // Draw the main body of the line. + write_vline_lm(x - 1, y0 + 1, y1 - 1, stroke, mmode); + write_vline_lm(x + 1, y0 + 1, y1 - 1, stroke, mmode); + write_vline_lm(x, y0 + 1, y1 - 1, fill, mmode); + // Draw the endcaps, if any. + DRAW_ENDCAP_VLINE(endcap0, x, y0, stroke, fill, mmode); + DRAW_ENDCAP_VLINE(endcap1, x, y1, stroke, fill, mmode); +} + +/** + * write_filled_rectangle: draw a filled rectangle. + * + * Uses an optimised algorithm which is similar to the horizontal + * line writing algorithm, but optimised for writing the lines + * multiple times without recalculating lots of stuff. + * + * @param buff pointer to buffer to write in + * @param x x coordinate (left) + * @param y y coordinate (top) + * @param width rectangle width + * @param height rectangle height + * @param mode 0 = clear, 1 = set, 2 = toggle + */ +void write_filled_rectangle(uint16_t *buff, unsigned int x, unsigned int y, unsigned int width, unsigned int height, int mode) +{ + int yy, addr0_old, addr1_old; + CHECK_COORDS(x, y); + CHECK_COORD_X(x + width); + CHECK_COORD_Y(y + height); + if(width <= 0 || height <= 0) return; + // Calculate as if the rectangle was only a horizontal line. We then + // step these addresses through each row until we iterate `height` times. + int addr0 = CALC_BUFF_ADDR(x, y); + int addr1 = CALC_BUFF_ADDR(x + width, y); + int addr0_bit = CALC_BIT_IN_WORD(x); + int addr1_bit = CALC_BIT_IN_WORD(x + width); + int mask, mask_l, mask_r, i; + // If the addresses are equal, we need to write one word vertically. + if(addr0 == addr1) + { + mask = COMPUTE_HLINE_ISLAND_MASK(addr0_bit, addr1_bit); + while(height--) + { + WRITE_WORD_MODE(buff, addr0, mask, mode); + addr0 += DISP_WIDTH / 16; + } + } + // Otherwise we need to write the edges and then the middle repeatedly. + else + { + mask_l = COMPUTE_HLINE_EDGE_L_MASK(addr0_bit); + mask_r = COMPUTE_HLINE_EDGE_R_MASK(addr1_bit); + // Write edges first. + yy = 0; + addr0_old = addr0; + addr1_old = addr1; + while(yy < height) + { + WRITE_WORD_MODE(buff, addr0, mask_l, mode); + WRITE_WORD_MODE(buff, addr1, mask_r, mode); + addr0 += DISP_WIDTH / 16; + addr1 += DISP_WIDTH / 16; + yy++; + } + // Now write 0xffff words from start+1 to end-1 for each row. + yy = 0; + addr0 = addr0_old; + addr1 = addr1_old; + while(yy < height) + { + for(i = addr0 + 1; i <= addr1 - 1; i++) + { + WRITE_WORD_MODE(buff, i, 0xffff, mode); + } + addr0 += DISP_WIDTH / 16; + addr1 += DISP_WIDTH / 16; + yy++; + } + } +} + +/** + * write_filled_rectangle_lm: draw a filled rectangle on both draw buffers. + * + * @param x x coordinate (left) + * @param y y coordinate (top) + * @param width rectangle width + * @param height rectangle height + * @param lmode 0 = clear, 1 = set, 2 = toggle + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_filled_rectangle_lm(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int lmode, int mmode) +{ + write_filled_rectangle(draw_buffer_mask, x, y, width, height, mmode); + write_filled_rectangle(draw_buffer_level, x, y, width, height, lmode); +} + +/** + * write_rectangle_outlined: draw an outline of a rectangle. Essentially + * a convenience wrapper for draw_hline_outlined and draw_vline_outlined. + * + * @param x x coordinate (left) + * @param y y coordinate (top) + * @param width rectangle width + * @param height rectangle height + * @param mode 0 = black outline, white body, 1 = white outline, black body + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_rectangle_outlined(unsigned int x, unsigned int y, int width, int height, int mode, int mmode) +{ + //CHECK_COORDS(x, y); + //CHECK_COORDS(x + width, y + height); + //if((x + width) > DISP_WIDTH) width = DISP_WIDTH - x; + //if((y + height) > DISP_HEIGHT) height = DISP_HEIGHT - y; + write_hline_outlined(x, x + width, y, ENDCAP_ROUND, ENDCAP_ROUND, mode, mmode); + write_hline_outlined(x, x + width, y + height, ENDCAP_ROUND, ENDCAP_ROUND, mode, mmode); + write_vline_outlined(x, y, y + height, ENDCAP_ROUND, ENDCAP_ROUND, mode, mmode); + write_vline_outlined(x + width, y, y + height, ENDCAP_ROUND, ENDCAP_ROUND, mode, mmode); +} + +/** + * write_circle: draw the outline of a circle on a given buffer, + * with an optional dash pattern for the line instead of a normal line. + * + * @param buff pointer to buffer to write in + * @param cx origin x coordinate + * @param cy origin y coordinate + * @param r radius + * @param dashp dash period (pixels) - zero for no dash + * @param mode 0 = clear, 1 = set, 2 = toggle + */ +void write_circle(uint16_t *buff, unsigned int cx, unsigned int cy, unsigned int r, unsigned int dashp, int mode) +{ + CHECK_COORDS(cx, cy); + int error = -r, x = r, y = 0; + while(x >= y) + { + if(dashp == 0 || (y % dashp) < (dashp / 2)) + { + CIRCLE_PLOT_8(buff, cx, cy, x, y, mode); + } + error += (y * 2) + 1; + y++; + if(error >= 0) + { + --x; + error -= x * 2; + } + } +} + +/** + * write_circle_outlined: draw an outlined circle on the draw buffer. + * + * @param cx origin x coordinate + * @param cy origin y coordinate + * @param r radius + * @param dashp dash period (pixels) - zero for no dash + * @param bmode 0 = 4-neighbour border, 1 = 8-neighbour border + * @param mode 0 = black outline, white body, 1 = white outline, black body + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_circle_outlined(unsigned int cx, unsigned int cy, unsigned int r, unsigned int dashp, int bmode, int mode, int mmode) +{ + int stroke, fill; + CHECK_COORDS(cx, cy); + SETUP_STROKE_FILL(stroke, fill, mode); + // This is a two step procedure. First, we draw the outline of the + // circle, then we draw the inner part. + int error = -r, x = r, y = 0; + while(x >= y) + { + if(dashp == 0 || (y % dashp) < (dashp / 2)) + { + CIRCLE_PLOT_8(draw_buffer_mask, cx, cy, x + 1, y, mmode); + CIRCLE_PLOT_8(draw_buffer_level, cx, cy, x + 1, y, stroke); + CIRCLE_PLOT_8(draw_buffer_mask, cx, cy, x, y + 1, mmode); + CIRCLE_PLOT_8(draw_buffer_level, cx, cy, x, y + 1, stroke); + CIRCLE_PLOT_8(draw_buffer_mask, cx, cy, x - 1, y, mmode); + CIRCLE_PLOT_8(draw_buffer_level, cx, cy, x - 1, y, stroke); + CIRCLE_PLOT_8(draw_buffer_mask, cx, cy, x, y - 1, mmode); + CIRCLE_PLOT_8(draw_buffer_level, cx, cy, x, y - 1, stroke); + if(bmode == 1) + { + CIRCLE_PLOT_8(draw_buffer_mask, cx, cy, x + 1, y + 1, mmode); + CIRCLE_PLOT_8(draw_buffer_level, cx, cy, x + 1, y + 1, stroke); + CIRCLE_PLOT_8(draw_buffer_mask, cx, cy, x - 1, y - 1, mmode); + CIRCLE_PLOT_8(draw_buffer_level, cx, cy, x - 1, y - 1, stroke); + } + } + error += (y * 2) + 1; + y++; + if(error >= 0) + { + --x; + error -= x * 2; + } + } + error = -r; + x = r; + y = 0; + while(x >= y) + { + if(dashp == 0 || (y % dashp) < (dashp / 2)) + { + CIRCLE_PLOT_8(draw_buffer_mask, cx, cy, x, y, mmode); + CIRCLE_PLOT_8(draw_buffer_level, cx, cy, x, y, fill); + } + error += (y * 2) + 1; + y++; + if(error >= 0) + { + --x; + error -= x * 2; + } + } +} + +/** + * write_circle_filled: fill a circle on a given buffer. + * + * @param buff pointer to buffer to write in + * @param cx origin x coordinate + * @param cy origin y coordinate + * @param r radius + * @param mode 0 = clear, 1 = set, 2 = toggle + */ +void write_circle_filled(uint16_t *buff, unsigned int cx, unsigned int cy, unsigned int r, int mode) +{ + CHECK_COORDS(cx, cy); + int error = -r, x = r, y = 0, xch = 0; + // It turns out that filled circles can take advantage of the midpoint + // circle algorithm. We simply draw very fast horizontal lines across each + // pair of X,Y coordinates. In some cases, this can even be faster than + // drawing an outlined circle! + // + // Due to multiple writes to each set of pixels, we have a special exception + // for when using the toggling draw mode. + while(x >= y) + { + if(y != 0) + { + write_hline(buff, cx - x, cx + x, cy + y, mode); + write_hline(buff, cx - x, cx + x, cy - y, mode); + if(mode != 2 || (mode == 2 && xch && (cx - x) != (cx - y))) + { + write_hline(buff, cx - y, cx + y, cy + x, mode); + write_hline(buff, cx - y, cx + y, cy - x, mode); + xch = 0; + } + } + error += (y * 2) + 1; + y++; + if(error >= 0) + { + --x; + xch = 1; + error -= x * 2; + } + } + // Handle toggle mode. + if(mode == 2) + { + write_hline(buff, cx - r, cx + r, cy, mode); + } +} + +/** + * write_line: Draw a line of arbitrary angle. + * + * @param buff pointer to buffer to write in + * @param x0 first x coordinate + * @param y0 first y coordinate + * @param x1 second x coordinate + * @param y1 second y coordinate + * @param mode 0 = clear, 1 = set, 2 = toggle + */ +void write_line(uint16_t *buff, unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, int mode) +{ + // Based on http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm + int steep = abs(y1 - y0) > abs(x1 - x0); + if(steep) + { + SWAP(x0, y0); + SWAP(x1, y1); + } + if(x0 > x1) + { + SWAP(x0, x1); + SWAP(y0, y1); + } + int deltax = x1 - x0; + int deltay = abs(y1 - y0); + int error = deltax / 2; + int ystep; + int y = y0; + int x, lasty = y, stox = 0; + if(y0 < y1) + ystep = 1; + else + ystep = -1; + for(x = x0; x < x1; x++) + { + if(steep) + { + if(lasty != y) + { + if(x > lasty) + write_vline(buff, stox, y, lasty, mode); + else + write_vline(buff, stox, lasty, y, mode); + lasty = y; + stox = x; + } + } + else + { + //write_pixel(buff, x, y, mode); + /* + if(lasty != y) + { + if(y > lasty) + write_vline(buff, stox, y, lasty, mode); + else + write_vline(buff, stox, lasty, y, mode); + lasty = y; + stox = x; + } + */ + } + error -= deltay; + if(error < 0) + { + y += ystep; + error += deltax; + } + } +} + +/** + * write_line_lm: Draw a line of arbitrary angle. + * + * @param x0 first x coordinate + * @param y0 first y coordinate + * @param x1 second x coordinate + * @param y1 second y coordinate + * @param mmode 0 = clear, 1 = set, 2 = toggle + * @param lmode 0 = clear, 1 = set, 2 = toggle + */ +void write_line_lm(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, int mmode, int lmode) +{ + write_line(draw_buffer_mask, x0, y0, x1, y1, mmode); + write_line(draw_buffer_level, x0, y0, x1, y1, lmode); +} + +/** + * write_line_outlined: Draw a line of arbitrary angle, with an outline. + * + * @param buff pointer to buffer to write in + * @param x0 first x coordinate + * @param y0 first y coordinate + * @param x1 second x coordinate + * @param y1 second y coordinate + * @param endcap0 0 = none, 1 = single pixel, 2 = full cap + * @param endcap1 0 = none, 1 = single pixel, 2 = full cap + * @param mode 0 = black outline, white body, 1 = white outline, black body + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_line_outlined(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, int endcap0, int endcap1, int mode, int mmode) +{ + // Based on http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm + // This could be improved for speed. + int omode, imode; + if(mode == 0) + { + omode = 0; + imode = 1; + } + else + { + omode = 1; + imode = 0; + } + int steep = abs(y1 - y0) > abs(x1 - x0); + if(steep) + { + SWAP(x0, y0); + SWAP(x1, y1); + } + if(x0 > x1) + { + SWAP(x0, x1); + SWAP(y0, y1); + } + int deltax = x1 - x0; + int deltay = abs(y1 - y0); + int error = deltax / 2; + int ystep; + int y = y0; + int x; + if(y0 < y1) + ystep = 1; + else + ystep = -1; + // Draw the outline. + for(x = x0; x < x1; x++) + { + if(steep) + { + write_pixel_lm(y - 1, x, mmode, omode); + write_pixel_lm(y + 1, x, mmode, omode); + write_pixel_lm(y, x - 1, mmode, omode); + write_pixel_lm(y, x + 1, mmode, omode); + } + else + { + write_pixel_lm(x - 1, y, mmode, omode); + write_pixel_lm(x + 1, y, mmode, omode); + write_pixel_lm(x, y - 1, mmode, omode); + write_pixel_lm(x, y + 1, mmode, omode); + } + error -= deltay; + if(error < 0) + { + y += ystep; + error += deltax; + } + } + // Now draw the innards. + error = deltax / 2; + y = y0; + for(x = x0; x < x1; x++) + { + if(steep) + { + write_pixel_lm(y, x, mmode, imode); + } + else + { + write_pixel_lm(x, y, mmode, imode); + } + error -= deltay; + if(error < 0) + { + y += ystep; + error += deltax; + } + } +} + +/** + * write_word_misaligned: Write a misaligned word across two addresses + * with an x offset. + * + * This allows for many pixels to be set in one write. + * + * @param buff buffer to write in + * @param word word to write (16 bits) + * @param addr address of first word + * @param xoff x offset (0-15) + * @param mode 0 = clear, 1 = set, 2 = toggle + */ +void write_word_misaligned(uint16_t *buff, uint16_t word, unsigned int addr, unsigned int xoff, int mode) +{ + uint16_t firstmask = word >> xoff; + uint16_t lastmask = word << (16 - xoff); + WRITE_WORD_MODE(buff, addr, firstmask, mode); + if(xoff > 0) + { + WRITE_WORD_MODE(buff, addr + 1, lastmask, mode); + } +} + +/** + * write_word_misaligned_NAND: Write a misaligned word across two addresses + * with an x offset, using a NAND mask. + * + * This allows for many pixels to be set in one write. + * + * @param buff buffer to write in + * @param word word to write (16 bits) + * @param addr address of first word + * @param xoff x offset (0-15) + * + * This is identical to calling write_word_misaligned with a mode of 0 but + * it doesn't go through a lot of switch logic which slows down text writing + * a lot. + */ +void write_word_misaligned_NAND(uint16_t *buff, uint16_t word, unsigned int addr, unsigned int xoff) +{ + uint16_t firstmask = word >> xoff; + uint16_t lastmask = word << (16 - xoff); + WRITE_WORD_NAND(buff, addr, firstmask); + if(xoff > 0) + { + WRITE_WORD_NAND(buff, addr + 1, lastmask); + } +} + +/** + * write_word_misaligned_OR: Write a misaligned word across two addresses + * with an x offset, using an OR mask. + * + * This allows for many pixels to be set in one write. + * + * @param buff buffer to write in + * @param word word to write (16 bits) + * @param addr address of first word + * @param xoff x offset (0-15) + * + * This is identical to calling write_word_misaligned with a mode of 1 but + * it doesn't go through a lot of switch logic which slows down text writing + * a lot. + */ +void write_word_misaligned_OR(uint16_t *buff, uint16_t word, unsigned int addr, unsigned int xoff) +{ + uint16_t firstmask = word >> xoff; + uint16_t lastmask = word << (16 - xoff); + WRITE_WORD_OR(buff, addr, firstmask); + if(xoff > 0) + { + WRITE_WORD_OR(buff, addr + 1, lastmask); + } +} + +/** + * write_word_misaligned_lm: Write a misaligned word across two + * words, in both level and mask buffers. This is core to the text + * writing routines. + * + * @param buff buffer to write in + * @param word word to write (16 bits) + * @param addr address of first word + * @param xoff x offset (0-15) + * @param lmode 0 = clear, 1 = set, 2 = toggle + * @param mmode 0 = clear, 1 = set, 2 = toggle + */ +void write_word_misaligned_lm(uint16_t wordl, uint16_t wordm, unsigned int addr, unsigned int xoff, int lmode, int mmode) +{ + write_word_misaligned(draw_buffer_level, wordl, addr, xoff, lmode); + write_word_misaligned(draw_buffer_mask, wordm, addr, xoff, mmode); +} + +/** + * fetch_font_info: Fetch font info structs. + * + * @param ch character + * @param font font id + */ +int fetch_font_info(char ch, int font, struct FontEntry *font_info, char *lookup) +{ + // First locate the font struct. + if(font > SIZEOF_ARRAY(fonts)) + return 0; // font does not exist, exit.*/ + // Load the font info; IDs are always sequential. + *font_info = fonts[font]; + // Locate character in font lookup table. (If required.) + if(lookup != NULL) + { + *lookup = font_info->lookup[ch]; + if(*lookup == 0xff) + return 0; // character doesn't exist, don't bother writing it. + } + return 1; +} + +/** + * write_char: Draw a character on the current draw buffer. + * Currently supports outlined characters and characters with + * a width of up to 8 pixels. + * + * @param ch character to write + * @param x x coordinate (left) + * @param y y coordinate (top) + * @param flags flags to write with (see gfx.h) + * @param font font to use + */ +void write_char(char ch, unsigned int x, unsigned int y, int flags, int font) +{ + int yy, addr_temp, row, row_temp, xshift; + uint16_t and_mask, or_mask, level_bits; + struct FontEntry font_info; + char lookup = 0; + fetch_font_info(ch, font, &font_info, &lookup); + // Compute starting address (for x,y) of character. + int addr = CALC_BUFF_ADDR(x, y); + int wbit = CALC_BIT_IN_WORD(x); + // If font only supports lowercase or uppercase, make the letter + // lowercase or uppercase. + if(font_info.flags & FONT_LOWERCASE_ONLY) + ch = tolower(ch); + if(font_info.flags & FONT_UPPERCASE_ONLY) + ch = toupper(ch); + fetch_font_info(ch, font, &font_info, &lookup); + // How big is the character? We handle characters up to 8 pixels + // wide for now. Support for large characters may be added in future. + if(font_info.width <= 8) + { + // Ensure we don't overflow. + if(x + wbit > DISP_WIDTH) + return; + // Load data pointer. + row = lookup * font_info.height * 2; + row_temp = row; + addr_temp = addr; + xshift = 16 - font_info.width; + // We can write mask words easily. + for(yy = y; yy < y + font_info.height; yy++) + { + write_word_misaligned_OR(draw_buffer_mask, font_info.data[row] << xshift, addr, wbit); + addr += DISP_WIDTH / 16; + row++; + } + // Level bits are more complicated. We need to set or clear + // level bits, but only where the mask bit is set; otherwise, + // we need to leave them alone. To do this, for each word, we + // construct an AND mask and an OR mask, and apply each individually. + row = row_temp; + addr = addr_temp; + for(yy = y; yy < y + font_info.height; yy++) + { + level_bits = font_info.data[row + font_info.height]; + if(!(flags & FONT_INVERT)) // data is normally inverted + level_bits = ~level_bits; + or_mask = font_info.data[row] << xshift; + and_mask = (font_info.data[row] & level_bits) << xshift; + write_word_misaligned_OR(draw_buffer_level, or_mask, addr, wbit); + // If we're not bold write the AND mask. + //if(!(flags & FONT_BOLD)) + write_word_misaligned_NAND(draw_buffer_level, and_mask, addr, wbit); + addr += DISP_WIDTH / 16; + row++; + } + } +} + +/** +* calc_text_dimensions: Calculate the dimensions of a +* string in a given font. Supports new lines and +* carriage returns in text. +* +* @param str string to calculate dimensions of +* @param font_info font info structure +* @param xs horizontal spacing +* @param ys vertical spacing +* @param dim return result: struct FontDimensions +*/ +void calc_text_dimensions(char *str, struct FontEntry font, int xs, int ys, struct FontDimensions *dim) +{ + int max_length = 0, line_length = 0, lines = 1; + while(*str != 0) + { + line_length++; + if(*str == '\n' || *str == '\r') + { + if(line_length > max_length) + max_length = line_length; + line_length = 0; + lines++; + } + str++; + } + if(line_length > max_length) + max_length = line_length; + dim->width = max_length * (font.width + xs); + dim->height = lines * (font.height + ys); +} + +/** +* write_string: Draw a string on the screen with certain +* alignment parameters. +* +* @param str string to write +* @param x x coordinate +* @param y y coordinate +* @param xs horizontal spacing +* @param ys horizontal spacing +* @param va vertical align +* @param ha horizontal align +* @param flags flags (passed to write_char) +* @param font font +*/ +void write_string(char *str, unsigned int x, unsigned int y, unsigned int xs, unsigned int ys, int va, int ha, int flags, int font) +{ + int xx = 0, yy = 0, xx_original = 0; + struct FontEntry font_info; + struct FontDimensions dim; + // Determine font info and dimensions/position of the string. + fetch_font_info(0, font, &font_info, NULL); + calc_text_dimensions(str, font_info, xs, ys, &dim); + switch(va) + { + case TEXT_VA_TOP: yy = y; break; + case TEXT_VA_MIDDLE: yy = y - (dim.height / 2); break; + case TEXT_VA_BOTTOM: yy = y - dim.height; break; + } + switch(ha) + { + case TEXT_HA_LEFT: xx = x; break; + case TEXT_HA_CENTER: xx = x - (dim.width / 2); break; + case TEXT_HA_RIGHT: xx = x - dim.width; break; + } + // Then write each character. + xx_original = xx; + while(*str != 0) + { + if(*str == '\n' || *str == '\r') + { + yy += ys + font_info.height; + xx = xx_original; + } + else + { + if(xx >= 0 && xx < DISP_WIDTH) + write_char(*str, xx, yy, flags, font); + xx += font_info.width + xs; + } + str++; + } +} + +/** +* write_string_formatted: Draw a string with format escape +* sequences in it. Allows for complex text effects. +* +* @param str string to write (with format data) +* @param x x coordinate +* @param y y coordinate +* @param xs default horizontal spacing +* @param ys default horizontal spacing +* @param va vertical align +* @param ha horizontal align +* @param flags flags (passed to write_char) +*/ +void write_string_formatted(char *str, unsigned int x, unsigned int y, unsigned int xs, unsigned int ys, int va, int ha, int flags) +{ + int fcode = 0, fptr = 0, font = 0, fwidth = 0, fheight = 0, xx = x, yy = y, max_xx = 0, max_height = 0; + struct FontEntry font_info; + // Retrieve sizes of the fonts: bigfont and smallfont. + fetch_font_info(0, 0, &font_info, NULL); + int smallfontwidth = font_info.width, smallfontheight = font_info.height; + fetch_font_info(0, 1, &font_info, NULL); + int bigfontwidth = font_info.width, bigfontheight = font_info.height; + // 11 byte stack with last byte as NUL. + char fstack[11]; + fstack[10] = '\0'; + // First, we need to parse the string for format characters and + // work out a bounding box. We'll parse again for the final output. + // This is a simple state machine parser. + char *ostr = str; + while(*str) + { + if(*str == '<' && fcode == 1) // escape code: skip + fcode = 0; + if(*str == '<' && fcode == 0) // begin format code? + { + fcode = 1; + fptr = 0; + } + if(*str == '>' && fcode == 1) + { + fcode = 0; + if(strcmp(fstack, "B")) // switch to "big" font (font #1) + { + fwidth = bigfontwidth; + fheight = bigfontheight; + } + else if(strcmp(fstack, "S")) // switch to "small" font (font #0) + { + fwidth = smallfontwidth; + fheight = smallfontheight; + } + if(fheight > max_height) + max_height = fheight; + // Skip over this byte. Go to next byte. + str++; + continue; + } + if(*str != '<' && *str != '>' && fcode == 1) + { + // Add to the format stack (up to 10 bytes.) + if(fptr > 10) // stop adding bytes + { + str++; // go to next byte + continue; + } + fstack[fptr++] = *str; + fstack[fptr] = '\0'; // clear next byte (ready for next char or to terminate string.) + } + if(fcode == 0) + { + // Not a format code, raw text. + xx += fwidth + xs; + if(*str == '\n') + { + if(xx > max_xx) + max_xx = xx; + xx = x; + yy += fheight + ys; + } + } + str++; + } + // Reset string pointer. + str = ostr; + // Now we've parsed it and got a bbox, we need to work out the dimensions of it + // and how to align it. + int width = max_xx - x; + int height = yy - y; + int ay, ax; + switch(va) + { + case TEXT_VA_TOP: ay = yy; break; + case TEXT_VA_MIDDLE: ay = yy - (height / 2); break; + case TEXT_VA_BOTTOM: ay = yy - height; break; + } + switch(ha) + { + case TEXT_HA_LEFT: ax = x; break; + case TEXT_HA_CENTER: ax = x - (width / 2); break; + case TEXT_HA_RIGHT: ax = x - width; break; + } + // So ax,ay is our new text origin. Parse the text format again and paint + // the text on the display. + fcode = 0; + fptr = 0; + font = 0; + xx = 0; + yy = 0; + while(*str) + { + if(*str == '<' && fcode == 1) // escape code: skip + fcode = 0; + if(*str == '<' && fcode == 0) // begin format code? + { + fcode = 1; + fptr = 0; + } + if(*str == '>' && fcode == 1) + { + fcode = 0; + if(strcmp(fstack, "B")) // switch to "big" font (font #1) + { + fwidth = bigfontwidth; + fheight = bigfontheight; + font = 1; + } + else if(strcmp(fstack, "S")) // switch to "small" font (font #0) + { + fwidth = smallfontwidth; + fheight = smallfontheight; + font = 0; + } + // Skip over this byte. Go to next byte. + str++; + continue; + } + if(*str != '<' && *str != '>' && fcode == 1) + { + // Add to the format stack (up to 10 bytes.) + if(fptr > 10) // stop adding bytes + { + str++; // go to next byte + continue; + } + fstack[fptr++] = *str; + fstack[fptr] = '\0'; // clear next byte (ready for next char or to terminate string.) + } + if(fcode == 0) + { + // Not a format code, raw text. So we draw it. + // TODO - different font sizes. + write_char(*str, xx, yy + (max_height - fheight), flags, font); + xx += fwidth + xs; + if(*str == '\n') + { + if(xx > max_xx) + max_xx = xx; + xx = x; + yy += fheight + ys; + } + } + str++; + } +} + + +//SUPEROSD- + + +// graphics + +void drawAttitude(uint16_t x, uint16_t y, int16_t pitch, int16_t roll, uint16_t size) +{ + int16_t a = mySin(roll+360); + int16_t b = myCos(roll+360); + int16_t c = mySin(roll+90+360)*5/100; + int16_t d = myCos(roll+90+360)*5/100; + + int16_t k; + int16_t l; + + int16_t indi30x1=myCos(30)*(size/2+1) / 100; + int16_t indi30y1=mySin(30)*(size/2+1) / 100; + + int16_t indi30x2=myCos(30)*(size/2+4) / 100; + int16_t indi30y2=mySin(30)*(size/2+4) / 100; + + int16_t indi60x1=myCos(60)*(size/2+1) / 100; + int16_t indi60y1=mySin(60)*(size/2+1) / 100; + + int16_t indi60x2=myCos(60)*(size/2+4) / 100; + int16_t indi60y2=mySin(60)*(size/2+4) / 100; + + pitch=pitch%90; + if(pitch>90) + { + pitch=pitch-90; + } + if(pitch<-90) + { + pitch=pitch+90; + } + a = (a * (size/2)) / 100; + b = (b * (size/2)) / 100; + + if(roll<-90 || roll>90) + pitch=pitch*-1; + k = a*pitch/90; + l = b*pitch/90; + + // scale + //0 + //drawLine((x)-1-(size/2+4), (y)-1, (x)-1 - (size/2+1), (y)-1); + //drawLine((x)-1+(size/2+4), (y)-1, (x)-1 + (size/2+1), (y)-1); + write_line_outlined((x)-1-(size/2+4), (y)-1, (x)-1 - (size/2+1), (y)-1,0,0,0,1); + write_line_outlined((x)-1+(size/2+4), (y)-1, (x)-1 + (size/2+1), (y)-1,0,0,0,1); + + //30 + //drawLine((x)-1+indi30x1, (y)-1-indi30y1, (x)-1 + indi30x2, (y)-1 - indi30y2); + //drawLine((x)-1-indi30x1, (y)-1-indi30y1, (x)-1 - indi30x2, (y)-1 - indi30y2); + write_line_outlined((x)-1+indi30x1, (y)-1-indi30y1, (x)-1 + indi30x2, (y)-1 - indi30y2,0,0,0,1); + write_line_outlined((x)-1-indi30x1, (y)-1-indi30y1, (x)-1 - indi30x2, (y)-1 - indi30y2,0,0,0,1); + //60 + //drawLine((x)-1+indi60x1, (y)-1-indi60y1, (x)-1 + indi60x2, (y)-1 - indi60y2); + //drawLine((x)-1-indi60x1, (y)-1-indi60y1, (x)-1 - indi60x2, (y)-1 - indi60y2); + write_line_outlined((x)-1+indi60x1, (y)-1-indi60y1, (x)-1 + indi60x2, (y)-1 - indi60y2,0,0,0,1); + write_line_outlined((x)-1-indi60x1, (y)-1-indi60y1, (x)-1 - indi60x2, (y)-1 - indi60y2,0,0,0,1); + //90 + //drawLine((x)-1, (y)-1-(size/2+4), (x)-1, (y)-1 - (size/2+1)); + write_line_outlined((x)-1, (y)-1-(size/2+4), (x)-1, (y)-1 - (size/2+1),0,0,0,1); + + + //roll + //drawLine((x)-1 - b, (y)-1 + a, (x)-1 + b, (y)-1 - a); //Direction line + write_line_outlined((x)-1 - b, (y)-1 + a, (x)-1 + b, (y)-1 - a,0,0,0,1); //Direction line + //"wingtips" + //drawLine((x)-1 - b, (y)-1 + a, (x)-1 - b + d, (y)-1 + a - c); + //drawLine((x)-1 + b + d, (y)-1 - a - c, (x)-1 + b, (y)-1 - a); + write_line_outlined((x)-1 - b, (y)-1 + a, (x)-1 - b + d, (y)-1 + a - c,0,0,0,1); + write_line_outlined((x)-1 + b + d, (y)-1 - a - c, (x)-1 + b, (y)-1 - a,0,0,0,1); + + //pitch + //drawLine((x)-1, (y)-1, (x)-1 - k, (y)-1 - l); + write_line_outlined((x)-1, (y)-1, (x)-1 - k, (y)-1 - l,0,0,0,1); + + + //drawCircle(x-1, y-1, 5); + //write_circle_outlined(x-1, y-1, 5,0,0,0,1); + //drawCircle(x-1, y-1, size/2+4); + //write_circle_outlined(x-1, y-1, size/2+4,0,0,0,1); +} + +void drawBattery(uint16_t x, uint16_t y, uint8_t battery, uint16_t size) +{ + int i=0; + int batteryLines; + //top + /*drawLine((x)-1+(size/2-size/4), (y)-1, (x)-1 + (size/2+size/4), (y)-1); + drawLine((x)-1+(size/2-size/4), (y)-1+1, (x)-1 + (size/2+size/4), (y)-1+1); + + drawLine((x)-1, (y)-1+2, (x)-1 + size, (y)-1+2); + //bottom + drawLine((x)-1, (y)-1+size*3, (x)-1 + size, (y)-1+size*3); + //left + drawLine((x)-1, (y)-1+2, (x)-1, (y)-1+size*3); + + //right + drawLine((x)-1+size, (y)-1+2, (x)-1+size, (y)-1+size*3);*/ + + write_hline_lm((x)-1+(size/2-size/4),(x)-1 + (size/2+size/4),(y)-1,1,1); + write_hline_lm((x)-1+(size/2-size/4),(x)-1 + (size/2+size/4),(y)-1+1,1,1); + write_rectangle_outlined((x)-1, (y)-1+2,size,size*3,0,1); + + batteryLines = battery*(size*3-2)/100; + for(i=0;i= -1 && halign <= 1); + // Compute the position of the elements. + int majtick_start = 0, majtick_end = 0, mintick_start = 0, mintick_end = 0, boundtick_start = 0, boundtick_end = 0; + if(halign == -1) + { + majtick_start = x; + majtick_end = x + majtick_len; + mintick_start = x; + mintick_end = x + mintick_len; + boundtick_start = x; + boundtick_end = x + boundtick_len; + } + else if(halign == +1) + { + majtick_start = DISP_WIDTH - x - 1; + majtick_end = DISP_WIDTH - x - majtick_len - 1; + mintick_start = DISP_WIDTH - x - 1; + mintick_end = DISP_WIDTH - x - mintick_len - 1; + boundtick_start = DISP_WIDTH - x - 1; + boundtick_end = DISP_WIDTH - x - boundtick_len - 1; + } + // Retrieve width of large font (font #0); from this calculate the x spacing. + fetch_font_info(0, 0, &font_info, NULL); + int arrow_len = (font_info.height / 2) + 1; // FIXME, font info being loaded correctly?? + int text_x_spacing = arrow_len; + int max_text_y = 0, text_length = 0; + int small_font_char_width = font_info.width + 1; // +1 for horizontal spacing = 1 + // For -(range / 2) to +(range / 2), draw the scale. + int range_2 = range / 2, height_2 = height / 2; + int calc_ys = 0, r = 0, rr = 0, rv = 0, ys = 0, style = 0; + // Iterate through each step. + for(r = -range_2; r <= +range_2; r++) + { + style = 0; + rr = r + range_2 - v; // normalise range for modulo, subtract value to move ticker tape + rv = -rr + range_2; // for number display + if(flags & HUD_VSCALE_FLAG_NO_NEGATIVE) + rr += majtick_step / 2; + if(rr % majtick_step == 0) + style = 1; // major tick + else if(rr % mintick_step == 0) + style = 2; // minor tick + else + style = 0; + if(flags & HUD_VSCALE_FLAG_NO_NEGATIVE && rv < 0) + continue; + if(style) + { + // Calculate y position. + ys = ((long int)(r * height) / (long int)range) + y; + //sprintf(temp, "ys=%d", ys); + //con_puts(temp, 0); + // Depending on style, draw a minor or a major tick. + if(style == 1) + { + write_hline_outlined(majtick_start, majtick_end, ys, 2, 2, 0, 1); + memset(temp, ' ', 10); + //my_itoa(rv, temp); + sprintf(temp,"%d",rv); + text_length = (strlen(temp) + 1) * small_font_char_width; // add 1 for margin + if(text_length > max_text_y) + max_text_y = text_length; + if(halign == -1) + write_string(temp, majtick_end + text_x_spacing, ys, 1, 0, TEXT_VA_MIDDLE, TEXT_HA_LEFT, 0, 1); + else + write_string(temp, majtick_end - text_x_spacing + 1, ys, 1, 0, TEXT_VA_MIDDLE, TEXT_HA_RIGHT, 0, 1); + } + else if(style == 2) + write_hline_outlined(mintick_start, mintick_end, ys, 2, 2, 0, 1); + } + } + // Generate the string for the value, as well as calculating its dimensions. + memset(temp, ' ', 10); + //my_itoa(v, temp); + sprintf(temp,"%d",v); + // TODO: add auto-sizing. + calc_text_dimensions(temp, font_info, 1, 0, &dim); + int xx = 0, i = 0; + if(halign == -1) + xx = majtick_end + text_x_spacing; + else + xx = majtick_end - text_x_spacing; + // Draw an arrow from the number to the point. + for(i = 0; i < arrow_len; i++) + { + if(halign == -1) + { + write_pixel_lm(xx - arrow_len + i, y - i - 1, 1, 1); + write_pixel_lm(xx - arrow_len + i, y + i - 1, 1, 1); + write_hline_lm(xx + dim.width - 1, xx - arrow_len + i + 1, y - i - 1, 0, 1); + write_hline_lm(xx + dim.width - 1, xx - arrow_len + i + 1, y + i - 1, 0, 1); + } + else + { + write_pixel_lm(xx + arrow_len - i, y - i - 1, 1, 1); + write_pixel_lm(xx + arrow_len - i, y + i - 1, 1, 1); + write_hline_lm(xx - dim.width - 1, xx + arrow_len - i - 1, y - i - 1, 0, 1); + write_hline_lm(xx - dim.width - 1, xx + arrow_len - i - 1, y + i - 1, 0, 1); + } + // FIXME + // write_hline_lm(xx - dim.width - 1, xx + (arrow_len - i), y - i - 1, 1, 1); + // write_hline_lm(xx - dim.width - 1, xx + (arrow_len - i), y + i - 1, 1, 1); + } + if(halign == -1) + { + write_hline_lm(xx, xx + dim.width - 1, y - arrow_len, 1, 1); + write_hline_lm(xx, xx + dim.width - 1, y + arrow_len - 2, 1, 1); + write_vline_lm(xx + dim.width - 1, y - arrow_len, y + arrow_len - 2, 1, 1); + } + else + { + write_hline_lm(xx, xx - dim.width - 1, y - arrow_len, 1, 1); + write_hline_lm(xx, xx - dim.width - 1, y + arrow_len - 2, 1, 1); + write_vline_lm(xx - dim.width - 1, y - arrow_len, y + arrow_len - 2, 1, 1); + } + // Draw the text. + if(halign == -1) + write_string(temp, xx, y, 1, 0, TEXT_VA_MIDDLE, TEXT_HA_LEFT, 0, 0); + else + write_string(temp, xx, y, 1, 0, TEXT_VA_MIDDLE, TEXT_HA_RIGHT, 0, 0); + // Then, add a slow cut off on the edges, so the text doesn't sharply + // disappear. We simply clear the areas above and below the ticker, and we + // use little markers on the edges. + if(halign == -1) + { + write_filled_rectangle_lm(majtick_end + text_x_spacing, y + (height / 2) - (font_info.height / 2), max_text_y - boundtick_start, font_info.height, 0, 0); + write_filled_rectangle_lm(majtick_end + text_x_spacing, y - (height / 2) - (font_info.height / 2), max_text_y - boundtick_start, font_info.height, 0, 0); + } + else + { + write_filled_rectangle_lm(majtick_end - text_x_spacing - max_text_y, y + (height / 2) - (font_info.height / 2), max_text_y, font_info.height, 0, 0); + write_filled_rectangle_lm(majtick_end - text_x_spacing - max_text_y, y - (height / 2) - (font_info.height / 2), max_text_y, font_info.height, 0, 0); + } + write_hline_outlined(boundtick_start, boundtick_end, y + (height / 2), 2, 2, 0, 1); + write_hline_outlined(boundtick_start, boundtick_end, y - (height / 2), 2, 2, 0, 1); +} + +/** + * hud_draw_compass: Draw a compass. + * + * @param v value for the compass + * @param range range about value to display (+/- range/2 each direction) + * @param width length in pixels + * @param x x displacement (typ. half display width) + * @param y y displacement (typ. bottom of display) + * @param mintick_step how often a minor tick is shown + * @param majtick_step how often a major tick (heading "xx") is shown + * @param mintick_len minor tick length + * @param majtick_len major tick length + * @param flags special flags (see hud.h.) + */ +void hud_draw_linear_compass(int v, int range, int width, int x, int y, int mintick_step, int majtick_step, int mintick_len, int majtick_len, int flags) +{ + v %= 360; // wrap, just in case. + struct FontEntry font_info; + int majtick_start = 0, majtick_end = 0, mintick_start = 0, mintick_end = 0, textoffset = 0; + char headingstr[4]; + majtick_start = y; + majtick_end = y - majtick_len; + mintick_start = y; + mintick_end = y - mintick_len; + textoffset = 8; + int r, style, rr, rv, xs; + int range_2 = range / 2; + for(r = -range_2; r <= +range_2; r++) + { + style = 0; + rr = (v + r + 360) % 360; // normalise range for modulo, add to move compass track + rv = -rr + range_2; // for number display + if(rr % majtick_step == 0) + style = 1; // major tick + else if(rr % mintick_step == 0) + style = 2; // minor tick + if(style) + { + // Calculate x position. + xs = ((long int)(r * width) / (long int)range) + x; + // Draw it. + if(style == 1) + { + write_vline_outlined(xs, majtick_start, majtick_end, 2, 2, 0, 1); + // Draw heading above this tick. + // If it's not one of north, south, east, west, draw the heading. + // Otherwise, draw one of the identifiers. + if(rr % 90 != 0) + { + // We abbreviate heading to two digits. This has the side effect of being easy to compute. + headingstr[0] = '0' + (rr / 100); + headingstr[1] = '0' + ((rr / 10) % 10); + headingstr[2] = 0; + headingstr[3] = 0; // nul to terminate + } + else + { + switch(rr) + { + case 0: headingstr[0] = 'N'; break; + case 90: headingstr[0] = 'E'; break; + case 180: headingstr[0] = 'S'; break; + case 270: headingstr[0] = 'W'; break; + } + headingstr[1] = 0; + headingstr[2] = 0; + headingstr[3] = 0; + } + // +1 fudge...! + write_string(headingstr, xs + 1, majtick_start + textoffset, 1, 0, TEXT_VA_MIDDLE, TEXT_HA_CENTER, 0, 1); + } + else if(style == 2) + write_vline_outlined(xs, mintick_start, mintick_end, 2, 2, 0, 1); + } + } + // Then, draw a rectangle with the present heading in it. + // We want to cover up any other markers on the bottom. + // First compute font size. + fetch_font_info(0, 0, &font_info, NULL); + int text_width = (font_info.width + 1) * 3; + int rect_width = text_width + 2; + write_filled_rectangle_lm(x - (rect_width / 2), majtick_start + 2, rect_width, font_info.height + 2, 0, 1); + write_rectangle_outlined(x - (rect_width / 2), majtick_start + 2, rect_width, font_info.height + 2, 0, 1); + headingstr[0] = '0' + (v / 100); + headingstr[1] = '0' + ((v / 10) % 10); + headingstr[2] = '0' + (v % 10); + headingstr[3] = 0; + write_string(headingstr, x + 1, majtick_start + textoffset+2, 1, 0, TEXT_VA_MIDDLE, TEXT_HA_CENTER, 1, 0); +} + +static int count=0; +static int mark=0; + +//main draw function +void updateGraphics() { + + /*drawBox(2,2,GRAPHICS_WIDTH_REAL-4,GRAPHICS_HEIGHT_REAL-4); + write_filled_rectangle(draw_buffer_mask,0,0,GRAPHICS_WIDTH_REAL-2,GRAPHICS_HEIGHT_REAL-2,0); + write_filled_rectangle(draw_buffer_mask,2,2,GRAPHICS_WIDTH_REAL-4-2,GRAPHICS_HEIGHT_REAL-4-2,2); + write_filled_rectangle(draw_buffer_mask,3,3,GRAPHICS_WIDTH_REAL-4-1,GRAPHICS_HEIGHT_REAL-4-1,0);*/ + //write_filled_rectangle(draw_buffer_mask,5,5,GRAPHICS_WIDTH_REAL-4-5,GRAPHICS_HEIGHT_REAL-4-5,0); + //write_rectangle_outlined(10,10,GRAPHICS_WIDTH_REAL-20,GRAPHICS_HEIGHT_REAL-20,0,0); + //drawLine(GRAPHICS_WIDTH_REAL-1, GRAPHICS_HEIGHT_REAL-1,(GRAPHICS_WIDTH_REAL/2)-1, GRAPHICS_HEIGHT_REAL-1 ); + //drawCircle((GRAPHICS_WIDTH_REAL/2)-1, (GRAPHICS_HEIGHT_REAL/2)-1, (GRAPHICS_HEIGHT_REAL/2)-1); + //drawCircle((GRAPHICS_SIZE/2)-1, (GRAPHICS_SIZE/2)-1, (GRAPHICS_SIZE/2)-2); + //drawLine(0, (GRAPHICS_SIZE/2)-1, GRAPHICS_SIZE-1, (GRAPHICS_SIZE/2)-1); + //drawLine((GRAPHICS_SIZE/2)-1, 0, (GRAPHICS_SIZE/2)-1, GRAPHICS_SIZE-1); + angleA++; + if(angleB<=-90) + { + sum=2; + } + if(angleB>=90) + { + sum=-2; + } + angleB+=sum; + angleC+=2; + //drawArrow(32,GRAPHICS_HEIGHT_REAL-40,angleA,32); + //drawAttitude(96,GRAPHICS_HEIGHT_REAL/2,90,0,48); + drawAttitude(GRAPHICS_WIDTH_REAL/2,GRAPHICS_HEIGHT_REAL/2,m_pitch,m_roll,96); + //printTextFB(2,12,"Hello OP-OSD"); + //printTextFB(1,21,"Hello OP-OSD"); + //printTextFB(0,2,"Hello OP-OSD"); + /*write_hline_outlined(GRAPHICS_WIDTH_REAL/2-30, GRAPHICS_WIDTH_REAL/2+30, GRAPHICS_HEIGHT_REAL/2, 2, 2, 0, 1); + write_vline_outlined(GRAPHICS_WIDTH_REAL/2, GRAPHICS_HEIGHT_REAL/2-30, GRAPHICS_HEIGHT_REAL/2+30, 2, 2, 0, 1); + write_circle_outlined(GRAPHICS_WIDTH_REAL/2,GRAPHICS_HEIGHT_REAL/2,30,0,0,0,1);*/ + //write_string("Hello OP-OSD", 60, 12, 1, 0, TEXT_VA_TOP, TEXT_HA_LEFT, 0, 0); + //printText16( 60, 12,"Hello OP-OSD"); + char temp[20]={0}; + + sprintf(temp,"S%d, Lat:%02d, Lon:%02d",(int)m_gpsStatus,(int)m_gpsLat,(int)m_gpsLon); + write_string(temp, 10, 10, 1, 0, TEXT_VA_TOP, TEXT_HA_LEFT, 0, 0); + + /*count++; + for(int x=1;x<20;x++) + { + //printCharFB((mark+x-1)%255,x,40); + write_char16((mark+x-1)%255,x*12+40,60); + } + if(count==12) + { + mark++; + count=0; + }*/ + + printTime((GRAPHICS_WIDTH_REAL - 80)/16,GRAPHICS_HEIGHT_REAL-20); + + char tempx[20]={0}; + sprintf(tempx,"Lines:%4d",PIOS_Video_GetOSDLines()); + write_string(tempx, (GRAPHICS_WIDTH_REAL - 2),10, 1, 0, TEXT_VA_TOP, TEXT_HA_RIGHT, 0, 0); + + sprintf(tempx,"Rssi:%4dV",(int)(PIOS_ADC_PinGet(4)*3000/4096)); + write_string(tempx, (GRAPHICS_WIDTH_REAL - 2),24, 1, 0, TEXT_VA_TOP, TEXT_HA_RIGHT, 0, 0); + + sprintf(tempx,"Temp:%4dC",(int)(PIOS_ADC_PinGet(5)*0.29296875f-279)); + write_string(tempx, (GRAPHICS_WIDTH_REAL - 2),38, 1, 0, TEXT_VA_TOP, TEXT_HA_RIGHT, 0, 0); + + m_batt++; + uint8_t dir=3; + if(m_batt==101) + m_batt=0; + if(m_pitch>0) + { + dir=0; + m_alt+=m_pitch/2; + } + else if(m_pitch<0) + { + dir=1; + m_alt+=m_pitch/2; + } + + drawBattery(GRAPHICS_WIDTH_REAL-20,GRAPHICS_HEIGHT_REAL-(20*3),m_batt,16); + + //drawAltitude(200,50,m_alt,dir); + //drawArrow(96,GRAPHICS_HEIGHT_REAL/2,angleB,32); + //ellipse(50,50,50,30); + + // Draw airspeed (left side.) + hud_draw_vertical_scale((int)m_gpsSpd, 100, -1, 2, (DISP_HEIGHT / 2) + 10, 100, 10, 20, 7, 12, 15, 1000, HUD_VSCALE_FLAG_NO_NEGATIVE); + // Draw altimeter (right side.) + hud_draw_vertical_scale((int)m_gpsAlt, 200, +1, 2, (DISP_HEIGHT / 2) + 10, 100, 20, 100, 7, 12, 15, 500, 0); + // Draw compass. + if(m_yaw<0) + hud_draw_linear_compass(360+m_yaw, 150, 120, DISP_WIDTH / 2, DISP_HEIGHT - 20, 15, 30, 7, 12, 0); + else + hud_draw_linear_compass(m_yaw, 150, 120, DISP_WIDTH / 2, DISP_HEIGHT - 20, 15, 30, 7, 12, 0); + + //write_filled_rectangle(draw_buffer_level,20,20,30,30,1); + //write_filled_rectangle(draw_buffer_mask,30,30,30,30,1); + write_vline( draw_buffer_level,GRAPHICS_WIDTH_REAL-1,0,GRAPHICS_HEIGHT_REAL-1,0); + write_vline( draw_buffer_mask,GRAPHICS_WIDTH_REAL-1,0,GRAPHICS_HEIGHT_REAL-1,0); +} + + +void updateOnceEveryFrame() { + clearGraphics(); + updateGraphics(); +} + + +// **************** +/** + * Initialise the gps module + * \return -1 if initialisation failed + * \return 0 on success + */ + +int32_t osdgenStart(void) +{ + // Start gps task + vSemaphoreCreateBinary( osdSemaphore); + xTaskCreate(osdgenTask, (signed char *)"OSDGEN", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &osdgenTaskHandle); + TaskMonitorAdd(TASKINFO_RUNNING_GPS, osdgenTaskHandle); + + return 0; +} + +/** + * Initialise the osd module + * \return -1 if initialisation failed + * \return 0 on success + */ +int32_t osdgenInitialize(void) +{ + AttitudeActualInitialize(); +#ifdef PIOS_INCLUDE_GPS + GPSPositionInitialize(); +#if !defined(PIOS_GPS_MINIMAL) + GPSTimeInitialize(); + GPSSatellitesInitialize(); +#endif +#ifdef PIOS_GPS_SETS_HOMELOCATION + HomeLocationInitialize(); +#endif +#endif + return 0; +} +MODULE_INITCALL(osdgenInitialize, osdgenStart) + +// **************** +/** + * Main osd task. It does not return. + */ + +static void osdgenTask(void *parameters) +{ + portTickType lastSysTime; + AttitudeActualData attitude; + GPSPositionData gpsData; + // Loop forever + lastSysTime = xTaskGetTickCount(); + + // intro + for(int i=0; i<125; i++) + { + clearGraphics(); + introGraphics(); + xSemaphoreTake(osdSemaphore, portMAX_DELAY); + } + for(int i=0; i<125; i++) + { + clearGraphics(); + introGraphics(); + introText(); + xSemaphoreTake(osdSemaphore, portMAX_DELAY); + } + + while (1) + { + GPSPositionGet(&gpsData); + AttitudeActualGet(&attitude); + setAttitudeOsd((int16_t)attitude.Pitch,(int16_t)attitude.Roll,(int16_t)attitude.Yaw); + setGpsOsd(gpsData.Status,gpsData.Latitude,gpsData.Longitude,gpsData.Altitude,gpsData.Groundspeed); + updateOnceEveryFrame(); + xSemaphoreTake(osdSemaphore, portMAX_DELAY); + //vTaskDelayUntil(&lastSysTime, 10 / portTICK_RATE_MS); + } +} + + +// **************** + +/** + * @} + * @} + */ diff --git a/flight/Modules/Osd/osdinput/inc/osdinput.h b/flight/Modules/Osd/osdinput/inc/osdinput.h new file mode 100644 index 000000000..b19318a47 --- /dev/null +++ b/flight/Modules/Osd/osdinput/inc/osdinput.h @@ -0,0 +1,15 @@ +/* + * OpOsd.h + * + * Created on: 2.10.2011 + * Author: Samba + */ + +#ifndef OPOSD_H_ +#define OPOSD_H_ + +#include "openpilot.h" + +int32_t OpOsdInitialize(void); + +#endif /* OPOSD_H_ */ diff --git a/flight/Modules/Osd/osdinput/osdinput.c b/flight/Modules/Osd/osdinput/osdinput.c new file mode 100644 index 000000000..169882e6f --- /dev/null +++ b/flight/Modules/Osd/osdinput/osdinput.c @@ -0,0 +1,285 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotModules OpenPilot Modules + * @{ + * @addtogroup osdinputModule osdinput Module + * @brief Process osdinput information + * @{ + * + * @file osdinput.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief osdinput module, handles osdinput stream + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +// **************** + +#include "openpilot.h" +#include "osdinput.h" +#include "attitudeactual.h" +#include "fifo_buffer.h" + + +// **************** +// Private functions + +static void OpOsdTask(void *parameters); + +// **************** +// Private constants + +#define GPS_TIMEOUT_MS 500 +#define NMEA_MAX_PACKET_LENGTH 33 // 82 max NMEA msg size plus 12 margin (because some vendors add custom crap) plus CR plus Linefeed +// same as in COM buffer + + +#ifdef PIOS_GPS_SETS_HOMELOCATION +// Unfortunately need a good size stack for the WMM calculation + #define STACK_SIZE_BYTES 800 +#else + #define STACK_SIZE_BYTES 1024 +#endif + +#define TASK_PRIORITY (tskIDLE_PRIORITY + 4) + +// **************** +// Private variables + +//static uint32_t oposdPort; + +static xTaskHandle OpOsdTaskHandle; + +static char* oposd_rx_buffer; +t_fifo_buffer rx; + +static uint32_t timeOfLastCommandMs; +static uint32_t timeOfLastUpdateMs; +static uint32_t numUpdates; +static uint32_t numChecksumErrors; +static uint32_t numParsingErrors; + +// **************** +/** + * Initialise the gps module + * \return -1 if initialisation failed + * \return 0 on success + */ + +int32_t OpOsdStart(void) +{ + // Start gps task + xTaskCreate(OpOsdTask, (signed char *)"OSD", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &OpOsdTaskHandle); + TaskMonitorAdd(TASKINFO_RUNNING_GPS, OpOsdTaskHandle); + + return 0; +} +/** + * Initialise the gps module + * \return -1 if initialisation failed + * \return 0 on success + */ +int32_t OpOsdInitialize(void) +{ + AttitudeActualInitialize(); + // Initialize quaternion + AttitudeActualData attitude; + AttitudeActualGet(&attitude); + attitude.q1 = 1; + attitude.q2 = 0; + attitude.q3 = 0; + attitude.q4 = 0; + attitude.Roll = 0; + attitude.Pitch = 0; + attitude.Yaw = 0; + AttitudeActualSet(&attitude); + + + // TODO: Get gps settings object +/* oposdPort = PIOS_COM_OSD;*/ + + oposd_rx_buffer = pvPortMalloc(NMEA_MAX_PACKET_LENGTH); + PIOS_Assert(oposd_rx_buffer); + + return 0; +} +MODULE_INITCALL(OpOsdInitialize, OpOsdStart) + +// **************** +/** + * Main gps task. It does not return. + */ + +static void OpOsdTask(void *parameters) +{ + portTickType lastSysTime; + // Loop forever + lastSysTime = xTaskGetTickCount(); //portTickType xDelay = 100 / portTICK_RATE_MS; + uint32_t timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS;; + //GPSPositionData GpsData; + + //uint8_t rx_count = 0; + //bool start_flag = false; + //bool found_cr = false; + //int32_t gpsRxOverflow = 0; + + numUpdates = 0; + numChecksumErrors = 0; + numParsingErrors = 0; + + timeOfLastUpdateMs = timeNowMs; + timeOfLastCommandMs = timeNowMs; + uint8_t rx_count = 0; + bool start_flag = false; + //bool found_cr = false; + int32_t gpsRxOverflow = 0; + uint8_t c=0xAA; + // Loop forever + while (1) + { + //DMA_Cmd(DMA1_Stream2, DISABLE); //prohibit channel3 for a little time + uint16_t cnt = DMA_GetCurrDataCounter(DMA1_Stream2); + rx.wr = rx.buf_size-cnt; + if(rx.wr) + { + //PIOS_LED_Toggle(LED2); + while ( fifoBuf_getData(&rx, &c, 1) > 0) + { + + // detect start while acquiring stream + if (!start_flag && ((c == 0xCB) || (c == 0x34))) + { + start_flag = true; + rx_count = 0; + } + else + if (!start_flag) + continue; + + if (rx_count >= 11) + { + // The buffer is already full and we haven't found a valid NMEA sentence. + // Flush the buffer and note the overflow event. + gpsRxOverflow++; + start_flag = false; + rx_count = 0; + } + else + { + oposd_rx_buffer[rx_count] = c; + rx_count++; + } + if (start_flag && rx_count == 11) + { + //PIOS_LED_Toggle(LED3); + if(oposd_rx_buffer[1]==3) + { + AttitudeActualData attitude; + AttitudeActualGet(&attitude); + attitude.q1 = 1; + attitude.q2 = 0; + attitude.q3 = 0; + attitude.q4 = 0; + attitude.Roll = (int16_t)(oposd_rx_buffer[3] | oposd_rx_buffer[4]<<8); + attitude.Pitch = (int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8); + attitude.Yaw = (int16_t)(oposd_rx_buffer[7] | oposd_rx_buffer[8]<<8); + AttitudeActualSet(&attitude); + /*setAttitudeOsd((int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8), //pitch + (int16_t)(oposd_rx_buffer[3] | oposd_rx_buffer[4]<<8), //roll + (int16_t)(oposd_rx_buffer[7] | oposd_rx_buffer[8]<<8)); //yaw*/ + + } + //frame completed + start_flag = false; + rx_count = 0; + } + } + } + //DMA_Cmd(DMA1_Stream2, ENABLE); + + + + /*uint8_t c=0xAA; + //PIOS_COM_SendBufferNonBlocking(oposdPort, &c, 1); + + // This blocks the task until there is something on the buffer + while (PIOS_COM_ReceiveBuffer(oposdPort, &c, 1, xDelay) > 0) + { + + // detect start while acquiring stream + if (!start_flag && ((c == 0xCB) || (c == 0x34))) + { + start_flag = true; + rx_count = 0; + } + else + if (!start_flag) + continue; + + if (rx_count >= 11) + { + // The buffer is already full and we haven't found a valid NMEA sentence. + // Flush the buffer and note the overflow event. + gpsRxOverflow++; + start_flag = false; + rx_count = 0; + } + else + { + oposd_rx_buffer[rx_count] = c; + rx_count++; + } + if (rx_count == 11) + { + AttitudeActualData attitude; + AttitudeActualGet(&attitude); + attitude.q1 = 1; + attitude.q2 = 0; + attitude.q3 = 0; + attitude.q4 = 0; + attitude.Roll = (int16_t)(oposd_rx_buffer[3] | oposd_rx_buffer[4]<<8); + attitude.Pitch = (int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8); + attitude.Yaw = 0; + AttitudeActualSet(&attitude); + } + }*/ + vTaskDelayUntil(&lastSysTime, 50 / portTICK_RATE_MS); + // Check for GPS timeout + timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS; + if ((timeNowMs - timeOfLastUpdateMs) >= GPS_TIMEOUT_MS) + { // we have not received any valid GPS sentences for a while. + // either the GPS is not plugged in or a hardware problem or the GPS has locked up. + + + } + else + { // we appear to be receiving GPS sentences OK, we've had an update + + + } + + } +} + + +// **************** + +/** + * @} + * @} + */ diff --git a/flight/OSD/Makefile b/flight/OSD/Makefile new file mode 100644 index 000000000..2442dc154 --- /dev/null +++ b/flight/OSD/Makefile @@ -0,0 +1,502 @@ + ##### + # Project: OpenPilot AHRS + # + # + # Makefile for OpenPilot AHRS project + # + # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. + # + # + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation; either version 3 of the License, or + # (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, but + # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + # for more details. + # + # You should have received a copy of the GNU General Public License along + # with this program; if not, write to the Free Software Foundation, Inc., + # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ##### + +WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) +TOP := $(realpath $(WHEREAMI)/../../) +include $(TOP)/make/firmware-defs.mk +include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk + +# Target file name (without extension). +TARGET := fw_$(BOARD_NAME) + +# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.) +OUTDIR := $(TOP)/build/$(TARGET) + +# Set developer code and compile options +# Set to YES for debugging +DEBUG ?= NO + +# Set to YES when using Code Sourcery toolchain +CODE_SOURCERY ?= YES + +ifeq ($(CODE_SOURCERY), YES) +REMOVE_CMD = cs-rm +else +REMOVE_CMD = rm +endif + +FLASH_TOOL = OPENOCD + +# List of modules to include +MODULES = GPS Osd/osdgen Osd/osdinput Telemetry #FirmwareIAP + + +# Paths +OPSYSTEM = ./System +OPSYSTEMINC = $(OPSYSTEM)/inc +OPUAVTALK = ../UAVTalk +OPUAVTALKINC = $(OPUAVTALK)/inc +OPTESTS = ./Tests +OPMODULEDIR = ../Modules +PIOS = ../PiOS +PIOSINC = $(PIOS)/inc +FLIGHTLIB = ../Libraries +FLIGHTLIBINC = ../Libraries/inc +PIOSSTM32F4XX = $(PIOS)/STM32F4xx +PIOSCOMMON = $(PIOS)/Common +PIOSBOARDS = $(PIOS)/Boards +PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries +PIOS_DEVLIB = $(PIOS)/STM32F4xx +APPLIBDIR = $(PIOSSTM32F4XX)/Libraries +STMLIBDIR = $(APPLIBDIR) +STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver +STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver +STMSPDSRCDIR = $(STMSPDDIR)/src +STMSPDINCDIR = $(STMSPDDIR)/inc +CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 +RTOSDIR = $(PIOSCOMMONLIB)/FreeRTOS +RTOSSRCDIR = $(RTOSDIR)/Source +RTOSINCDIR = $(RTOSSRCDIR)/include +OPDIR = ../OpenPilot +OPUAVOBJ = ../UAVObjects +OPUAVOBJINC = $(OPUAVOBJ)/inc +OPSYSINC = $(OPDIR)/System/inc +BOOT = ../Bootloaders/AHRS +BOOTINC = $(BOOT)/inc + +OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight + +# List C source files here. (C dependencies are automatically generated.) +# use file-extension c for "c-only"-files + +## AHRS: +## MODULES +SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} +## OPENPILOT CORE: +SRC += ${OPMODULEDIR}/System/systemmod.c +SRC += $(OPSYSTEM)/osd.c +SRC += $(OPSYSTEM)/pios_board.c +SRC += $(OPSYSTEM)/pios_usb_board_data.c +#SRC += linedriver.c +#SRC += textdriver.c +#SRC += graphicdriver.c +#SRC += watchdog.c +SRC += $(OPSYSTEM)/fonts.c +SRC += $(OPSYSTEM)/font_outlined8x14.c +SRC += $(OPSYSTEM)/font_outlined8x8.c +SRC += $(FLIGHTLIB)/fifo_buffer.c +SRC += $(OPSYSTEM)/alarms.c +SRC += $(OPSYSTEM)/taskmonitor.c +SRC += $(OPUAVTALK)/uavtalk.c +SRC += $(OPUAVOBJ)/uavobjectmanager.c +SRC += $(OPUAVOBJ)/eventdispatcher.c +#SRC += $(OPSYSTEM)/pios_usb_hid_desc.c + +## UAVOBJECTS +#SRC += $(OPUAVSYNTHDIR)/accessorydesired.c +SRC += $(OPUAVSYNTHDIR)/objectpersistence.c +SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c +SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c +SRC += $(OPUAVSYNTHDIR)/flightstatus.c +SRC += $(OPUAVSYNTHDIR)/systemstats.c +SRC += $(OPUAVSYNTHDIR)/systemalarms.c +SRC += $(OPUAVSYNTHDIR)/systemsettings.c +#SRC += $(OPUAVSYNTHDIR)/stabilizationdesired.c +#SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c +#SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c +#SRC += $(OPUAVSYNTHDIR)/actuatordesired.c +#SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c +#SRC += $(OPUAVSYNTHDIR)/attituderaw.c +SRC += $(OPUAVSYNTHDIR)/attitudeactual.c +#SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c +#SRC += $(OPUAVSYNTHDIR)/i2cstats.c +#S#RC += $(OPUAVSYNTHDIR)/watchdogstatus.c +#SRC += $(OPUAVSYNTHDIR)/telemetrysettings.c +#SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c +#SRC += $(OPUAVSYNTHDIR)/mixersettings.c +SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c +#SRC += $(OPUAVSYNTHDIR)/attitudesettings.c +#SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c +#SRC += $(OPUAVSYNTHDIR)/cameradesired.c +SRC += $(OPUAVSYNTHDIR)/hwsettings.c +#SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c +#SRC += $(OPUAVSYNTHDIR)/receiveractivity.c +SRC += $(OPUAVSYNTHDIR)/taskinfo.c +SRC += $(OPUAVSYNTHDIR)/mixerstatus.c +#SRC += $(OPUAVSYNTHDIR)/ratedesired.c +SRC += $(OPUAVSYNTHDIR)/gpsposition.c +SRC += $(OPUAVSYNTHDIR)/gpssatellites.c +SRC += $(OPUAVSYNTHDIR)/gpstime.c + +## PIOS Hardware (STM32F10x) +#SRC += $(PIOSSTM32F4XX)/pios_adc.c +#SRC += $(PIOSSTM32F4XX)/pios_sys.c +#SRC += $(PIOSSTM32F4XX)/pios_led.c +#SRC += $(PIOSSTM32F4XX)/pios_delay.c +#SRC += $(PIOSSTM32F4XX)/pios_usart.c +#SRC += $(PIOSSTM32F4XX)/pios_irq.c +#SRC += $(PIOSSTM32F4XX)/pios_i2c.c +#SRC += $(PIOSSTM32F4XX)/pios_gpio.c +#SRC += $(PIOSSTM32F4XX)/pios_spi.c +#SRC += $(PIOSSTM32F4XX)/pios_exti.c +#SRC += $(PIOSSTM32F4XX)/pios_rtc.c +#SRC += $(PIOSSTM32F4XX)/pios_wdg.c + +## PIOS Hardware (Common) +SRC += $(PIOSCOMMON)/pios_com.c +#SRC += $(PIOSCOMMON)/pios_hmc5843.c +SRC += $(PIOSCOMMON)/printf-stdarg.c +SRC += $(PIOSCOMMON)/pios_crc.c +#SRC += $(PIOSCOMMON)/pios_iap.c +SRC += $(PIOSCOMMON)/pios_video.c +SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c +SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c + +# optional component libraries +include $(PIOSCOMMONLIB)/FreeRTOS/library.mk +#include $(PIOSCOMMONLIB)/dosfs/library.mk +include $(PIOSCOMMONLIB)/msheap/library.mk + +## PIOS Hardware (STM32F4xx) +include $(PIOS)/STM32F4xx/library.mk + + +# List C source files here which must be compiled in ARM-Mode (no -mthumb). +# use file-extension c for "c-only"-files +## just for testing, timer.c could be compiled in thumb-mode too +SRCARM = + +# List C++ source files here. +# use file-extension .cpp for C++-files (not .C) +CPPSRC = + +# List C++ source files here which must be compiled in ARM-Mode. +# use file-extension .cpp for C++-files (not .C) +#CPPSRCARM = $(TARGET).cpp +CPPSRCARM = + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +#ASRC = $(PIOSSTM32F4XX)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S + +# List Assembler source files here which must be assembled in ARM-Mode.. +ASRCARM = + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS += $(OPSYSTEM) +EXTRAINCDIRS += $(AHRSINC) +EXTRAINCDIRS += $(OPSYSTEMINC) +EXTRAINCDIRS += $(OPUAVTALK) +EXTRAINCDIRS += $(OPUAVTALKINC) +EXTRAINCDIRS += $(OPUAVOBJ) +EXTRAINCDIRS += $(OPUAVOBJINC) +EXTRAINCDIRS += $(OPUAVSYNTHDIR) +EXTRAINCDIRS += $(PIOS) +EXTRAINCDIRS += $(PIOSINC) +EXTRAINCDIRS += $(FLIGHTLIBINC) +EXTRAINCDIRS += $(PIOSSTM32F4XX) +EXTRAINCDIRS += $(PIOSCOMMON) +EXTRAINCDIRS += $(PIOSBOARDS) +EXTRAINCDIRS += $(STMSPDINCDIR) +EXTRAINCDIRS += $(CMSISDIR) +EXTRAINCDIRS += $(RTOSINCDIR) +EXTRAINCDIRS += $(APPLIBDIR) +EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3 +EXTRAINCDIRS += $(AHRSINC) +EXTRAINCDIRS += $(OPUAVSYNTHDIR) +EXTRAINCDIRS += $(BOOTINC) + +EXTRAINCDIRS += ${foreach MOD, ${MODULES}, ${OPMODULEDIR}/${MOD}/inc} ${OPMODULEDIR}/System/inc + +# List any extra directories to look for library files here. +# Also add directories where the linker should search for +# includes from linker-script to the list +# Each directory must be seperated by a space. +EXTRA_LIBDIRS = + +# Extra Libraries +# Each library-name must be seperated by a space. +# i.e. to link with libxyz.a, libabc.a and libefsl.a: +# EXTRA_LIBS = xyz abc efsl +# for newlib-lpc (file: libnewlibc-lpc.a): +# EXTRA_LIBS = newlib-lpc +EXTRA_LIBS = + +# Path to Linker-Scripts +LINKERSCRIPTPATH = $(PIOSSTM32F4XX) + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) + +ifeq ($(DEBUG),YES) +CFLAGS += -O0 +CFLAGS += -DGENERAL_COV +CFLAGS += -finstrument-functions -ffixed-r10 +else +CFLAGS += -Os +endif + + + +# common architecture-specific flags from the device-specific library makefile +CFLAGS += $(ARCHFLAGS) + + +#CFLAGS += -DDIAGNOSTICS + +# This is not the best place for these. Really should abstract out +# to the board file or something +CFLAGS += -DSTM32F4XX +CFLAGS += -DMEM_SIZE=1024000000 + + +# Output format. (can be ihex or binary or both) +# binary to create a load-image in raw-binary format i.e. for SAM-BA, +# ihex to create a load-image in Intel hex format +#LOADFORMAT = ihex +#LOADFORMAT = binary +LOADFORMAT = both + +# Debugging format. +DEBUGF = dwarf-2 + +# Place project-specific -D (define) and/or +# -U options for C here. +CDEFS += -DSTM32F10X_$(MODEL) +CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) +CDEFS += -DUSE_STDPERIPH_DRIVER +CDEFS += -DUSE_$(BOARD) + +# Place project-specific -D and/or -U options for +# Assembler with preprocessor here. +#ADEFS = -DUSE_IRQ_ASM_WRAPPER +ADEFS = -D__ASSEMBLY__ + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +#----- + +# Compiler flags. + +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +# +# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) + +CFLAGS += -g$(DEBUGF) + +CFLAGS += -ffast-math + +CFLAGS += -mcpu=$(MCU) +CFLAGS += $(CDEFS) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. + +CFLAGS += -mapcs-frame +CFLAGS += -fomit-frame-pointer +ifeq ($(CODE_SOURCERY), YES) +CFLAGS += -fpromote-loop-indices +endif + +CFLAGS += -Wall +#CFLAGS += -Werror +CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) +# Compiler flags to generate dependency files: +CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d + +# flags only for C +#CONLYFLAGS += -Wnested-externs +CONLYFLAGS += $(CSTANDARD) + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlns: create listing +ASFLAGS = $(ARCHFLAGS) -mthumb -I. -x assembler-with-cpp +ASFLAGS += $(ADEFS) +ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) +ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) + +MATH_LIB = -lm + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections +LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) +LDFLAGS += -lc +LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) +LDFLAGS += $(MATH_LIB) +LDFLAGS += -lc -lgcc + +#Linker scripts +LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP)) + + +# Define programs and commands. +REMOVE = $(REMOVE_CMD) -f + +# List of all source files. +ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) +# List of all source files without directory and file-extension. +ALLSRCBASE = $(notdir $(basename $(ALLSRC))) + +# Define all object files. +ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) + +# Define all listing files (used for make clean). +LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) +# Define all depedency-files (used for make clean). +DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) + +# Default target. +all: gccversion build + +ifeq ($(LOADFORMAT),ihex) +build: elf hex lss sym +else +ifeq ($(LOADFORMAT),binary) +build: elf bin lss sym +else +ifeq ($(LOADFORMAT),both) +build: elf hex bin lss sym +else +$(error "$(MSG_FORMATERROR) $(FORMAT)") +endif +endif +endif + +# Link: create ELF output file from object files. +$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) + +# Assemble: create object files from assembler source files. +$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) + +# Assemble: create object files from assembler source files. ARM-only +$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) + +# Compile: create object files from C source files. +$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) + +# Compile: create object files from C source files. ARM-only +$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) + +# Compile: create object files from C++ source files. +$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) + +# Compile: create object files from C++ source files. ARM-only +$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) + +# Compile: create assembler files from C source files. ARM/Thumb +$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) + +# Compile: create assembler files from C source files. ARM only +$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) + +$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin + +$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) + +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_CONFIG))) + +.PHONY: elf lss sym hex bin bino opfw +elf: $(OUTDIR)/$(TARGET).elf +lss: $(OUTDIR)/$(TARGET).lss +sym: $(OUTDIR)/$(TARGET).sym +hex: $(OUTDIR)/$(TARGET).hex +bin: $(OUTDIR)/$(TARGET).bin +bino: $(OUTDIR)/$(TARGET).bin.o +opfw: $(OUTDIR)/$(TARGET).opfw + +# Display sizes of sections. +$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) + +# Generate Doxygen documents +docs: + doxygen $(DOXYGENDIR)/doxygen.cfg + +# Install: install binary file with prefix/suffix into install directory +install: $(OUTDIR)/$(TARGET).opfw +ifneq ($(INSTALL_DIR),) + @echo $(MSG_INSTALLING) $(call toprel, $<) + $(V1) mkdir -p $(INSTALL_DIR) + $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw +else + $(error INSTALL_DIR must be specified for $@) +endif + +# Target: clean project. +clean: clean_list + +clean_list : + @echo $(MSG_CLEANING) + $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map + $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf + $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex + $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin + $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym + $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss + $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o + $(V1) $(REMOVE) $(ALLOBJ) + $(V1) $(REMOVE) $(LSTFILES) + $(V1) $(REMOVE) $(DEPFILES) + $(V1) $(REMOVE) $(SRC:.c=.s) + $(V1) $(REMOVE) $(SRCARM:.c=.s) + $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) + $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) + +# Create output files directory +# all known MS Windows OS define the ComSpec environment variable +ifdef ComSpec +$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) +else +$(shell mkdir -p $(OUTDIR) 2>/dev/null) +endif + +# Include the dependency files. +ifdef ComSpec +-include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) +else +-include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) +endif + +# Listing of phony targets. +.PHONY : all build clean clean_list install \ No newline at end of file diff --git a/flight/OSD/System/alarms.c b/flight/OSD/System/alarms.c new file mode 100644 index 000000000..e61c7c1ea --- /dev/null +++ b/flight/OSD/System/alarms.c @@ -0,0 +1,210 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotLibraries OpenPilot System Libraries + * @brief OpenPilot System libraries are available to all OP modules. + * @{ + * @file alarms.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Library for setting and clearing system alarms + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "openpilot.h" +#include "alarms.h" + +// Private constants + +// Private types + +// Private variables +static xSemaphoreHandle lock; + +// Private functions +static int32_t hasSeverity(SystemAlarmsAlarmOptions severity); + +/** + * Initialize the alarms library + */ +int32_t AlarmsInitialize(void) +{ + SystemAlarmsInitialize(); + lock = xSemaphoreCreateRecursiveMutex(); + return 0; +} + +/** + * Set an alarm + * @param alarm The system alarm to be modified + * @param severity The alarm severity + * @return 0 if success, -1 if an error + */ +int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity) +{ + SystemAlarmsData alarms; + + // Check that this is a valid alarm + if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) + { + return -1; + } + + // Lock + xSemaphoreTakeRecursive(lock, portMAX_DELAY); + + // Read alarm and update its severity only if it was changed + SystemAlarmsGet(&alarms); + if ( alarms.Alarm[alarm] != severity ) + { + alarms.Alarm[alarm] = severity; + SystemAlarmsSet(&alarms); + } + + // Release lock + xSemaphoreGiveRecursive(lock); + return 0; + +} + +/** + * Get an alarm + * @param alarm The system alarm to be read + * @return Alarm severity + */ +SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) +{ + SystemAlarmsData alarms; + + // Check that this is a valid alarm + if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) + { + return 0; + } + + // Read alarm + SystemAlarmsGet(&alarms); + return alarms.Alarm[alarm]; +} + +/** + * Set an alarm to it's default value + * @param alarm The system alarm to be modified + * @return 0 if success, -1 if an error + */ +int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm) +{ + return AlarmsSet(alarm, SYSTEMALARMS_ALARM_DEFAULT); +} + +/** + * Default all alarms + */ +void AlarmsDefaultAll() +{ + uint32_t n; + for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) + { + AlarmsDefault(n); + } +} + +/** + * Clear an alarm + * @param alarm The system alarm to be modified + * @return 0 if success, -1 if an error + */ +int32_t AlarmsClear(SystemAlarmsAlarmElem alarm) +{ + return AlarmsSet(alarm, SYSTEMALARMS_ALARM_OK); +} + +/** + * Clear all alarms + */ +void AlarmsClearAll() +{ + uint32_t n; + for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) + { + AlarmsClear(n); + } +} + +/** + * Check if there are any alarms with the given or higher severity + * @return 0 if no alarms are found, 1 if at least one alarm is found + */ +int32_t AlarmsHasWarnings() +{ + return hasSeverity(SYSTEMALARMS_ALARM_WARNING); +} + +/** + * Check if there are any alarms with error or higher severity + * @return 0 if no alarms are found, 1 if at least one alarm is found + */ +int32_t AlarmsHasErrors() +{ + return hasSeverity(SYSTEMALARMS_ALARM_ERROR); +}; + +/** + * Check if there are any alarms with critical or higher severity + * @return 0 if no alarms are found, 1 if at least one alarm is found + */ +int32_t AlarmsHasCritical() +{ + return hasSeverity(SYSTEMALARMS_ALARM_CRITICAL); +}; + +/** + * Check if there are any alarms with the given or higher severity + * @return 0 if no alarms are found, 1 if at least one alarm is found + */ +static int32_t hasSeverity(SystemAlarmsAlarmOptions severity) +{ + SystemAlarmsData alarms; + uint32_t n; + + // Lock + xSemaphoreTakeRecursive(lock, portMAX_DELAY); + + // Read alarms + SystemAlarmsGet(&alarms); + + // Go through alarms and check if any are of the given severity or higher + for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) + { + if ( alarms.Alarm[n] >= severity) + { + xSemaphoreGiveRecursive(lock); + return 1; + } + } + + // If this point is reached then no alarms found + xSemaphoreGiveRecursive(lock); + return 0; +} +/** + * @} + * @} + */ + diff --git a/flight/OSD/System/font_outlined8x14.c b/flight/OSD/System/font_outlined8x14.c new file mode 100644 index 000000000..13b86e739 --- /dev/null +++ b/flight/OSD/System/font_outlined8x14.c @@ -0,0 +1,268 @@ +/** + * Super OSD, software revision 3 + * Copyright (C) 2010 Thomas Oldbury + * + * Please note the font data here is covered under Creative + * Commons licenses (version 3.0 BY-SA) and *not* the GPL. + */ + +// This data is generated by a Python script from +// the original font .pngs. + +// 0xff = indicates character not present +// any other byte contains the index of the character. +const char font_lookup_outlined8x14[256] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x01, 0x02, 0x03, 0xff, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, + 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, + 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, + 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, + 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, + 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, + 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0xff, + 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, + 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +const char font_data_outlined8x14[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, + 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, // 0x21 + 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x22 + 0x7e, 0xff, 0xff, 0xff, 0x7e, 0xff, 0xff, 0xff, 0x7e, 0xff, 0xff, 0xff, 0x7e, 0x00, + 0x00, 0x24, 0x7e, 0x24, 0x24, 0x24, 0x7e, 0x24, 0x24, 0x24, 0x7e, 0x24, 0x00, 0x00, // 0x23 + 0x00, 0x70, 0x70, 0x72, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0x4e, 0x0e, 0x0e, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x04, 0x00, 0x00, // 0x25 + 0x38, 0x3c, 0x7c, 0x7c, 0x7c, 0xfc, 0xee, 0xef, 0xef, 0xff, 0xff, 0x7e, 0x00, 0x00, + 0x00, 0x18, 0x28, 0x10, 0x28, 0x28, 0x44, 0x44, 0x46, 0x44, 0x3a, 0x00, 0x00, 0x00, // 0x26 + 0x38, 0x38, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x27 + 0x1e, 0x3e, 0x7e, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x7e, 0x3e, 0x1e, 0x00, + 0x00, 0x1c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, // 0x28 + 0x78, 0x7c, 0x7e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x7e, 0x7c, 0x78, 0x00, + 0x00, 0x38, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x38, 0x00, 0x00, // 0x29 + 0x38, 0x7c, 0xfe, 0xfe, 0xfe, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x7c, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2a + 0x00, 0x00, 0x00, 0x38, 0x38, 0xfe, 0xfe, 0xfe, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2b + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x10, 0x00, 0x00, // 0x2c + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x2d + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, // 0x2e + 0x00, 0x07, 0x07, 0x0f, 0x0e, 0x1c, 0x1c, 0x38, 0x38, 0x70, 0xf0, 0xe0, 0xe0, 0x00, + 0x00, 0x00, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x00, 0x00, // 0x2f + 0x7e, 0xff, 0xff, 0xe7, 0xef, 0xff, 0xff, 0xf7, 0xe7, 0xe7, 0xff, 0xff, 0x7e, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x30 + 0x3c, 0x7c, 0xfc, 0xfc, 0x5c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x38, 0x68, 0x48, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x7e, 0x00, 0x00, // 0x31 + 0x3e, 0x7f, 0xff, 0xe7, 0x47, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x3c, 0x62, 0x42, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, // 0x32 + 0xfe, 0xff, 0xff, 0x07, 0x07, 0x7f, 0x7e, 0x7f, 0x07, 0x07, 0xff, 0xff, 0xfe, 0x00, + 0x00, 0x7c, 0x02, 0x02, 0x02, 0x04, 0x38, 0x04, 0x02, 0x02, 0x02, 0x7c, 0x00, 0x00, // 0x33 + 0x04, 0x0e, 0x1e, 0x3e, 0x7e, 0xff, 0xff, 0xff, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x00, + 0x00, 0x04, 0x0c, 0x14, 0x24, 0x44, 0x7e, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, // 0x34 + 0xff, 0xff, 0xff, 0xe0, 0xfc, 0xfe, 0xff, 0x0f, 0x07, 0x0f, 0xff, 0xfe, 0xfc, 0x00, + 0x00, 0x7e, 0x40, 0x40, 0x40, 0x78, 0x04, 0x02, 0x02, 0x02, 0x04, 0x78, 0x00, 0x00, // 0x35 + 0xfe, 0xfe, 0xfe, 0xe0, 0xe0, 0xfe, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0x7e, 0x00, + 0x00, 0x3c, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x36 + 0xff, 0xff, 0xff, 0x07, 0x07, 0x0e, 0x0e, 0x1c, 0x1c, 0x38, 0x38, 0x70, 0x70, 0x00, + 0x00, 0x7e, 0x02, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, // 0x37 + 0x3c, 0x7e, 0xff, 0xe7, 0xe7, 0xff, 0x7e, 0xff, 0xe7, 0xe7, 0xff, 0x7e, 0x3c, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x38 + 0x7e, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0x7f, 0x07, 0x07, 0x7f, 0x7f, 0x7f, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x02, 0x3c, 0x00, 0x00, // 0x39 + 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, // 0x3a + 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x10, 0x00, 0x00, // 0x3b + 0x00, 0x00, 0x04, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, // 0x3c + 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x3d + 0x00, 0x00, 0x20, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, // 0x3e + 0x3c, 0xfe, 0xff, 0xe7, 0xe7, 0x0e, 0x1c, 0x38, 0x38, 0x00, 0x38, 0x38, 0x38, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // 0x3f + 0x18, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7c, 0x3e, 0x1e, 0x00, + 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x4a, 0x52, 0x52, 0x4c, 0x20, 0x1e, 0x00, 0x00, // 0x40 + 0x7e, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x3c, 0x66, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, // 0x41 + 0xfe, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0xfe, 0x00, + 0x00, 0x7c, 0x46, 0x42, 0x42, 0x42, 0x7c, 0x42, 0x42, 0x42, 0x46, 0x7c, 0x00, 0x00, // 0x42 + 0x7f, 0xff, 0xff, 0xf7, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xf7, 0xff, 0xff, 0x7f, 0x00, + 0x00, 0x3e, 0x62, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x62, 0x3e, 0x00, 0x00, // 0x43 + 0xfe, 0xff, 0xff, 0xef, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xef, 0xff, 0xff, 0xfe, 0x00, + 0x00, 0x7c, 0x46, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x7c, 0x00, 0x00, // 0x44 + 0xff, 0xff, 0xff, 0xe0, 0xe0, 0xfe, 0xfe, 0xfe, 0xe0, 0xe0, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, // 0x45 + 0xff, 0xff, 0xff, 0xe0, 0xe0, 0xfe, 0xfe, 0xfe, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, + 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, // 0x46 + 0x7f, 0xff, 0xff, 0xf0, 0xe0, 0xef, 0xef, 0xef, 0xe7, 0xf7, 0xff, 0xff, 0x7f, 0x00, + 0x00, 0x3e, 0x60, 0x40, 0x40, 0x40, 0x46, 0x42, 0x42, 0x42, 0x62, 0x3e, 0x00, 0x00, // 0x47 + 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, // 0x48 + 0xfe, 0xfe, 0xfe, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, // 0x49 + 0xff, 0xff, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x3c, 0xfc, 0xfc, 0xf8, 0x00, + 0x00, 0x7e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0x70, 0x00, 0x00, // 0x4a + 0xe7, 0xef, 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xf8, 0xfc, 0xfe, 0xff, 0xef, 0xe7, 0x00, + 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x40, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, // 0x4b + 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, // 0x4c + 0xe7, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x42, 0x66, 0x5a, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, // 0x4d + 0xe7, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xef, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x42, 0x62, 0x52, 0x4a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, // 0x4e + 0x7e, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0x7e, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x4f + 0xfe, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0xfe, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, + 0x00, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, // 0x50 + 0x7e, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0x7f, 0x07, 0x07, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x02, 0x02, 0x00, 0x00, // 0x51 + 0xfe, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0xfe, 0xf8, 0xfc, 0xee, 0xe7, 0xe3, 0x00, + 0x00, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, // 0x52 + 0xff, 0xff, 0xff, 0xe0, 0xf0, 0xfe, 0xff, 0x7f, 0x0f, 0x07, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x7e, 0x40, 0x40, 0x40, 0x60, 0x3c, 0x06, 0x02, 0x02, 0x02, 0x7e, 0x00, 0x00, // 0x53 + 0xfe, 0xfe, 0xfe, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x00, + 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, // 0x54 + 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0x7e, 0x3c, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x55 + 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xfe, 0x7e, 0x7e, 0x7e, 0x3c, 0x3c, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, // 0x56 + 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x5a, 0x66, 0x42, 0x00, 0x00, // 0x57 + 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x42, 0x42, 0x42, 0x00, 0x00, // 0x58 + 0xee, 0xee, 0xfe, 0xfe, 0x7c, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x00, + 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, // 0x59 + 0xff, 0xff, 0xff, 0x07, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x7e, 0x02, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7e, 0x00, 0x00, // 0x5a + 0x7e, 0x7e, 0x7e, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00, // 0x5b + 0x00, 0xe0, 0xe0, 0xf0, 0x70, 0x38, 0x38, 0x1c, 0x1c, 0x0e, 0x0f, 0x07, 0x07, 0x00, + 0x00, 0x00, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x02, 0x00, 0x00, // 0x5c + 0x7e, 0x7e, 0x7e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00, // 0x5d + 0x3c, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x5e + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, // 0x5f + 0x30, 0x38, 0x1c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x60 + 0x00, 0x00, 0x00, 0x00, 0x7c, 0xfc, 0xfe, 0xee, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x04, 0x3c, 0x44, 0x7a, 0x00, 0x00, // 0x61 + 0x00, 0xe0, 0xe0, 0xe0, 0xe0, 0xfe, 0xff, 0xff, 0xf7, 0xe7, 0xff, 0xff, 0x7e, 0x00, + 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x62 + 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0xff, 0xf0, 0xe0, 0xf0, 0xff, 0x7f, 0x3f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x20, 0x40, 0x40, 0x40, 0x20, 0x1e, 0x00, 0x00, // 0x63 + 0x00, 0x07, 0x07, 0x07, 0x07, 0x7f, 0xff, 0xff, 0xef, 0xe7, 0xff, 0xff, 0x7e, 0x00, + 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x64 + 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x5c, 0x40, 0x3e, 0x00, 0x00, // 0x65 + 0x3f, 0x7f, 0xff, 0xf0, 0xe0, 0xfe, 0xfe, 0xfe, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, + 0x00, 0x1e, 0x20, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, // 0x66 + 0x7c, 0xfe, 0xff, 0xef, 0xe7, 0xff, 0xff, 0x7f, 0x07, 0x0f, 0xff, 0xfe, 0xfc, 0x00, + 0x00, 0x38, 0x44, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x04, 0x78, 0x00, 0x00, // 0x67 + 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xfc, 0xfe, 0xff, 0xef, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x78, 0x44, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, // 0x68 + 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, // 0x69 + 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x3c, 0xfc, 0xfc, 0xf0, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x60, 0x00, 0x00, // 0x6a + 0x00, 0xe2, 0xe7, 0xee, 0xfc, 0xf8, 0xf0, 0xf0, 0xf8, 0xfc, 0xee, 0xe7, 0xe2, 0x00, + 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, // 0x6b + 0xf0, 0xf0, 0xf0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x78, 0x7f, 0x3f, 0x1f, 0x00, + 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x0e, 0x00, 0x00, // 0x6c + 0x00, 0x00, 0x00, 0x00, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x66, 0x5a, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, // 0x6d + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, // 0x6e + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x6f + 0x3c, 0x7e, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0xfe, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, // 0x70 + 0x3c, 0x7e, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0x7f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x03, 0x02, 0x00, 0x00, // 0x71 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0xff, 0xf0, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x20, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, // 0x72 + 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfe, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x40, 0x40, 0x3c, 0x02, 0x02, 0x7e, 0x00, 0x00, // 0x73 + 0x00, 0xe0, 0xe0, 0xe0, 0xe0, 0xfc, 0xfc, 0xfc, 0xe0, 0xf0, 0xfe, 0xfe, 0x7e, 0x00, + 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x60, 0x3c, 0x00, 0x00, // 0x74 + 0x00, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, // 0x75 + 0x00, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0x7e, 0x3c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00, // 0x76 + 0x00, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x5a, 0x66, 0x42, 0x00, 0x00, // 0x77 + 0x00, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0xff, 0xff, 0x7e, 0xff, 0xe7, 0xe7, 0xe7, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, // 0x78 + 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0x07, 0x07, 0x0f, 0xff, 0xfe, 0xfc, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x02, 0x02, 0x02, 0x02, 0x04, 0x78, 0x00, 0x00, // 0x79 + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x0e, 0x1c, 0x38, 0x70, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, // 0x7a + 0x00, 0x3f, 0x7f, 0x7f, 0x70, 0xf0, 0xf0, 0xf0, 0xf0, 0x70, 0x7f, 0x7f, 0x3f, 0x00, + 0x00, 0x00, 0x1e, 0x20, 0x20, 0x20, 0x40, 0x40, 0x20, 0x20, 0x20, 0x1e, 0x00, 0x00, // 0x7b + 0x00, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x00, + 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, // 0x7c + 0x00, 0xfc, 0xfe, 0xfe, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0e, 0xfe, 0xfe, 0xfc, 0x00, + 0x00, 0x00, 0x78, 0x04, 0x04, 0x04, 0x02, 0x02, 0x04, 0x04, 0x04, 0x78, 0x00, 0x00, // 0x7d + 0x00, 0x10, 0x3a, 0x7f, 0x2e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x7e + 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x80 + 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x81 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x82 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x83 + 0x00, 0x18, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x84 + 0x00, 0x00, 0x00, 0x18, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x85 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x86 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x87 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x00, 0x00, // 0x88 + 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x7e, 0x7e, 0x3c, 0x00, + 0x00, 0x00, 0x18, 0x08, 0x18, 0x08, 0x18, 0x08, 0x18, 0x08, 0x3c, 0x3c, 0x00, 0x00, // 0x89 + 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x6e, 0x68, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x8a + 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x69, 0x6a, 0x0c, 0x0c, 0x0a, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x8b + 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1c, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x6e, 0x68, 0x08, 0x0e, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x8c + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x7c, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, // 0x8d + 0x00, 0x00, 0x00, 0x3e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x32, 0x3e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00 // 0x8e +}; diff --git a/flight/OSD/System/font_outlined8x14.h b/flight/OSD/System/font_outlined8x14.h new file mode 100644 index 000000000..614940bb3 --- /dev/null +++ b/flight/OSD/System/font_outlined8x14.h @@ -0,0 +1,12 @@ +/** + * Super OSD, software revision 3 + * Copyright (C) 2010 Thomas Oldbury + * + * Please note the font data here is covered under Creative + * Commons licenses (version 3.0 BY-SA) and *not* the GPL. + */ + +// Lookup table. +extern const char font_lookup_outlined8x14[256]; +// Data. +extern const char font_data_outlined8x14[]; diff --git a/flight/OSD/System/font_outlined8x8.c b/flight/OSD/System/font_outlined8x8.c new file mode 100644 index 000000000..e3f4ae115 --- /dev/null +++ b/flight/OSD/System/font_outlined8x8.c @@ -0,0 +1,182 @@ +/** + * Super OSD, software revision 3 + * Copyright (C) 2010 Thomas Oldbury + * + * Please note the font data here is covered under Creative + * Commons licenses (version 3.0 BY-SA) and *not* the GPL. + */ + +// This data is generated by a Python script from +// the original font .pngs. + +// 0xff = indicates character not present +// any other byte contains the index of the character. +const char font_lookup_outlined8x8[256] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x01, 0x02, 0x03, 0xff, 0xff, 0xff, 0x04, + 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, + 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, + 0x15, 0x16, 0x17, 0xff, 0x18, 0x19, 0x1a, 0x1b, + 0xff, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, + 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, + 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, + 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0xff, 0x39, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +const char font_data_outlined8x8[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x00, + 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, // 0x21 + 0x44, 0xee, 0xee, 0x44, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x22 + 0x28, 0x7c, 0xfe, 0x7c, 0xfe, 0x7c, 0x28, 0x00, + 0x00, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x00, 0x00, // 0x23 + 0x10, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x27 + 0x10, 0x38, 0x70, 0x70, 0x70, 0x38, 0x10, 0x00, + 0x00, 0x10, 0x20, 0x20, 0x20, 0x10, 0x00, 0x00, // 0x28 + 0x20, 0x70, 0x38, 0x38, 0x38, 0x70, 0x20, 0x00, + 0x00, 0x20, 0x10, 0x10, 0x10, 0x20, 0x00, 0x00, // 0x29 + 0x28, 0x7c, 0x38, 0x7c, 0x28, 0x00, 0x00, 0x00, + 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, // 0x2a + 0x38, 0x38, 0xfe, 0xfe, 0xfe, 0x38, 0x38, 0x00, + 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, // 0x2b + 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x00, 0x00, // 0x2c + 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, // 0x2d + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, // 0x2e + 0x04, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0x40, 0x00, + 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, // 0x2f + 0x7c, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x00, + 0x00, 0x38, 0x44, 0x54, 0x44, 0x38, 0x00, 0x00, // 0x30 + 0x3c, 0x7c, 0xfc, 0xfc, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x18, 0x28, 0x48, 0x08, 0x7c, 0x00, 0x00, // 0x31 + 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x78, 0x04, 0x78, 0x40, 0x7c, 0x00, 0x00, // 0x32 + 0xfe, 0xfe, 0xfe, 0x7e, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x04, 0x3c, 0x04, 0x7c, 0x00, 0x00, // 0x33 + 0xee, 0xee, 0xfe, 0xfe, 0x7e, 0x0e, 0x0e, 0x00, + 0x00, 0x44, 0x44, 0x3c, 0x04, 0x04, 0x00, 0x00, // 0x34 + 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0x00, + 0x00, 0x7c, 0x40, 0x78, 0x04, 0x78, 0x00, 0x00, // 0x35 + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x40, 0x7c, 0x44, 0x7c, 0x00, 0x00, // 0x36 + 0xfe, 0xfe, 0xfe, 0x38, 0x70, 0xe0, 0xc0, 0x00, + 0x00, 0x7c, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, // 0x37 + 0x7c, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x00, + 0x00, 0x38, 0x44, 0x7c, 0x44, 0x38, 0x00, 0x00, // 0x38 + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x7e, 0x7e, 0x00, + 0x00, 0x7c, 0x44, 0x7c, 0x04, 0x3c, 0x00, 0x00, // 0x39 + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, // 0x3a + 0x08, 0x1c, 0x38, 0x70, 0x38, 0x1c, 0x08, 0x00, + 0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00, // 0x3c + 0xfe, 0xfe, 0xfe, 0x00, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, // 0x3d + 0x20, 0x70, 0x38, 0x1c, 0x38, 0x70, 0x20, 0x00, + 0x00, 0x20, 0x10, 0x08, 0x10, 0x20, 0x00, 0x00, // 0x3e + 0x7c, 0xfe, 0xfe, 0xfe, 0x3c, 0x38, 0x38, 0x00, + 0x00, 0x38, 0x44, 0x18, 0x00, 0x10, 0x00, 0x00, // 0x3f + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xee, 0xee, 0x00, + 0x00, 0x7c, 0x44, 0x7c, 0x44, 0x44, 0x00, 0x00, // 0x41 + 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0x00, + 0x00, 0x78, 0x44, 0x7c, 0x44, 0x78, 0x00, 0x00, // 0x42 + 0xfe, 0xfe, 0xfe, 0xe0, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, // 0x43 + 0xfc, 0xfe, 0xfe, 0xee, 0xfe, 0xfe, 0xfc, 0x00, + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, // 0x44 + 0xfe, 0xfe, 0xfe, 0xfc, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x40, 0x78, 0x40, 0x7c, 0x00, 0x00, // 0x45 + 0xfe, 0xfe, 0xfe, 0xfc, 0xfc, 0xe0, 0xe0, 0x00, + 0x00, 0x7c, 0x40, 0x78, 0x40, 0x40, 0x00, 0x00, // 0x46 + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x40, 0x5c, 0x44, 0x7c, 0x00, 0x00, // 0x47 + 0xee, 0xee, 0xfe, 0xfe, 0xfe, 0xee, 0xee, 0x00, + 0x00, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x00, 0x00, // 0x48 + 0xfe, 0xfe, 0xfe, 0x38, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, // 0x49 + 0xfe, 0xfe, 0xfe, 0x1c, 0xfc, 0xfc, 0xfc, 0x00, + 0x00, 0x7c, 0x08, 0x08, 0x08, 0x78, 0x00, 0x00, // 0x4a + 0xe6, 0xee, 0xfc, 0xf8, 0xfc, 0xee, 0xe6, 0x00, + 0x00, 0x44, 0x48, 0x70, 0x48, 0x44, 0x00, 0x00, // 0x4b + 0xe0, 0xe0, 0xe0, 0xe0, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, // 0x4c + 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xee, 0x00, + 0x00, 0x28, 0x54, 0x54, 0x54, 0x44, 0x00, 0x00, // 0x4d + 0xee, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xee, 0x00, + 0x00, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x00, 0x00, // 0x4e + 0xfe, 0xfe, 0xfe, 0xee, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x44, 0x44, 0x44, 0x7c, 0x00, 0x00, // 0x4f + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xe0, 0xe0, 0x00, + 0x00, 0x7c, 0x44, 0x7c, 0x40, 0x40, 0x00, 0x00, // 0x50 + 0xfe, 0xfe, 0xfe, 0xee, 0xfc, 0xfe, 0xf6, 0x00, + 0x00, 0x7c, 0x44, 0x44, 0x48, 0x74, 0x00, 0x00, // 0x51 + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0xe8, 0x00, + 0x00, 0x7c, 0x44, 0x7c, 0x50, 0x48, 0x00, 0x00, // 0x52 + 0x7e, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0x00, + 0x00, 0x3c, 0x40, 0x7c, 0x04, 0x78, 0x00, 0x00, // 0x53 + 0xfe, 0xfe, 0xfe, 0x38, 0x38, 0x38, 0x38, 0x00, + 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, // 0x54 + 0xee, 0xee, 0xee, 0xee, 0xfe, 0xfe, 0x7c, 0x00, + 0x00, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, // 0x55 + 0xee, 0xee, 0xee, 0xfe, 0xfe, 0x7c, 0x38, 0x00, + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, // 0x56 + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x6c, 0x00, + 0x00, 0x54, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, // 0x57 + 0xee, 0xfe, 0xfe, 0x7c, 0xfe, 0xfe, 0xee, 0x00, + 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, // 0x58 + 0xee, 0xfe, 0xfe, 0x7c, 0x38, 0x38, 0x38, 0x00, + 0x00, 0x44, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00, // 0x59 + 0xfe, 0xfe, 0xfe, 0x78, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x7c, 0x08, 0x10, 0x20, 0x7c, 0x00, 0x00, // 0x5a + 0x38, 0x7c, 0x78, 0x70, 0x78, 0x7c, 0x38, 0x00, + 0x00, 0x38, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, // 0x5b + 0x40, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x04, 0x00, + 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, // 0x5c + 0x38, 0x7c, 0x3c, 0x1c, 0x3c, 0x7c, 0x38, 0x00, + 0x00, 0x38, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, // 0x5d + 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, // 0x5f + 0x10, 0x38, 0x7c, 0xfe, 0xfe, 0x38, 0x38, 0x00, + 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x00, 0x00, // 0x80 + 0x3e, 0x3e, 0x1e, 0x3e, 0x76, 0xe0, 0x40, 0x00, + 0x00, 0x1c, 0x0c, 0x14, 0x20, 0x40, 0x00, 0x00, // 0x81 + 0x10, 0x38, 0xfc, 0xfe, 0xfc, 0x38, 0x10, 0x00, + 0x00, 0x10, 0x08, 0x7c, 0x08, 0x10, 0x00, 0x00, // 0x82 + 0x40, 0xe0, 0x76, 0x3e, 0x1e, 0x3e, 0x3e, 0x00, + 0x00, 0x40, 0x20, 0x14, 0x0c, 0x1c, 0x00, 0x00, // 0x83 + 0x38, 0x38, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, + 0x00, 0x10, 0x10, 0x54, 0x38, 0x10, 0x00, 0x00, // 0x84 + 0x04, 0x0e, 0xdc, 0xf8, 0xf0, 0xf8, 0xf8, 0x00, + 0x00, 0x04, 0x08, 0x50, 0x60, 0x70, 0x00, 0x00, // 0x85 + 0x10, 0x38, 0x7e, 0xfe, 0x7e, 0x38, 0x10, 0x00, + 0x00, 0x10, 0x20, 0x7c, 0x20, 0x10, 0x00, 0x00, // 0x86 + 0xf8, 0xf8, 0xf0, 0xf8, 0xdc, 0x0e, 0x04, 0x00, + 0x00, 0x70, 0x60, 0x50, 0x08, 0x04, 0x00, 0x00 // 0x87 +}; diff --git a/flight/OSD/System/font_outlined8x8.h b/flight/OSD/System/font_outlined8x8.h new file mode 100644 index 000000000..c6f65f943 --- /dev/null +++ b/flight/OSD/System/font_outlined8x8.h @@ -0,0 +1,12 @@ +/** + * Super OSD, software revision 3 + * Copyright (C) 2010 Thomas Oldbury + * + * Please note the font data here is covered under Creative + * Commons licenses (version 3.0 BY-SA) and *not* the GPL. + */ + +// Lookup table. +extern const char font_lookup_outlined8x8[256]; +// Data. +extern const char font_data_outlined8x8[]; diff --git a/flight/OSD/System/fonts.c b/flight/OSD/System/fonts.c new file mode 100644 index 000000000..5fcfdcafb --- /dev/null +++ b/flight/OSD/System/fonts.c @@ -0,0 +1,34 @@ +/** + * Super OSD, software revision 3 + * Copyright (C) 2010 Thomas Oldbury + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "fonts.h" + +// Font table. Add new fonts here. The table must end with a -1 for the id. +struct FontEntry fonts[NUM_FONTS + 1] = { + { 0, 8, 14, "Outlined8x14", + &font_lookup_outlined8x14, + &font_data_outlined8x14, + 0 }, + { 1, 8, 8, "Outlined8x8", + &font_lookup_outlined8x8, + &font_data_outlined8x8, + FONT_UPPERCASE_ONLY }, + { 2, 8, 8, "Tiny5x5", 0, 0, 0 }, // not yet implemented + { -1 } // ends font table +}; diff --git a/flight/OSD/System/fonts.h b/flight/OSD/System/fonts.h new file mode 100644 index 000000000..526c6f935 --- /dev/null +++ b/flight/OSD/System/fonts.h @@ -0,0 +1,48 @@ +/** + * Super OSD, software revision 3 + * Copyright (C) 2010 Thomas Oldbury + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef FONTS_H +#define FONTS_H + +// New fonts need a .c file (with the data) and a .h file with +// the definitions. Add the .h files here only. +#include "font_outlined8x14.h" +#include "font_outlined8x8.h" + +// This number must also be incremented for each new font. +#define NUM_FONTS 3 + +// Flags for fonts. +#define FONT_LOWERCASE_ONLY 1 +#define FONT_UPPERCASE_ONLY 2 + +// Font table. (Actual list of fonts in fonts.c.) +struct FontEntry +{ + int id; + unsigned char width, height; + const char *name; + const char *lookup; + const char *data; + int flags; +}; + +extern struct FontEntry fonts[NUM_FONTS + 1]; + +#endif // FONTS_H diff --git a/flight/OSD/System/inc/FreeRTOSConfig.h b/flight/OSD/System/inc/FreeRTOSConfig.h new file mode 100644 index 000000000..590a2a2be --- /dev/null +++ b/flight/OSD/System/inc/FreeRTOSConfig.h @@ -0,0 +1,99 @@ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html. + *----------------------------------------------------------*/ + +/** + * @addtogroup PIOS PIOS + * @{ + * @addtogroup FreeRTOS FreeRTOS + * @{ + */ + +/* Notes: We use 5 task priorities */ + +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 0 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configCPU_CLOCK_HZ ( ( unsigned long ) 56000000 ) +#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) +#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 48 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 22 * 256) ) +#define configMAX_TASK_NAME_LEN ( 16 ) +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 0 +#define configUSE_MUTEXES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 0 +#define configUSE_ALTERNATIVE_API 0 +#define configQUEUE_REGISTRY_SIZE 10 + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ + +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 + +/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255 +(lowest) to 1 (highest maskable) to 0 (highest non-maskable). */ +#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */ +#define configMAX_SYSCALL_INTERRUPT_PRIORITY 0 << 4 /* equivalent to NVIC priority 3 */ + +/* This is the value being used as per the ST library which permits 16 +priority values, 0 to 15. This must correspond to the +configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest +NVIC value of 255. */ +#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15 + +#if !defined(ARCH_POSIX) && !defined(ARCH_WIN32) +#define CHECK_IRQ_STACK +#endif + +/* Enable run time stats collection */ +#if defined(DIAGNOSTICS) +#define configCHECK_FOR_STACK_OVERFLOW 2 + +#define configGENERATE_RUN_TIME_STATS 1 +#define INCLUDE_uxTaskGetRunTime 1 +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()\ +do {\ +(*(unsigned long *)0xe000edfc) |= (1<<24);/* DEMCR |= DEMCR_TRCENA */\ +(*(unsigned long *)0xe0001000) |= 1; /* DWT_CTRL |= DWT_CYCCNT_ENA */\ +} while(0) +#define portGET_RUN_TIME_COUNTER_VALUE() (*(unsigned long *)0xe0001004)/* DWT_CYCCNT */ +#else +#define configCHECK_FOR_STACK_OVERFLOW 1 +#endif + + +/** + * @} + */ + +#endif /* FREERTOS_CONFIG_H */ diff --git a/flight/OSD/System/inc/alarms.h b/flight/OSD/System/inc/alarms.h new file mode 100644 index 000000000..b62bc531b --- /dev/null +++ b/flight/OSD/System/inc/alarms.h @@ -0,0 +1,50 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotLibraries OpenPilot System Libraries + * @{ + * @file alarms.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Include file of the alarm library + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef ALARMS_H +#define ALARMS_H + +#include "systemalarms.h" +#define SYSTEMALARMS_ALARM_DEFAULT SYSTEMALARMS_ALARM_UNINITIALISED + +int32_t AlarmsInitialize(void); +int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity); +SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm); +int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm); +void AlarmsDefaultAll(); +int32_t AlarmsClear(SystemAlarmsAlarmElem alarm); +void AlarmsClearAll(); +int32_t AlarmsHasWarnings(); +int32_t AlarmsHasErrors(); +int32_t AlarmsHasCritical(); + +#endif // ALARMS_H + +/** + * @} + * @} + */ diff --git a/flight/OSD/System/inc/font12x18.h b/flight/OSD/System/inc/font12x18.h new file mode 100644 index 000000000..36325951a --- /dev/null +++ b/flight/OSD/System/inc/font12x18.h @@ -0,0 +1,9744 @@ +/* + * font12x18.h + * + * Created on: 3.1.2012 + * Author: Samba + */ + +#ifndef FONT12X18_H_ +#define FONT12X18_H_ + +static const uint16_t font_frame16x18[] = { +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x3C00, +0x6600, +0x4600, +0x0C00, +0x1800, +0x3000, +0x7E00, +0x0000, +0x0780, +0x06C0, +0x0660, +0x0660, +0x0660, +0x0660, +0x06C0, +0x0780, +0x0000, + +0x0000, +0x7C00, +0x0600, +0x0600, +0x3C00, +0x0600, +0x0600, +0x7C00, +0x0000, +0x0780, +0x06C0, +0x0660, +0x0660, +0x0660, +0x0660, +0x06C0, +0x0780, +0x0000, + +0x0000, +0x0010, +0x0010, +0x0010, +0x0010, +0x0010, +0x0010, +0x0010, +0x0030, +0x0070, +0x01F0, +0x0380, +0x0600, +0x0C00, +0x0C00, +0x1800, +0x1800, +0x1810, + +0x0000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0xC000, +0xE000, +0xF800, +0x1C00, +0x0600, +0x0300, +0x0300, +0x0180, +0x0180, +0x8180, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x7FE0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x7000, +0x8C60, +0x8260, +0x8180, +0xC180, +0xC240, +0x6420, +0x3820, +0x3810, +0x3C10, +0x0F10, +0x0BE0, +0x0800, +0x0800, +0x1C00, +0x3E00, +0x7F00, +0x0000, + +0x0000, +0x1F80, +0x30C0, +0x6060, +0x4020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0000, +0x7FE0, +0x6060, +0x6FE0, +0x6C60, +0x6F60, +0x6060, +0x7FE0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x30C0, +0x6060, +0x4020, +0x4020, +0x0000, +0x7FE0, +0x6060, +0x6FE0, +0x6C60, +0x6F60, +0x6060, +0x7FE0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x2080, +0x30C0, +0x3900, +0x3E00, +0x3E00, +0x1F00, +0x0F80, +0x07C0, +0x0800, +0x1800, +0x2800, +0x4800, +0x0000, +0x7F80, +0x0000, + +0x1810, +0x1800, +0x1800, +0x0C00, +0x0C00, +0x0600, +0x0380, +0x01F0, +0x0070, +0x0030, +0x0010, +0x0010, +0x0010, +0x0010, +0x0010, +0x0010, +0x0010, +0x0000, + +0x8180, +0x0180, +0x0180, +0x0300, +0x0300, +0x0600, +0x1C00, +0xF800, +0xE000, +0xC000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x0000, + +0x7FE0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0F00, +0x1080, +0x1080, +0x0080, +0x0080, +0x0080, +0x0000, +0x1F80, +0x30C0, +0x37C0, +0x30C0, +0x37C0, +0x37C0, +0x1F80, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x1080, +0x1080, +0x1080, +0x0000, +0x1F80, +0x30C0, +0x37C0, +0x30C0, +0x37C0, +0x37C0, +0x1F80, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0FF0, +0x1FF0, +0x3870, +0x3870, +0x3870, +0x3FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x1FF0, +0x0FF0, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFF80, +0xFFC0, +0xFF20, +0xC320, +0x81E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x81E0, +0xC3E0, +0xFFC0, +0xFF80, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFF80, +0xFFC0, +0xFF20, +0xC320, +0x81E0, +0x00E0, +0x3CE0, +0x7EE0, +0x7EE0, +0x7EE0, +0x7EE0, +0xBDC0, +0xC380, +0x0000, +0x0000, +0x0000, + +0x3F80, +0x0300, +0x0600, +0x1C00, +0x3F80, +0x0000, +0x3F80, +0x3180, +0x3F80, +0x0000, +0x3F80, +0x3180, +0x3F80, +0x0000, +0x3B80, +0x3580, +0x3180, +0x3180, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0010, +0x0030, +0x0070, +0x00F0, +0x01F0, +0x03F0, +0x03F0, +0x03F0, +0x03F0, +0x0300, +0x0300, +0x0300, +0x0300, +0x0300, +0x0300, +0x0000, + +0x0000, +0x0000, +0x8000, +0xC000, +0xE000, +0xF000, +0xF800, +0x0C00, +0x0C00, +0x0C00, +0xFC00, +0x0C00, +0x0C00, +0x0C00, +0x0C00, +0x0C00, +0x0C00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x1F80, +0x3FC0, +0x0000, +0x7FE0, +0x7E20, +0x7E20, +0x4220, +0x43E0, +0x43E0, +0x43E0, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0000, +0x0000, +0x0600, +0x0600, +0x0000, +0x0000, + +0x0000, +0x0000, +0x1080, +0x39C0, +0x18C0, +0x0840, +0x0840, +0x1080, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x1980, +0x1980, +0x1980, +0x7FE0, +0x7FE0, +0x1980, +0x1980, +0x7FE0, +0x7FE0, +0x1980, +0x1980, +0x1980, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0600, +0x0600, +0x1F80, +0x3FC0, +0x36C0, +0x3600, +0x3F00, +0x1F80, +0x06C0, +0x36C0, +0x3FC0, +0x1F80, +0x0600, +0x0600, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x31C0, +0x0380, +0x0700, +0x0E00, +0x1C00, +0x38C0, +0x30C0, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0E00, +0x1900, +0x1100, +0x1100, +0x1200, +0x0C00, +0x0C00, +0x1200, +0x2140, +0x2080, +0x2140, +0x1E20, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0200, +0x0700, +0x0300, +0x0100, +0x0100, +0x0200, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x00C0, +0x0180, +0x0300, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0300, +0x0180, +0x00C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x1800, +0x0C00, +0x0600, +0x0300, +0x0300, +0x0300, +0x0300, +0x0300, +0x0300, +0x0300, +0x0600, +0x0C00, +0x1800, +0x0000, + +0x0000, +0x0000, +0x0000, +0x4020, +0x6060, +0x30C0, +0x1980, +0x0F00, +0x7FE0, +0x0F00, +0x1980, +0x30C0, +0x6060, +0x4020, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x1F80, +0x1F80, +0x0600, +0x0600, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x0C00, +0x1800, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x1F80, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0060, +0x00E0, +0x01C0, +0x0380, +0x0700, +0x0E00, +0x1C00, +0x3800, +0x7000, +0x6000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0E00, +0x1E00, +0x1E00, +0x0600, +0x0600, +0x0600, +0x0600, +0x1F80, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x30C0, +0x31C0, +0x0380, +0x0700, +0x0E00, +0x1C00, +0x3FC0, +0x3FC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F80, +0x3FC0, +0x00C0, +0x00C0, +0x0F80, +0x0F80, +0x00C0, +0x00C0, +0x3FC0, +0x3F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0380, +0x0780, +0x0D80, +0x1980, +0x3180, +0x3FC0, +0x3FC0, +0x0180, +0x0180, +0x0180, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x3000, +0x3F80, +0x3FC0, +0x00C0, +0x00C0, +0x30C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3F80, +0x3000, +0x3000, +0x3F80, +0x3FC0, +0x30C0, +0x30C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x00C0, +0x01C0, +0x0380, +0x0700, +0x0600, +0x0600, +0x0600, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x30C0, +0x30C0, +0x1F80, +0x1F80, +0x30C0, +0x30C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x30C0, +0x30C0, +0x3FC0, +0x1FC0, +0x00C0, +0x00C0, +0x3FC0, +0x3F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x0C00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0180, +0x0300, +0x0600, +0x0C00, +0x1800, +0x1800, +0x0C00, +0x0600, +0x0300, +0x0180, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x1F80, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x1F80, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3000, +0x1800, +0x0C00, +0x0600, +0x0300, +0x0300, +0x0600, +0x0C00, +0x1800, +0x3000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x70E0, +0x6060, +0x0060, +0x00E0, +0x01C0, +0x0380, +0x0700, +0x0600, +0x0000, +0x0000, +0x0600, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x1080, +0x2040, +0x4D20, +0x5320, +0x5120, +0x5320, +0x4D40, +0x4080, +0x2000, +0x1040, +0x0F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x39C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x3FC0, +0x3FC0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3F00, +0x3F80, +0x31C0, +0x30C0, +0x30C0, +0x31C0, +0x3F80, +0x3F80, +0x31C0, +0x30C0, +0x30C0, +0x31C0, +0x3F80, +0x3F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x39C0, +0x30C0, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x30C0, +0x39C0, +0x1F80, +0x0F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3F00, +0x3F80, +0x31C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x31C0, +0x3F80, +0x3F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x3000, +0x3000, +0x3000, +0x3000, +0x3F00, +0x3F00, +0x3000, +0x3000, +0x3000, +0x3000, +0x3FC0, +0x3FC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x3000, +0x3000, +0x3000, +0x3000, +0x3F00, +0x3F00, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x1F00, +0x3F80, +0x39C0, +0x30C0, +0x30C0, +0x3000, +0x3000, +0x33C0, +0x33C0, +0x30C0, +0x30C0, +0x30C0, +0x3FC0, +0x1FC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x3FC0, +0x3FC0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x1F80, +0x1F80, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x1F80, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0FC0, +0x0FC0, +0x0300, +0x0300, +0x0300, +0x0300, +0x0300, +0x3300, +0x3300, +0x3300, +0x3300, +0x3300, +0x3F00, +0x1E00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3000, +0x30C0, +0x31C0, +0x3380, +0x3700, +0x3E00, +0x3C00, +0x3800, +0x3C00, +0x3E00, +0x3700, +0x3380, +0x31C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3FC0, +0x3FC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x39C0, +0x3FC0, +0x3FC0, +0x36C0, +0x36C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x38C0, +0x38C0, +0x3CC0, +0x3EC0, +0x37C0, +0x33C0, +0x31C0, +0x31C0, +0x30C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x39C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x39C0, +0x1F80, +0x0F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3F00, +0x3F80, +0x31C0, +0x30C0, +0x30C0, +0x31C0, +0x3F80, +0x3F00, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x39C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x36C0, +0x37C0, +0x3B80, +0x1FC0, +0x0EC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3F00, +0x3F80, +0x31C0, +0x30C0, +0x30C0, +0x31C0, +0x3F80, +0x3E00, +0x3E00, +0x3700, +0x3380, +0x31C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0F80, +0x1FC0, +0x38C0, +0x3000, +0x3000, +0x3800, +0x1F00, +0x0F80, +0x01C0, +0x00C0, +0x00C0, +0x31C0, +0x3F80, +0x1F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x39C0, +0x1F80, +0x0F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x39C0, +0x1980, +0x1F80, +0x0F00, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x36C0, +0x36C0, +0x36C0, +0x36C0, +0x36C0, +0x36C0, +0x3FC0, +0x1F80, +0x1980, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x1980, +0x0F00, +0x0600, +0x0600, +0x0F00, +0x1980, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x39C0, +0x1F80, +0x0F00, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x00C0, +0x00C0, +0x01C0, +0x0380, +0x0700, +0x0E00, +0x1C00, +0x3800, +0x3000, +0x3000, +0x3FC0, +0x3FC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0780, +0x0780, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0780, +0x0780, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x6000, +0x7000, +0x3800, +0x1C00, +0x0E00, +0x0700, +0x0380, +0x01C0, +0x00E0, +0x0060, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x1E00, +0x1E00, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x1E00, +0x1E00, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x1980, +0x1080, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x7FE0, +0x7FE0, +0x0000, +0x0000, + +0x0000, +0x0000, +0x3000, +0x1800, +0x0C00, +0x0600, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x39C0, +0x30C0, +0x30C0, +0x3FC0, +0x3FC0, +0x30C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F80, +0x3FC0, +0x30C0, +0x30C0, +0x3F80, +0x3F80, +0x30C0, +0x30C0, +0x3FC0, +0x3F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x30C0, +0x3000, +0x3000, +0x3000, +0x3000, +0x30C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F00, +0x3F80, +0x31C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x31C0, +0x3F80, +0x3F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x3000, +0x3000, +0x3F00, +0x3F00, +0x3000, +0x3000, +0x3FC0, +0x3FC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x3000, +0x3000, +0x3F80, +0x3F80, +0x3000, +0x3000, +0x3000, +0x3000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x38C0, +0x3000, +0x33C0, +0x33C0, +0x30C0, +0x38C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x3FC0, +0x3FC0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x0F00, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0F00, +0x0F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x07C0, +0x07C0, +0x0180, +0x0180, +0x0180, +0x0180, +0x0180, +0x1980, +0x1F80, +0x0F00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x31C0, +0x3380, +0x3700, +0x3E00, +0x3E00, +0x3F00, +0x3380, +0x31C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3FC0, +0x3FC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x39C0, +0x3FC0, +0x36C0, +0x36C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x38C0, +0x3CC0, +0x3EC0, +0x37C0, +0x33C0, +0x31C0, +0x30C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F80, +0x3FC0, +0x30C0, +0x30C0, +0x3FC0, +0x3F80, +0x3000, +0x3000, +0x3000, +0x3000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x33C0, +0x3380, +0x3FC0, +0x1EC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F80, +0x3FC0, +0x30C0, +0x30C0, +0x3F80, +0x3E00, +0x3700, +0x3380, +0x31C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x30C0, +0x3000, +0x3F80, +0x1FC0, +0x00C0, +0x30C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x39C0, +0x1F80, +0x0F00, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x36C0, +0x36C0, +0x3FC0, +0x1F80, +0x1980, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x39C0, +0x1F80, +0x0F00, +0x0600, +0x0600, +0x0F00, +0x1F80, +0x39C0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x39C0, +0x1F80, +0x0F00, +0x0600, +0x0600, +0x0600, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x3FC0, +0x01C0, +0x0380, +0x0700, +0x0E00, +0x1C00, +0x3800, +0x3FC0, +0x3FC0, +0x0000, + +0x0000, +0x0000, +0x0380, +0x0380, +0x0780, +0x0600, +0x0600, +0x0600, +0x0C00, +0x0C00, +0x0600, +0x0600, +0x0600, +0x0780, +0x0380, +0x0380, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x1C00, +0x1E00, +0x1E00, +0x0600, +0x0600, +0x0600, +0x0300, +0x0300, +0x0600, +0x0600, +0x0600, +0x1E00, +0x1E00, +0x1C00, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0C20, +0x1E60, +0x33C0, +0x6180, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x2800, +0x2C00, +0x2E00, +0x2F00, +0x2F80, +0x2F00, +0x2E00, +0x2C00, +0x2800, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x7000, +0x0000, + +0x0000, +0x6600, +0x6C00, +0x7000, +0x6C00, +0x6600, +0x0000, +0x6BE0, +0x6880, +0x5880, +0x5880, +0x0000, +0x0660, +0x0660, +0x07E0, +0x0660, +0x0660, +0x0000, + +0x0000, +0x6600, +0x6C00, +0x7000, +0x6C00, +0x6600, +0x0000, +0x1DC0, +0x1AC0, +0x1AC0, +0x18C0, +0x0000, +0x0660, +0x0660, +0x07E0, +0x0660, +0x0660, +0x0000, + +0x0000, +0x7F00, +0x6B00, +0x6B00, +0x6300, +0x0000, +0x0780, +0x0480, +0x0FC0, +0x0CC0, +0x0CC0, +0x0000, +0x0660, +0x0660, +0x07E0, +0x0660, +0x0660, +0x0000, + +0x0000, +0x6000, +0x6000, +0x6000, +0x7E00, +0x7E00, +0x0000, +0x0F80, +0x18C0, +0x1FC0, +0x18C0, +0x0000, +0x07E0, +0x07E0, +0x0180, +0x0180, +0x0180, +0x0000, + +0x0000, +0x6000, +0x6000, +0x6000, +0x7E00, +0x7E00, +0x0000, +0x1F80, +0x39C0, +0x39C0, +0x1F80, +0x0000, +0x0E60, +0x0F60, +0x0FE0, +0x0DE0, +0x0CE0, +0x0000, + +0x0000, +0x3E00, +0x6300, +0x7F00, +0x6300, +0x0000, +0x1800, +0x1800, +0x1800, +0x1F80, +0x1F80, +0x0000, +0x07E0, +0x07E0, +0x0180, +0x0180, +0x0180, +0x0000, + +0x0000, +0x6600, +0x6600, +0x3C00, +0x1800, +0x0000, +0x1F80, +0x1800, +0x1F00, +0x1800, +0x1F80, +0x0000, +0x0300, +0x0300, +0x0300, +0x03E0, +0x03E0, +0x0000, + +0x0000, +0x7E00, +0x7E00, +0x1800, +0x1800, +0x1800, +0x0000, +0x0D80, +0x0F80, +0x0D80, +0x0D80, +0x0000, +0x03C0, +0x0220, +0x0260, +0x03C0, +0x0360, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x6600, +0x7E00, +0x5A00, +0x4200, +0x0000, +0x7E00, +0x0000, +0x7E00, +0x4000, +0x7E00, +0x0200, +0x7E00, +0x0000, + +0x0000, +0x3E00, +0x6300, +0x7F00, +0x6300, +0x0000, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0000, +0x07E0, +0x0460, +0x0780, +0x06C0, +0x0660, +0x0000, + +0x0000, +0x7700, +0x6B00, +0x6B00, +0x6B00, +0x6B00, +0x0000, +0x0F80, +0x18C0, +0x1FC0, +0x18C0, +0x0000, +0x0660, +0x0660, +0x0660, +0x03C0, +0x0180, +0x0000, + +0x0000, +0x2000, +0x20C0, +0x2120, +0x0120, +0x7120, +0x0120, +0x70C0, +0x7000, +0x7000, +0x7120, +0x7120, +0x0140, +0x2180, +0x2140, +0x2120, +0x2120, +0x2000, + +0x0000, +0x2100, +0x2100, +0x2100, +0x01E0, +0x7000, +0x00C0, +0x7120, +0x7120, +0x7120, +0x70C0, +0x7000, +0x01E0, +0x2100, +0x21E0, +0x2020, +0x21E0, +0x2000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x6180, +0x7380, +0x7F80, +0x6D80, +0x6D80, +0x6180, +0x6180, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x6300, +0x6300, +0x6300, +0x6300, +0x3600, +0x3E00, +0x1C00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1C00, +0x3E00, +0x2200, +0x6300, +0x7F00, +0x6300, +0x6300, +0x0000, + +0x0000, +0x0000, +0x0030, +0x01F0, +0x00F0, +0x00F0, +0x00F0, +0x00F0, +0x00F0, +0x00F0, +0x00F0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x8000, +0xF000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0070, +0x0030, +0x0070, +0x00F0, +0x01F0, +0x03F0, +0x03F0, +0x0070, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0xE000, +0xF000, +0xF800, +0xE000, +0xE000, +0xC000, +0xC000, +0x8000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0010, +0x0030, +0x01F0, +0x07F0, +0x0FF0, +0x07F0, +0x01C0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0xFC00, +0xFC00, +0xFC00, +0xE600, +0x8000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0010, +0x03F0, +0x0FF0, +0x07F0, +0x0780, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x7000, +0xFF00, +0xFE00, +0xFE00, +0x8C00, +0x0400, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3000, +0xFC00, +0xFF80, +0xFF00, +0xFE00, +0x1800, +0x1000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0100, +0x03F0, +0x07F0, +0x01F0, +0x0010, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x8800, +0xFE00, +0xFF00, +0xFF80, +0x7F00, +0x7000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x00C0, +0x01F0, +0x03F0, +0x01F0, +0x0070, +0x0010, +0x0010, +0x0030, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0xC000, +0xFC00, +0xFE00, +0xFE00, +0xFF00, +0xFF00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x01F0, +0x00F0, +0x0070, +0x0070, +0x0030, +0x0070, +0x00F0, +0x0010, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x8000, +0xC000, +0xE000, +0xF600, +0xFC00, +0xFC00, +0xFC00, +0xFC00, +0x1800, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0070, +0x0070, +0x0070, +0x0070, +0x00F0, +0x03F0, +0x00F0, +0x0070, +0x0030, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0xE000, +0xE000, +0xE000, +0xE000, +0xF000, +0xFC00, +0xE000, +0xC000, +0x8000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0010, +0x0030, +0x0070, +0x06F0, +0x03F0, +0x03F0, +0x03F0, +0x03F0, +0x0180, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0xF800, +0xF000, +0xE000, +0xE000, +0xC000, +0xE000, +0xF000, +0x8000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0030, +0x03F0, +0x07F0, +0x07F0, +0x0FF0, +0x0FF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x3000, +0xF800, +0xFC00, +0xF800, +0xE000, +0x8000, +0x8000, +0xC000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0110, +0x07F0, +0x0FF0, +0x1FF0, +0x0FE0, +0x00E0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0800, +0xFC00, +0xFE00, +0xF800, +0x8000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x00C0, +0x03F0, +0x1FF0, +0x0FF0, +0x07F0, +0x0180, +0x0080, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x00E0, +0x0FF0, +0x07F0, +0x07F0, +0x0310, +0x0200, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x8000, +0xFC00, +0xFF00, +0xFE00, +0x1E00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x03F0, +0x03F0, +0x03F0, +0x0670, +0x0010, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x8000, +0xC000, +0xF800, +0xFE00, +0xFF00, +0xFE00, +0x3800, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0070, +0x00F0, +0x01F0, +0x0070, +0x0070, +0x0030, +0x0030, +0x0010, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0xE000, +0xC000, +0xE000, +0xF000, +0xF800, +0xFC00, +0xFC00, +0xE000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1800, +0x2400, +0x2400, +0x1800, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0600, +0x0F00, +0x1F80, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x0600, +0x1F80, +0x0F00, +0x0600, +0x0000, +0x0000, + +0x0000, +0x0000, +0x1000, +0x3000, +0x7C00, +0x7F00, +0x3300, +0x1180, +0x0180, +0x0180, +0x1180, +0x3300, +0x7F00, +0x7C00, +0x3000, +0x1000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0F00, +0x7FE0, +0x6060, +0x4620, +0x4620, +0x4620, +0x4620, +0x4620, +0x4620, +0x4620, +0x4020, +0x4620, +0x4620, +0x4020, +0x6060, +0x7FE0, +0x0000, + +0x0000, +0x0F00, +0x7FE0, +0x70E0, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x7FE0, +0x7FE0, +0x0000, + +0x0000, +0x0F00, +0x7FE0, +0x70E0, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x0000, + +0x0000, +0x0F00, +0x7FE0, +0x70E0, +0x6060, +0x6060, +0x6060, +0x6060, +0x6060, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x0000, + +0x0000, +0x0F00, +0x7FE0, +0x70E0, +0x6060, +0x6060, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x0000, + +0x0000, +0x0F00, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x0000, + +0x0000, +0x0000, +0x3FF0, +0x3FF0, +0x3000, +0x3000, +0x33C0, +0x33C0, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, +0x3000, + +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x30C0, +0x6060, +0x6060, +0x6060, +0x6060, +0x30C0, +0x1F80, +0x0F00, + +0x0000, +0x0000, +0xF000, +0xF000, +0x33F0, +0x33F0, +0x3330, +0x3330, +0x3330, +0x3330, +0x3F30, +0x3F30, +0x3030, +0x3030, +0x3030, +0x3030, +0x3030, +0x3030, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x00F0, +0x00F0, +0x3FC0, +0x3FC0, +0x30F0, +0x30F0, +0x3000, +0x3000, +0xF000, +0xF000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xF000, +0xF000, +0x0000, +0x0000, +0xF000, +0xF000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0600, +0x0F00, +0x0F00, +0x1F80, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0400, +0x0400, +0xE4F0, +0x0400, +0x0400, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x38C0, +0x38C0, +0x3CC0, +0x36C0, +0xB6D0, +0x33C0, +0x31C0, +0x30C0, +0x30C0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x1880, +0x1800, +0x1F00, +0xEFB0, +0x0180, +0x1180, +0x1F80, +0x0F00, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x1F80, +0x1800, +0x1800, +0x1E00, +0xDEF0, +0x1800, +0x1800, +0x1F80, +0x1F80, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x30C0, +0x30C0, +0x30C0, +0x36C0, +0xD6B0, +0x1F80, +0x1980, +0x1980, +0x1980, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xE0F0, +0x3180, +0x1B00, +0x0E00, +0x0400, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0700, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x07F0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0E00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFE00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x3000, +0x3000, +0x3FF0, +0x3FF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x3000, +0x3000, +0xF000, +0xF000, +0x0000, +0x0000, +0x0660, +0x0660, +0x0660, +0x0660, +0x0660, +0x07E0, +0x03C0, +0x0180, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1800, +0x3800, +0x3800, +0x1800, +0x1800, +0x1800, +0x3C60, +0x3C60, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3C00, +0x7E00, +0x6600, +0x6600, +0x6600, +0x6600, +0x7E00, +0x3C00, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x1F80, +0x1F80, +0x0F00, +0x0F00, +0x0600, +0x0600, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, +0x0040, + +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0040, +0x0040, +0x0070, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0070, +0x0040, +0x0040, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xE000, +0x2000, +0x2000, + +0x2000, +0x2000, +0xE000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0700, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0100, +0x0180, +0x01C0, +0x01E0, +0x01C0, +0x0180, +0x0100, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0E00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0800, +0x1800, +0x3800, +0x7800, +0x3800, +0x1800, +0x0800, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0300, +0x0300, +0x0300, +0x0300, +0x03F0, +0x03F0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x03F0, +0x03F0, +0x0300, +0x0300, +0x0300, +0x0300, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFC00, +0xFC00, +0x0C00, +0x0C00, +0x0C00, +0x0C00, + +0x0C00, +0x0C00, +0x0C00, +0x0C00, +0xFC00, +0xFC00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x6600, +0x7E00, +0x5A00, +0x4200, +0x0040, +0x3C40, +0x6640, +0x6600, +0x6600, +0x3C40, +0x0040, +0x7C40, +0x6600, +0x6600, +0x6600, +0x7C00, +0x0000, + +0x0000, +0x3C00, +0x2400, +0x7E00, +0x6600, +0x6600, +0x0000, +0x1980, +0x1980, +0x1980, +0x1F80, +0x0000, +0x07E0, +0x07E0, +0x0180, +0x0180, +0x0180, +0x0000, + +0x0000, +0x7C00, +0x6000, +0x7C00, +0x0C00, +0x7C00, +0x0000, +0x1F80, +0x0600, +0x0600, +0x0600, +0x0000, +0x03C0, +0x0240, +0x07E0, +0x0660, +0x0660, +0x0000, + +0x0000, +0x3C00, +0x2400, +0x7E00, +0x6600, +0x6600, +0x0000, +0x1F80, +0x1800, +0x1800, +0x1F80, +0x0000, +0x03E0, +0x0320, +0x0360, +0x03C0, +0x0360, +0x0000, + +0x0000, +0x6000, +0x6000, +0x6000, +0x7C00, +0x7C00, +0x0000, +0x1F80, +0x0600, +0x0600, +0x0600, +0x0000, +0x03E0, +0x0320, +0x0360, +0x03C0, +0x0360, +0x0000, + +0x0000, +0x7C00, +0x6400, +0x6C00, +0x7800, +0x6C00, +0x0000, +0x1F80, +0x0600, +0x0600, +0x0600, +0x0000, +0x0300, +0x0300, +0x0300, +0x0300, +0x03E0, +0x0000, + +0x0000, +0x3C00, +0x2400, +0x7E00, +0x6600, +0x6600, +0x0000, +0x1800, +0x1800, +0x1800, +0x1F00, +0x0000, +0x0660, +0x0660, +0x07E0, +0x0660, +0x0660, +0x0000, + +0x0000, +0x7C00, +0x6000, +0x7C00, +0x0C00, +0x7C00, +0x0000, +0x1DC0, +0x1AC0, +0x1AC0, +0x1AC0, +0x0000, +0x01E0, +0x0120, +0x01E0, +0x0180, +0x0180, +0x0000, + +0x0000, +0x7C00, +0x6000, +0x7000, +0x6000, +0x6000, +0x0000, +0x3580, +0x3580, +0x3580, +0x3B80, +0x0000, +0x03C0, +0x0240, +0x07E0, +0x0660, +0x0660, +0x0000, + +0x0000, +0x7C00, +0x6000, +0x7000, +0x6000, +0x6000, +0x0000, +0x3580, +0x3580, +0x3580, +0x3B80, +0x0000, +0x07C0, +0x0640, +0x07E0, +0x0660, +0x07E0, +0x0000, + +0x0000, +0x6600, +0x7E00, +0x5A00, +0x4200, +0x0040, +0x3C40, +0x6640, +0x6600, +0x7E00, +0x6640, +0x0040, +0x6640, +0x6600, +0x6600, +0x3C00, +0x1800, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x70E0, +0x6060, +0x4020, +0x4020, +0x4020, +0x4020, +0x6060, +0x70E0, +0x3FC0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x70E0, +0x6060, +0x4F20, +0x4F20, +0x4F20, +0x4F20, +0x6060, +0x70E0, +0x3FC0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0030, +0x0020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0020, +0x0030, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFF0, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0xFFF0, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFF0, +0x0000, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0x0000, +0xFFF0, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFF0, +0x0000, +0xFC00, +0xFC00, +0xFC00, +0xFC00, +0xFC00, +0xFC00, +0xFC00, +0xFC00, +0xFC00, +0xFC00, +0x0000, +0xFFF0, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFF0, +0x0000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0x0000, +0xFFF0, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0x0000, + +0x0000, +0x0000, +0xC000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0xC000, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFFE0, +0x4020, +0x50A0, +0x58A0, +0x5CA0, +0x5EA0, +0x5FA0, +0x5FA0, +0x5EA0, +0x5CA0, +0x58A0, +0x50A0, +0x4020, +0xFFE0, +0x0000, +0x0000, + +0x0000, +0x0010, +0x0010, +0x0300, +0x0330, +0x0070, +0x00C0, +0x0180, +0x0D80, +0x0D80, +0x0180, +0x00C0, +0x0070, +0x0330, +0x0300, +0x0010, +0x0010, +0x0000, + +0x0000, +0x8000, +0x8000, +0x0C00, +0xCC00, +0xE000, +0x3000, +0x1800, +0x1B00, +0x1B00, +0x1800, +0x3000, +0xE000, +0xCC00, +0x0C00, +0x8000, +0x8000, +0x0000, + +0x0000, +0x0000, +0x0030, +0x00F0, +0x01C0, +0x0300, +0x0300, +0x0600, +0x0600, +0x0600, +0x0600, +0x0300, +0x0300, +0x01C0, +0x00F0, +0x0030, +0x0000, +0x0000, + +0x0000, +0x0000, +0xC000, +0xF000, +0xF800, +0xFC00, +0xFC00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFC00, +0xFC00, +0xF800, +0xF000, +0xC000, +0x0000, +0x0000, + +0x0000, +0x0060, +0x00E0, +0x01A0, +0x0320, +0x7E20, +0x4C20, +0x4C20, +0x4C20, +0x4C20, +0x4C20, +0x7E20, +0x0320, +0x01A0, +0x00E0, +0x0060, +0x0000, +0x0000, + +0x0000, +0x0600, +0x0300, +0x0100, +0x1900, +0x0980, +0x4C80, +0x6480, +0x2480, +0x6480, +0x4C80, +0x0980, +0x1900, +0x0100, +0x0300, +0x0600, +0x0000, +0x0000, + +0x0000, +0x7FE0, +0x3FC0, +0x30C0, +0x30C0, +0x30C0, +0x1980, +0x0F00, +0x0600, +0x0600, +0x0F00, +0x1980, +0x30C0, +0x30C0, +0x30C0, +0x3FC0, +0x7FE0, +0x0000, + +0x0000, +0x0000, +0x1000, +0x1800, +0x1C00, +0x1E00, +0x1F00, +0x1F80, +0x1FC0, +0x1FE0, +0x1F00, +0x1F00, +0x1380, +0x0380, +0x01C0, +0x01C0, +0x0080, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3220, +0x4B60, +0x4AA0, +0x4AA0, +0x7A20, +0x4A20, +0x4A20, +0x4A20, +0x4A20, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x7220, +0x4B60, +0x4AA0, +0x4AA0, +0x7220, +0x4220, +0x4220, +0x4220, +0x4220, +0x0000, + +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +}; + +static const uint16_t font_mask16x18[] = { +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFFF0, +0xFFF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, + +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFFF0, +0xFFF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, + +0x0010, +0x0030, +0x0030, +0x0030, +0x0030, +0x0030, +0x0030, +0x0030, +0x0070, +0x01F0, +0x03F0, +0x07F0, +0x0F80, +0x1E00, +0x1E00, +0x3C00, +0x3C10, +0x3C30, + +0x8000, +0xC000, +0xC000, +0xC000, +0xC000, +0xC000, +0xC000, +0xC000, +0xE000, +0xF800, +0xFC00, +0xFE00, +0x1F00, +0x0780, +0x0780, +0x03C0, +0x83C0, +0xC3C0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0xFC60, +0xFEF0, +0xFFF0, +0xFFE0, +0xFFC0, +0xFFE0, +0xFFF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x3FF0, +0x1FF0, +0x1FE0, +0x1C00, +0x3E00, +0x7F00, +0xFFC0, +0xFFE0, + +0x1F80, +0x3FC0, +0x7FE0, +0xF0F0, +0xE070, +0x4070, +0x0070, +0x0070, +0x0070, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0xF0F0, +0xE070, +0xE070, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +0x0000, +0x0000, +0x2080, +0x71C0, +0x79E0, +0x7FC0, +0x7F00, +0x7F00, +0x3F80, +0x1FC0, +0x0FE0, +0x1FC0, +0x3C00, +0x7C00, +0xFC00, +0xFF80, +0xFFC0, +0xFFC0, + +0x3C30, +0x3C10, +0x3C00, +0x1E00, +0x1E00, +0x0F80, +0x07F0, +0x03F0, +0x01F0, +0x0070, +0x0030, +0x0030, +0x0030, +0x0030, +0x0030, +0x0030, +0x0030, +0x0010, + +0xC3C0, +0x83C0, +0x03C0, +0x0780, +0x0780, +0x1F00, +0xFE00, +0xFC00, +0xF800, +0xE000, +0xC000, +0xC000, +0xC000, +0xC000, +0xC000, +0xC000, +0xC000, +0x8000, + +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0F00, +0x3FC0, +0x3FC0, +0x39C0, +0x11C0, +0x01C0, +0x01C0, +0x1FC0, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0F00, +0x3FC0, +0x3FC0, +0x39C0, +0x39C0, +0x3FC0, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x0000, + +0x0000, +0x1FF0, +0x3FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x3FF0, +0x1FF0, +0x0000, +0x0000, + +0x0000, +0xFFC0, +0xFFE0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFE0, +0xFFC0, +0x0000, +0x0000, + +0x0000, +0xFFC0, +0xFFE0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFE0, +0xFFC0, +0x0000, +0x0000, + +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFE0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0010, +0x0030, +0x0070, +0x00F0, +0x01F0, +0x03F0, +0x07F0, +0x0FF0, +0x1FF0, +0x37F0, +0x27F0, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x07F0, + +0x8000, +0xC000, +0xE000, +0xF000, +0xF800, +0xFC00, +0xFE00, +0xFF00, +0xFF80, +0xFEC0, +0xFE40, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, + +0x0000, +0x0000, +0x0600, +0x1F80, +0x3FC0, +0x7FE0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0600, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0600, +0x0600, +0x0F00, +0x0F00, +0x0600, +0x0000, + +0x0000, +0x1080, +0x39C0, +0x7FE0, +0x3DE0, +0x1CE0, +0x1CE0, +0x39C0, +0x1080, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x1980, +0x3FC0, +0x3FC0, +0x7FE0, +0xFFF0, +0xFFF0, +0x7FE0, +0x7FE0, +0xFFF0, +0xFFF0, +0x7FE0, +0x3FC0, +0x3FC0, +0x1980, +0x0000, +0x0000, + +0x0000, +0x0600, +0x0F00, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7F80, +0x3FC0, +0x3FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, +0x0F00, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x7BE0, +0x37C0, +0x0F80, +0x1F00, +0x3EC0, +0x7DE0, +0x79E0, +0x30C0, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0E00, +0x1F00, +0x3F80, +0x3B80, +0x3B80, +0x3F00, +0x1E00, +0x1E00, +0x3FC0, +0x73E0, +0x71C0, +0x7FE0, +0x3F70, +0x1E20, +0x0000, + +0x0000, +0x0200, +0x0700, +0x0F80, +0x0780, +0x0380, +0x0380, +0x0700, +0x0200, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x00C0, +0x01E0, +0x03C0, +0x0780, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0780, +0x03C0, +0x01E0, +0x00C0, + +0x0000, +0x0000, +0x0000, +0x1800, +0x3C00, +0x1E00, +0x0F00, +0x0780, +0x0780, +0x0780, +0x0780, +0x0780, +0x0780, +0x0780, +0x0F00, +0x1E00, +0x3C00, +0x1800, + +0x0000, +0x0000, +0x4020, +0xE070, +0xF0F0, +0x79E0, +0x3FC0, +0x7FE0, +0xFFF0, +0x7FE0, +0x3FC0, +0x79E0, +0xF0F0, +0xE070, +0x4020, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, +0x0F00, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x0F00, +0x1E00, +0x3C00, +0x1800, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0060, +0x00F0, +0x01F0, +0x03E0, +0x07C0, +0x0F80, +0x1F00, +0x3E00, +0x7C00, +0xF800, +0xF000, +0x6000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x1F00, +0x3F00, +0x3F00, +0x1F00, +0x0F00, +0x0F00, +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x7BE0, +0x37C0, +0x0F80, +0x1F00, +0x3FC0, +0x7FE0, +0x7FE0, +0x3FC0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F80, +0x7FC0, +0x7FE0, +0x3FE0, +0x0FE0, +0x1FC0, +0x1FC0, +0x0FE0, +0x3FE0, +0x7FE0, +0x7FC0, +0x3F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0380, +0x07C0, +0x0FC0, +0x1FC0, +0x3FC0, +0x7FC0, +0x7FE0, +0x7FE0, +0x3FC0, +0x03C0, +0x03C0, +0x0180, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7FC0, +0x7FE0, +0x3FE0, +0x31E0, +0x7FE0, +0x7FE0, +0x7FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FC0, +0x7F80, +0x7F80, +0x7FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x3FE0, +0x03E0, +0x07C0, +0x0F80, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FE0, +0x1FE0, +0x3FE0, +0x7FE0, +0x7FC0, +0x3F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x0F00, +0x0600, +0x0000, +0x0000, +0x0600, +0x0F00, +0x0F00, +0x0600, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x0F00, +0x0600, +0x0000, +0x0000, +0x0600, +0x0F00, +0x0F00, +0x1E00, +0x0C00, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0180, +0x03C0, +0x0780, +0x0F00, +0x1E00, +0x3C00, +0x3C00, +0x1E00, +0x0F00, +0x0780, +0x03C0, +0x0180, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3000, +0x7800, +0x3C00, +0x1E00, +0x0F00, +0x0780, +0x0780, +0x0F00, +0x1E00, +0x3C00, +0x7800, +0x3000, + +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0xFFF0, +0xF0F0, +0x60F0, +0x01F0, +0x03E0, +0x07C0, +0x0F80, +0x0F00, +0x0600, +0x0600, +0x0F00, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x7DE0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFE0, +0xEDC0, +0x70C0, +0x3FE0, +0x1FC0, +0x0F80, + +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x3F00, +0x7F80, +0x7FC0, +0x7FE0, +0x79E0, +0x79E0, +0x7FE0, +0x7FC0, +0x7FC0, +0x7FE0, +0x79E0, +0x79E0, +0x7FE0, +0x7FC0, +0x7F80, +0x3F00, + +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x7FE0, +0x79E0, +0x78C0, +0x7800, +0x7800, +0x7800, +0x7800, +0x78C0, +0x79E0, +0x7FE0, +0x3FC0, +0x1F80, +0x0F00, + +0x0000, +0x0000, +0x3F00, +0x7F80, +0x7FC0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FC0, +0x7F80, +0x3F00, + +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7800, +0x7800, +0x7F00, +0x7F80, +0x7F80, +0x7F00, +0x7800, +0x7800, +0x7FC0, +0x7FE0, +0x7FE0, +0x3FC0, + +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7800, +0x7800, +0x7F00, +0x7F80, +0x7F80, +0x7F00, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x3000, + +0x0000, +0x0000, +0x1F00, +0x3F80, +0x7FC0, +0x7FE0, +0x79E0, +0x79E0, +0x78C0, +0x7BC0, +0x7FE0, +0x7FE0, +0x7BE0, +0x79E0, +0x7FE0, +0x7FE0, +0x3FE0, +0x1FC0, + +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0FC0, +0x1FE0, +0x1FE0, +0x0FC0, +0x0780, +0x0780, +0x0780, +0x3780, +0x7F80, +0x7F80, +0x7F80, +0x7F80, +0x7F80, +0x7F80, +0x3F00, +0x1E00, + +0x0000, +0x0000, +0x3000, +0x78C0, +0x79E0, +0x7BE0, +0x7FC0, +0x7F80, +0x7F00, +0x7E00, +0x7C00, +0x7E00, +0x7F00, +0x7F80, +0x7FC0, +0x7BE0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x3000, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7FC0, +0x7FE0, +0x7FE0, +0x3FC0, + +0x0000, +0x0000, +0x30C0, +0x79E0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x7DE0, +0x7DE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7BE0, +0x7BE0, +0x79E0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x3FC0, +0x1F80, +0x0F00, + +0x0000, +0x0000, +0x3F00, +0x7F80, +0x7FC0, +0x7FE0, +0x79E0, +0x79E0, +0x7FE0, +0x7FC0, +0x7F80, +0x7F00, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x3000, + +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FC0, +0x3FE0, +0x1FE0, +0x0EC0, + +0x0000, +0x0000, +0x3F00, +0x7F80, +0x7FC0, +0x7FE0, +0x79E0, +0x79E0, +0x7FE0, +0x7FC0, +0x7F80, +0x7F00, +0x7F80, +0x7FC0, +0x7BE0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0F80, +0x1FC0, +0x3FE0, +0x7FE0, +0x78C0, +0x7800, +0x7F00, +0x3F80, +0x1FC0, +0x0FE0, +0x01E0, +0x31E0, +0x7FE0, +0x7FC0, +0x3F80, +0x1F00, + +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x3FC0, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x3FC0, +0x1F80, +0x0F00, + +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x3FC0, +0x3FC0, +0x1F80, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x3FC0, +0x1980, + +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x3FC0, +0x1F80, +0x0F00, +0x0F00, +0x1F80, +0x3FC0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x3FC0, +0x1F80, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x3FE0, +0x01E0, +0x03E0, +0x07C0, +0x0F80, +0x1F00, +0x3E00, +0x7C00, +0x7800, +0x7FC0, +0x7FE0, +0x7FE0, +0x3FC0, + +0x0000, +0x0000, +0x0780, +0x0FC0, +0x0FC0, +0x0F80, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F80, +0x0FC0, +0x0FC0, +0x0780, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x6000, +0xF000, +0xF800, +0x7C00, +0x3E00, +0x1F00, +0x0F80, +0x07C0, +0x03E0, +0x01F0, +0x00F0, +0x0060, +0x0000, +0x0000, + +0x0000, +0x0000, +0x1E00, +0x3F00, +0x3F00, +0x1F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x1F00, +0x3F00, +0x3F00, +0x1E00, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x1F80, +0x3FC0, +0x39C0, +0x30C0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x7FE0, +0xFFF0, +0xFFF0, +0x7FE0, +0x0000, + +0x0000, +0x3000, +0x7800, +0x3C00, +0x1E00, +0x0F00, +0x0600, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F80, +0x7FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FC0, +0x3F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x78C0, +0x7800, +0x7800, +0x78C0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F00, +0x7F80, +0x7FC0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FC0, +0x7F80, +0x3F00, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7F00, +0x7F80, +0x7F80, +0x7F00, +0x7FC0, +0x7FE0, +0x7FE0, +0x3FC0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7F80, +0x7FC0, +0x7FC0, +0x7F80, +0x7800, +0x7800, +0x7800, +0x3000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x1F80, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x1F80, +0x1F80, +0x0F00, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x07C0, +0x0FE0, +0x0FE0, +0x07C0, +0x03C0, +0x03C0, +0x03C0, +0x1BC0, +0x3FC0, +0x3FC0, +0x1F80, +0x0F00, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x7BE0, +0x7FC0, +0x7F80, +0x7F00, +0x7F00, +0x7F80, +0x7FC0, +0x7BE0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3000, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7FC0, +0x7FE0, +0x7FE0, +0x3FC0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x7DE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7BE0, +0x79E0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F80, +0x7FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7F80, +0x7800, +0x7800, +0x7800, +0x3000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x7BE0, +0x7FE0, +0x7FC0, +0x7FE0, +0x3FE0, +0x1EC0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3F80, +0x7FC0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7F80, +0x7F80, +0x7FC0, +0x7BE0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x7FC0, +0x7FC0, +0x3FE0, +0x3FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x3FC0, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x3FC0, +0x1F80, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x3FC0, +0x3FC0, +0x1980, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x7FE0, +0x3FC0, +0x1F80, +0x0F00, +0x0F00, +0x1F80, +0x3FC0, +0x7FE0, +0x79E0, +0x30C0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0x3FC0, +0x1F80, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0600, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0x7FE0, +0x3FE0, +0x07C0, +0x0F80, +0x1F00, +0x3E00, +0x7FC0, +0x7FE0, +0x7FE0, +0x3FC0, + +0x0000, +0x0380, +0x07C0, +0x07C0, +0x0FC0, +0x0F80, +0x0F00, +0x0F00, +0x1E00, +0x1E00, +0x0F00, +0x0F00, +0x0F80, +0x0FC0, +0x07C0, +0x07C0, +0x0380, +0x0000, + +0x0000, +0x0000, +0x0600, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0600, +0x0000, +0x0000, + +0x0000, +0x1C00, +0x3E00, +0x3F00, +0x3F00, +0x1F00, +0x0F00, +0x0F00, +0x0780, +0x0780, +0x0F00, +0x0F00, +0x1F00, +0x3F00, +0x3F00, +0x3E00, +0x1C00, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0C20, +0x1E70, +0x3FF0, +0x7FE0, +0xF3C0, +0x6180, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x7800, +0x7C00, +0x7E00, +0x7F00, +0x7F80, +0x7FC0, +0x7F80, +0x7F00, +0x7E00, +0x7C00, +0x7800, +0x7000, +0x7000, +0x7000, +0xF800, +0xF800, +0xF800, + +0x7E00, +0xFF00, +0xFF00, +0xFF00, +0xFF00, +0xFF00, +0x7FE0, +0xFFF0, +0xFFE0, +0xFFC0, +0xFFC0, +0x7FE0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x07E0, + +0x6600, +0xFF00, +0xFE00, +0xFC00, +0xFE00, +0xFF00, +0x7FC0, +0x3FE0, +0x3FE0, +0x3FE0, +0x3FE0, +0x1FE0, +0x0E70, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0660, + +0x7F00, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0x7F80, +0x0FC0, +0x0FC0, +0x1FE0, +0x1FE0, +0x1FE0, +0x0FE0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0660, + +0x6000, +0xF000, +0xF000, +0xFE00, +0xFF00, +0xFF00, +0x7F80, +0x1FC0, +0x3FE0, +0x3FE0, +0x3FE0, +0x1FF0, +0x0FF0, +0x0FF0, +0x07E0, +0x03C0, +0x03C0, +0x0180, + +0x6000, +0xF000, +0xF000, +0xFE00, +0xFF00, +0xFF00, +0x7F80, +0x3FC0, +0x7FE0, +0x7FE0, +0x3FC0, +0x1FE0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x0FE0, + +0x7F00, +0xFF00, +0xFF80, +0xFF80, +0xFF80, +0x7F00, +0x3C00, +0x3C00, +0x3F80, +0x3FC0, +0x3FC0, +0x1FE0, +0x0FF0, +0x0FF0, +0x07E0, +0x03C0, +0x03C0, +0x0180, + +0x6600, +0xFF00, +0xFF00, +0x7E00, +0x3C00, +0x1F80, +0x3FC0, +0x3F80, +0x3F00, +0x3F80, +0x3FC0, +0x1F80, +0x0780, +0x0780, +0x07E0, +0x07F0, +0x07F0, +0x03E0, + +0x7E00, +0xFF00, +0xFF00, +0x7E00, +0x3C00, +0x3C00, +0x1D80, +0x1FC0, +0x1FC0, +0x1FC0, +0x1FC0, +0x0FC0, +0x07E0, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x0370, + +0x0000, +0x0000, +0x0000, +0x0000, +0x6600, +0xFF00, +0xFF00, +0xFF00, +0xFF00, +0x7E00, +0xFF00, +0x7E00, +0xFF00, +0xFE00, +0xFF00, +0x7F00, +0xFF00, +0x7E00, + +0x3E00, +0x7F00, +0xFF80, +0xFF80, +0xFF80, +0x6F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0FE0, +0x0FF0, +0x0FF0, +0x0FE0, +0x0FE0, +0x0FF0, +0x0660, + +0x7700, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0x1FC0, +0x3FE0, +0x3FE0, +0x3FE0, +0x3FE0, +0x0FF0, +0x0FF0, +0x0FF0, +0x07E0, +0x03C0, +0x0180, + +0x23F0, +0x73F0, +0x73F0, +0x73F0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0x73F0, +0x73F0, +0x73F0, +0x73F0, +0x73F0, +0x73F0, + +0x23F0, +0x73F0, +0x73F0, +0x73F0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0xFBF0, +0x73F0, +0x73F0, +0x73F0, +0x73F0, +0x73F0, +0x73F0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x6180, +0xF3C0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xF3C0, +0x6180, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x6300, +0xF780, +0xF780, +0xF780, +0xF780, +0x7F00, +0x7F00, +0x3E00, +0x1C00, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1C00, +0x3E00, +0x7F00, +0x7F00, +0xFF80, +0xFF80, +0xFF80, +0xF780, +0x6300, + +0x0010, +0x0070, +0x01F0, +0x07F0, +0x1FF0, +0x3FF0, +0x3FF0, +0x1FF0, +0x03F0, +0x03F0, +0x03F0, +0x03F0, +0x03F0, +0x03F0, +0x01F0, +0x0000, +0x0000, +0x0000, + +0xC000, +0xF800, +0xFE00, +0xFF80, +0xFFC0, +0xFFC0, +0xFF80, +0xF800, +0xF800, +0xF800, +0xF800, +0xF800, +0xF800, +0xF800, +0xF800, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0010, +0x01F0, +0x0FF0, +0x0FF0, +0x0FF0, +0x03F0, +0x07F0, +0x0FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x01F0, +0x0030, +0x0000, +0x0000, +0x0000, + +0x0000, +0xF800, +0xFC00, +0xFE00, +0xFF00, +0xFF80, +0xFFC0, +0xFFC0, +0xFFC0, +0xF0C0, +0xF000, +0xE000, +0xE000, +0xC000, +0x8000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x01F0, +0x01F0, +0x01F0, +0x07F0, +0x1FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x1FF0, +0x0FF0, +0x07F0, +0x03E0, +0x0180, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0E00, +0xFE00, +0xFF00, +0xFF00, +0xFF00, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xE780, +0x8180, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0030, +0x0070, +0x0070, +0x0FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x0FE0, +0x0F00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0xFC00, +0xFFC0, +0xFFC0, +0xFFC0, +0xFF80, +0xFF80, +0xFF00, +0xFF00, +0xFF00, +0x1E00, +0x0E00, +0x0400, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x4000, +0x7800, +0xFE00, +0xFFC0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFE0, +0xFFC0, +0xFF00, +0x7E00, +0x7C00, +0x7000, +0x6000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x03C0, +0x07F0, +0x1FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x07F0, +0x0070, +0x0070, +0x00F0, +0x00F0, +0x00E0, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x1800, +0xFE00, +0xFF00, +0xFF80, +0xFFC0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFC0, +0xFE00, +0xE000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x01E0, +0x03F0, +0x0FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x07F0, +0x03F0, +0x01F0, +0x07F0, +0x0FF0, +0x0FF0, +0x07F0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x8000, +0xE600, +0xFF00, +0xFF00, +0xFF80, +0xFF80, +0xFFC0, +0xFFC0, +0xFFE0, +0xFFE0, +0xFFE0, +0xFFC0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0030, +0x03F0, +0x07F0, +0x07F0, +0x03F0, +0x03F0, +0x03F0, +0x1FF0, +0x3FF0, +0x3FF0, +0x1FF0, +0x03F0, +0x0070, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0xC000, +0xC000, +0xE000, +0xF180, +0xFF80, +0xFF80, +0xFF80, +0xFF00, +0xFF00, +0xFF00, +0xFF00, +0xFE00, +0xFE00, +0xFE00, +0x1E00, +0x0000, +0x0000, + +0x0000, +0x00F0, +0x00F0, +0x01F0, +0x01F0, +0x01F0, +0x3FF0, +0x3FF0, +0x3FF0, +0x1FF0, +0x0FF0, +0x07F0, +0x03F0, +0x01F0, +0x0070, +0x0030, +0x0010, +0x0000, + +0x0000, +0xF000, +0xF800, +0xF800, +0xF800, +0xF800, +0xFFC0, +0xFFC0, +0xFFC0, +0xFF80, +0xFF00, +0xFE00, +0xFC00, +0xF800, +0xF000, +0xE000, +0xC000, +0x0000, + +0x0000, +0x0030, +0x0030, +0x0070, +0x18F0, +0x1FF0, +0x1FF0, +0x1FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x07F0, +0x07F0, +0x07F0, +0x0780, +0x0000, +0x0000, + +0x0000, +0xC000, +0xFC00, +0xFE00, +0xFE00, +0xFC00, +0xFC00, +0xFC00, +0xFF80, +0xFFC0, +0xFFC0, +0xFF80, +0xFC00, +0xE000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0010, +0x0670, +0x0FF0, +0x0FF0, +0x1FF0, +0x1FF0, +0x3FF0, +0x3FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x3FF0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x7800, +0xFC00, +0xFF00, +0xFF80, +0xFF80, +0xFF80, +0xFE00, +0xFC00, +0xF800, +0xFE00, +0xFF00, +0xFF00, +0xFE00, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0180, +0x07F0, +0x0FF0, +0x1FF0, +0x3FF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x3FF0, +0x07F0, +0x0070, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x3C00, +0xFE00, +0xFF80, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFE00, +0xE000, +0xE000, +0xF000, +0xF000, +0x7000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0020, +0x01E0, +0x07F0, +0x3FF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x7FF0, +0x3FF0, +0x0FF0, +0x07E0, +0x03E0, +0x00E0, +0x0060, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0xFF00, +0xFF80, +0xFF80, +0xFF80, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x03F0, +0x3FF0, +0x3FF0, +0x3FF0, +0x1FF0, +0x1FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0780, +0x0700, +0x0200, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0xC000, +0xE000, +0xE000, +0xFF00, +0xFFC0, +0xFFC0, +0xFFC0, +0xFF80, +0xFF80, +0xFF80, +0x7F00, +0x0F00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0700, +0x07F0, +0x0FF0, +0x0FF0, +0x0FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1FF0, +0x1E70, +0x1810, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0xF800, +0xF800, +0xF800, +0xFE00, +0xFF80, +0xFFC0, +0xFFC0, +0xFFC0, +0xFF80, +0xFF00, +0xFE00, +0x7C00, +0x1800, +0x0000, +0x0000, +0x0000, + +0x0000, +0x01F0, +0x03F0, +0x07F0, +0x0FF0, +0x1FF0, +0x3FF0, +0x3FF0, +0x3FF0, +0x30F0, +0x00F0, +0x0070, +0x0070, +0x0030, +0x0010, +0x0000, +0x0000, +0x0000, + +0x0000, +0x8000, +0xF800, +0xFF00, +0xFF00, +0xFF00, +0xFC00, +0xFE00, +0xFF00, +0xFF80, +0xFF80, +0xFF80, +0xFF80, +0xF800, +0xC000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x1800, +0x3C00, +0x7E00, +0x7E00, +0x3C00, +0x1800, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0600, +0x0F00, +0x1F80, +0x3FC0, +0x1F80, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x0F00, +0x1F80, +0x3FC0, +0x1F80, +0x0F00, +0x0600, +0x0000, + +0x0000, +0x1000, +0x3800, +0x7C00, +0xFF00, +0xFF80, +0x7F80, +0x3BC0, +0x13C0, +0x13C0, +0x33C0, +0x7F80, +0xFF80, +0xFF00, +0x7C00, +0x3800, +0x1000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x1F80, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +0x1F80, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +0x1F80, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +0x1F80, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +0x1F80, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +0x1F80, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, + +0x0000, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7FE0, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, +0x7800, + +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x7FE0, +0xF0F0, +0xF0F0, +0xF0F0, +0xF0F0, +0x7FE0, +0x3FC0, +0x1F80, + +0x0000, +0xF800, +0xF800, +0xFFF0, +0xFFF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x7870, +0x7870, +0x7870, +0x7870, +0x7870, + +0x0000, +0x0000, +0x0000, +0x8000, +0x8000, +0x8000, +0x8000, +0x81F0, +0x81F0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xF9F0, +0xF9F0, +0xF800, +0xF800, +0xF800, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xF800, +0xF800, +0xF800, +0xF800, +0xF800, +0xF800, +0xF800, +0xF800, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0600, +0x0F00, +0x0F00, +0x1F80, +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0400, +0x0E00, +0xEEF0, +0xFFF0, +0xEEF0, +0x0E00, +0x0400, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x7DE0, +0x7FE0, +0x7FE0, +0xFFF0, +0xFFF0, +0xFFF0, +0x7FE0, +0x7BE0, +0x79E0, +0x30C0, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0F00, +0x1F80, +0x3FC0, +0x3FC0, +0x3C00, +0xFFF0, +0xFFF0, +0xFFF0, +0x3FC0, +0x3FC0, +0x3FC0, +0x0F80, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x1F80, +0x3FC0, +0x3FC0, +0x3F80, +0x3C00, +0xFFF0, +0xFFF0, +0xFFF0, +0x3F00, +0x3FC0, +0x3FC0, +0x1F80, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x30C0, +0x79E0, +0x79E0, +0x79E0, +0x7FE0, +0xFFF0, +0xFFF0, +0xFFF0, +0x3FC0, +0x3FC0, +0x3FC0, +0x1F80, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0x0000, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xE0F0, +0xF1F0, +0xFBF0, +0x3F80, +0x1F00, +0x0E00, +0x0400, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0700, +0x0F80, +0x0700, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x07F0, +0x0FF0, +0x07F0, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0E00, +0x1F00, +0x0E00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFE00, +0xFF00, +0xFE00, +0x0000, +0x0000, +0x0000, +0x0000, + +0x7800, +0x7FF0, +0x7FF0, +0x7FF0, +0x7FF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0F00, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x7870, +0xF800, +0xF800, +0xF800, +0xF800, +0x0660, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x07E0, +0x03C0, +0x0180, +0x0000, +0x0000, +0x0000, + +0xF800, +0x0000, +0x0000, +0x0000, +0x0000, +0x1800, +0x3C00, +0x7C00, +0x7C00, +0x3C00, +0x3C00, +0x3C60, +0x7EF0, +0x7EF0, +0x3C60, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3C00, +0x7E00, +0xFF00, +0xFF00, +0xFF00, +0xFF00, +0xFF00, +0xFF00, +0x7E00, +0x3C00, +0x0000, +0x0000, +0x0000, + +0x1F80, +0x3FC0, +0x3FC0, +0x1F80, +0x1F80, +0x0F00, +0x0F00, +0x0600, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, +0x00E0, + +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, +0x7000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, + +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x00E0, +0x00F0, +0x00F0, +0x00F0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x00F0, +0x00F0, +0x00F0, +0x00E0, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xF000, +0xF000, +0xF000, +0x7000, + +0x7000, +0xF000, +0xF000, +0xF000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0700, +0x0F80, +0x0700, +0x0000, +0x0000, +0x0000, +0x0100, +0x0380, +0x03C0, +0x03E0, +0x03F0, +0x03E0, +0x03C0, +0x0380, +0x0100, +0x0000, + +0x0000, +0x0000, +0x0E00, +0x1F00, +0x0E00, +0x0000, +0x0000, +0x0000, +0x0800, +0x1C00, +0x3C00, +0x7C00, +0xFC00, +0x7C00, +0x3C00, +0x1C00, +0x0800, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0780, +0x0780, +0x0780, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x0780, +0x0780, +0x0780, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0x1E00, +0x1E00, +0x1E00, + +0x1E00, +0x1E00, +0x1E00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +0x6600, +0xFF00, +0xFF00, +0xFF00, +0xFF40, +0x7EE0, +0x7EE0, +0xFFE0, +0xFF40, +0xFF40, +0x7EE0, +0x7EE0, +0xFEE0, +0xFF40, +0xFF00, +0xFF00, +0xFE00, +0x7C00, + +0x3C00, +0x7E00, +0x7E00, +0xFF00, +0xFF00, +0xFF00, +0x7F80, +0x3FC0, +0x3FC0, +0x3FC0, +0x3FC0, +0x1FE0, +0x0FF0, +0x0FF0, +0x07E0, +0x03C0, +0x03C0, +0x0180, + +0x7C00, +0xFE00, +0xFE00, +0xFE00, +0x7E00, +0xFE00, +0xFFC0, +0x3FC0, +0x3FC0, +0x0F00, +0x0F00, +0x0FC0, +0x07E0, +0x07E0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0660, + +0x7C00, +0x7E00, +0xFE00, +0xFF00, +0xFF00, +0xFF00, +0x7F80, +0x3FC0, +0x3FC0, +0x3FC0, +0x3FC0, +0x1FE0, +0x07F0, +0x07F0, +0x07F0, +0x07E0, +0x07F0, +0x03F0, + +0x6000, +0xF000, +0xF000, +0xFC00, +0xFE00, +0xFE00, +0xFFC0, +0x3FC0, +0x3FC0, +0x0F00, +0x0F00, +0x0FE0, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x07F0, +0x03E0, + +0x7C00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0x7F80, +0x3FC0, +0x1F80, +0x0F00, +0x0F00, +0x0F00, +0x0780, +0x0780, +0x0780, +0x07E0, +0x07F0, +0x03E0, + +0x7C00, +0x7E00, +0xFE00, +0xFF00, +0xFF00, +0xFF00, +0x7E00, +0x3C00, +0x3C00, +0x3F80, +0x3F80, +0x3FE0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0FF0, +0x07E0, + +0x7C00, +0xFE00, +0xFC00, +0xFE00, +0xFE00, +0xFE00, +0x7FC0, +0x3FE0, +0x3FE0, +0x3FE0, +0x3FE0, +0x3FE0, +0x03F0, +0x03F0, +0x03F0, +0x03F0, +0x03E0, +0x0180, + +0x7C00, +0xFE00, +0xFC00, +0xF800, +0xF800, +0xF000, +0x7FC0, +0x7FC0, +0x7FC0, +0x7FC0, +0x7FC0, +0x7FC0, +0x07E0, +0x07E0, +0x0FF0, +0x0FF0, +0x0FF0, +0x0660, + +0x7C00, +0xFE00, +0xFC00, +0xF800, +0xF800, +0xF000, +0x7FC0, +0x7FC0, +0x7FC0, +0x7FC0, +0x7FC0, +0x7FC0, +0x0FE0, +0x0FE0, +0x0FF0, +0x0FF0, +0x0FF0, +0x07E0, + +0x6600, +0xFF00, +0xFF00, +0xFF00, +0xFF40, +0x7FE0, +0x7FE0, +0xFFE0, +0xFF40, +0xFF40, +0xFFE0, +0x67E0, +0xFFE0, +0xFF40, +0xFF00, +0x7E00, +0x3C00, +0x1800, + +0x0000, +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x7FE0, +0x3FC0, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0000, +0x0000, +0x3FC0, +0x7FE0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x7FE0, +0x3FC0, +0x0000, +0x0000, +0x0000, + +0x0000, +0x0030, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0070, +0x0030, +0x0000, + +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, + +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFC0, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, + +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFE00, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, + +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0xF000, +0xF000, +0xF000, +0xF000, +0xF000, +0xF000, +0xF000, +0xF000, +0xF000, +0xF000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, + +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xFFF0, +0xFFF0, +0xFFF0, +0x0000, + +0x0000, +0xC000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xE000, +0xC000, +0x0000, + +0x0000, +0xFFE0, +0xFFF0, +0xFFF0, +0xF9F0, +0xFDF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFDF0, +0xF9F0, +0xFFF0, +0xFFF0, +0xFFE0, +0x0000, + +0x0010, +0x0030, +0x0330, +0x07B0, +0x07F0, +0x03F0, +0x01F0, +0x0FC0, +0x1FC0, +0x1FC0, +0x0FC0, +0x01F0, +0x03F0, +0x07F0, +0x07B0, +0x0330, +0x0030, +0x0030, + +0x8000, +0xC000, +0xCC00, +0xDE00, +0xFE00, +0xFC00, +0xF800, +0x3F00, +0x3F80, +0x3F80, +0x3F00, +0xF800, +0xFC00, +0xFE00, +0xDE00, +0xCC00, +0xC000, +0x8000, + +0x0000, +0x0030, +0x00F0, +0x01F0, +0x03F0, +0x07D0, +0x0790, +0x0F10, +0x0F10, +0x0F10, +0x0F10, +0x0790, +0x07D0, +0x03F0, +0x01F0, +0x00F0, +0x0030, +0x0000, + +0x0000, +0xC000, +0xF000, +0xF800, +0xFC00, +0xFE00, +0xFE00, +0xFF00, +0xFF00, +0xFF00, +0xFF00, +0xFE00, +0xFE00, +0xFC00, +0xF800, +0xF000, +0xC000, +0x0000, + +0x0060, +0x00F0, +0x01F0, +0x03F0, +0x7FF0, +0xFF70, +0xFE70, +0xFE70, +0xFE70, +0xFE70, +0xFE70, +0xFF70, +0x7FF0, +0x03F0, +0x01F0, +0x00F0, +0x0060, +0x0000, + +0x0200, +0x0700, +0x0380, +0x1B80, +0x3F80, +0x5FC0, +0xFFC0, +0xFFC0, +0x7FC0, +0xFFC0, +0xFFC0, +0x5FC0, +0x3F80, +0x1B80, +0x0380, +0x0700, +0x0200, +0x0000, + +0x7FE0, +0xFFF0, +0x7FE0, +0x7FE0, +0x79E0, +0x79E0, +0x3FC0, +0x1F80, +0x0F00, +0x0F00, +0x1F80, +0x3FC0, +0x79E0, +0x79E0, +0x7FE0, +0x7FE0, +0xFFF0, +0x7FE0, + +0x0000, +0x3000, +0x3800, +0x3C00, +0x3E00, +0x3F00, +0x3F80, +0x3FC0, +0x3FE0, +0x3FF0, +0x3FF0, +0x3FC0, +0x3FC0, +0x3FE0, +0x03E0, +0x03E0, +0x03E0, +0x0080, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x3220, +0x7F70, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFF70, +0xFF70, +0xFF70, +0xFF70, +0x4A20, + +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x7220, +0xFF70, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xF770, +0xE770, +0xE770, +0xE770, +0x4220, + +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +0xFFF0, +}; + +#endif /* FONT12X18_H_ */ diff --git a/flight/OSD/System/inc/font_outlined6x8.h b/flight/OSD/System/inc/font_outlined6x8.h new file mode 100644 index 000000000..efaa2367a --- /dev/null +++ b/flight/OSD/System/inc/font_outlined6x8.h @@ -0,0 +1,1041 @@ +#ifndef OEM6X8_H_ +#define OEM6X8_H_ + +// Credit for this goes to MegaPirateOSD and Syberian! +// Some minor changes made to fit my code better. + +#define CHAR_ARRAY_OFFSET 0 +#define CHAR_ARRAY_LENGTH 1024 +#define CHAR_ARRAY_MAX (CHAR_ARRAY_OFFSET + CHAR_ARRAY_LENGTH) + +#define CHAR_OFFSET CHAR_ARRAY_OFFSET/8 +#define CHAR_MAX CHAR_ARRAY_MAX/8 + +static const uint8_t oem6x8[CHAR_ARRAY_LENGTH] = { // 6x8 DOS character set +________, +________, +________, +________, +________, +________, +________, +________, +__XXX___, +_X___X__, +_XX_XX__, +_X___X__, +_X_X_X__, +_X___X__, +__XXX___, +________, +__XXX___, +_XXXXX__, +_X_X_X__, +_XXXXX__, +_X___X__, +_XXXXX__, +__XXX___, +________, +________, +__X_X___, +_XXXXX__, +_XXXXX__, +_XXXXX__, +__XXX___, +___X____, +________, +________, +___X____, +__XXX___, +_XXXXX__, +_XXXXX__, +__XXX___, +___X____, +________, +___X____, +__XXX___, +__XXX___, +___X____, +_XXXXX__, +_XXXXX__, +___X____, +________, +________, +___X____, +__XXX___, +_XXXXX__, +_XXXXX__, +___X____, +__XXX___, +________, +________, +________, +________, +__XX____, +__XX____, +________, +________, +________, +XXXXXX__, +XXXXXX__, +XXXXXX__, +XX__XX__, +XX__XX__, +XXXXXX__, +XXXXXX__, +XXXXXX__, +________, +________, +_XXXX___, +_X__X___, +_X__X___, +_XXXX___, +________, +________, +XXXXXX__, +XXXXXX__, +X____X__, +X_XX_X__, +X_XX_X__, +X____X__, +XXXXXX__, +XXXXXX__, +________, +___XXX__, +____XX__, +__XX_X__, +_X__X___, +_X__X___, +__XX____, +________, +__XXX___, +_X___X__, +_X___X__, +__XXX___, +___X____, +__XXX___, +___X____, +________, +___X____, +___XX___, +___X_X__, +___X____, +__XX____, +_XXX____, +_XX_____, +________, +____XX__, +__XX_X__, +__X_XX__, +__XX_X__, +__X_XX__, +_XX_XX__, +_XX_____, +________, +________, +_X_X_X__, +__XXX___, +_XX_XX__, +__XXX___, +_X_X_X__, +________, +________, +__X_____, +__XX____, +__XXX___, +__XXXX__, +__XXX___, +__XX____, +__X_____, +________, +____X___, +___XX___, +__XXX___, +_XXXX___, +__XXX___, +___XX___, +____X___, +________, +___X____, +__XXX___, +_XXXXX__, +___X____, +_XXXXX__, +__XXX___, +___X____, +________, +__X_X___, +__X_X___, +__X_X___, +__X_X___, +__X_X___, +________, +__X_X___, +________, +__XXXX__, +_X_X_X__, +_X_X_X__, +__XX_X__, +___X_X__, +___X_X__, +___X_X__, +________, +__XXX___, +_X___X__, +__XX____, +__X_X___, +___XX___, +_X___X__, +__XXX___, +________, +________, +________, +________, +________, +________, +_XXXX___, +_XXXX___, +________, +___X____, +__XXX___, +_XXXXX__, +___X____, +_XXXXX__, +__XXX___, +___X____, +__XXX___, +___X____, +__XXX___, +_XXXXX__, +___X____, +___X____, +___X____, +___X____, +________, +___X____, +___X____, +___X____, +___X____, +_XXXXX__, +__XXX___, +___X____, +________, +________, +___X____, +___XX___, +_XXXXX__, +___XX___, +___X____, +________, +________, +________, +___X____, +__XX____, +_XXXXX__, +__XX____, +___X____, +________, +________, +________, +________, +________, +_X______, +_X______, +_X______, +_XXXXX__, +________, +________, +__X_X___, +__X_X___, +_XXXXX__, +__X_X___, +__X_X___, +________, +________, +___X____, +___X____, +__XXX___, +__XXX___, +_XXXXX__, +_XXXXX__, +________, +________, +_XXXXX__, +_XXXXX__, +__XXX___, +__XXX___, +___X____, +___X____, +________, +________, +________, +________, +________, +________, +________, +________, +________, +________, +___X____, +__XXX___, +__XXX___, +___X____, +___X____, +________, +___X____, +________, +_XX_XX__, +_XX_XX__, +_X__X___, +________, +________, +________, +________, +________, +________, +__X_X___, +_XXXXX__, +__X_X___, +__X_X___, +_XXXXX__, +__X_X___, +________, +__X_____, +__XXX___, +_X______, +__XX____, +____X___, +_XXX____, +___X____, +________, +_XX__X__, +_XX__X__, +____X___, +___X____, +__X_____, +_X__XX__, +_X__XX__, +________, +__X_____, +_X_X____, +_X_X____, +__X_____, +_X_X_X__, +_X__X___, +__XX_X__, +________, +__XX____, +__XX____, +__X_____, +________, +________, +________, +________, +________, +___X____, +__X_____, +__X_____, +__X_____, +__X_____, +__X_____, +___X____, +________, +__X_____, +___X____, +___X____, +___X____, +___X____, +___X____, +__X_____, +________, +________, +__X_X___, +__XXX___, +_XXXXX__, +__XXX___, +__X_X___, +________, +________, +________, +___X____, +___X____, +_XXXXX__, +___X____, +___X____, +________, +________, +________, +________, +________, +________, +________, +__XX____, +__XX____, +__X_____, +________, +________, +________, +_XXXXX__, +________, +________, +________, +________, +________, +________, +________, +________, +________, +__XX____, +__XX____, +________, +________, +_____X__, +____X___, +___X____, +__X_____, +_X______, +________, +________, +__XXX___, +_X___X__, +_X__XX__, +_X_X_X__, +_XX__X__, +_X___X__, +__XXX___, +________, +___X____, +__XX____, +___X____, +___X____, +___X____, +___X____, +__XXX___, +________, +__XXX___, +_X___X__, +_____X__, +___XX___, +__X_____, +_X______, +_XXXXX__, +________, +__XXX___, +_X___X__, +_____X__, +__XXX___, +_____X__, +_X___X__, +__XXX___, +________, +____X___, +___XX___, +__X_X___, +_X__X___, +_XXXXX__, +____X___, +____X___, +________, +_XXXXX__, +_X______, +_X______, +_XXXX___, +_____X__, +_X___X__, +__XXX___, +________, +___XX___, +__X_____, +_X______, +_XXXX___, +_X___X__, +_X___X__, +__XXX___, +________, +_XXXXX__, +_____X__, +____X___, +___X____, +__X_____, +__X_____, +__X_____, +________, +__XXX___, +_X___X__, +_X___X__, +__XXX___, +_X___X__, +_X___X__, +__XXX___, +________, +__XXX___, +_X___X__, +_X___X__, +__XXXX__, +_____X__, +____X___, +__XX____, +________, +________, +________, +__XX____, +__XX____, +________, +__XX____, +__XX____, +________, +________, +________, +__XX____, +__XX____, +________, +__XX____, +__XX____, +__X_____, +____X___, +___X____, +__X_____, +_X______, +__X_____, +___X____, +____X___, +________, +________, +________, +_XXXXX__, +________, +________, +_XXXXX__, +________, +________, +__X_____, +___X____, +____X___, +_____X__, +____X___, +___X____, +__X_____, +________, +__XXX___, +_X___X__, +_____X__, +___XX___, +___X____, +________, +___X____, +________, +__XXX___, +_X___X__, +_X_XXX__, +_X_X_X__, +_X_XXX__, +_X______, +__XXX___, +________, +__XXX___, +_X___X__, +_X___X__, +_X___X__, +_XXXXX__, +_X___X__, +_X___X__, +________, +_XXXX___, +_X___X__, +_X___X__, +_XXXX___, +_X___X__, +_X___X__, +_XXXX___, +________, +__XXX___, +_X___X__, +_X______, +_X______, +_X______, +_X___X__, +__XXX___, +________, +_XXXX___, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_XXXX___, +________, +_XXXXX__, +_X______, +_X______, +_XXXX___, +_X______, +_X______, +_XXXXX__, +________, +_XXXXX__, +_X______, +_X______, +_XXXX___, +_X______, +_X______, +_X______, +________, +__XXX___, +_X___X__, +_X______, +_X_XXX__, +_X___X__, +_X___X__, +__XXXX__, +________, +_X___X__, +_X___X__, +_X___X__, +_XXXXX__, +_X___X__, +_X___X__, +_X___X__, +________, +__XXX___, +___X____, +___X____, +___X____, +___X____, +___X____, +__XXX___, +________, +_____X__, +_____X__, +_____X__, +_____X__, +_X___X__, +_X___X__, +__XXX___, +________, +_X___X__, +_X__X___, +_X_X____, +_XX_____, +_X_X____, +_X__X___, +_X___X__, +________, +_X______, +_X______, +_X______, +_X______, +_X______, +_X______, +_XXXXX__, +________, +_X___X__, +_XX_XX__, +_X_X_X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +________, +_X___X__, +_XX__X__, +_X_X_X__, +_X__XX__, +_X___X__, +_X___X__, +_X___X__, +________, +__XXX___, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +__XXX___, +________, +_XXXX___, +_X___X__, +_X___X__, +_XXXX___, +_X______, +_X______, +_X______, +________, +__XXX___, +_X___X__, +_X___X__, +_X___X__, +_X_X_X__, +_X__X___, +__XX_X__, +________, +_XXXX___, +_X___X__, +_X___X__, +_XXXX___, +_X__X___, +_X___X__, +_X___X__, +________, +__XXX___, +_X___X__, +_X______, +__XXX___, +_____X__, +_X___X__, +__XXX___, +________, +_XXXXX__, +___X____, +___X____, +___X____, +___X____, +___X____, +___X____, +________, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +__XXX___, +________, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +__X_X___, +___X____, +________, +_X___X__, +_X___X__, +_X_X_X__, +_X_X_X__, +_X_X_X__, +_X_X_X__, +__X_X___, +________, +_X___X__, +_X___X__, +__X_X___, +___X____, +__X_X___, +_X___X__, +_X___X__, +________, +_X___X__, +_X___X__, +_X___X__, +__X_X___, +___X____, +___X____, +___X____, +________, +_XXXX___, +____X___, +___X____, +__X_____, +_X______, +_X______, +_XXXX___, +________, +__XXX___, +__X_____, +__X_____, +__X_____, +__X_____, +__X_____, +__XXX___, +________, +________, +_X______, +__X_____, +___X____, +____X___, +_____X__, +________, +________, +__XXX___, +____X___, +____X___, +____X___, +____X___, +____X___, +__XXX___, +________, +___X____, +__X_X___, +_X___X__, +________, +________, +________, +________, +________, +________, +________, +________, +________, +________, +________, +________, +XXXXXX__, +__XX____, +__XX____, +___X____, +________, +________, +________, +________, +________, +________, +________, +__XXX___, +_____X__, +__XXXX__, +_X___X__, +__XXXX__, +________, +_X______, +_X______, +_XXXX___, +_X___X__, +_X___X__, +_X___X__, +_XXXX___, +________, +________, +________, +__XXX___, +_X___X__, +_X______, +_X___X__, +__XXX___, +________, +_____X__, +_____X__, +__XXXX__, +_X___X__, +_X___X__, +_X___X__, +__XXXX__, +________, +________, +________, +__XXX___, +_X___X__, +_XXXX___, +_X______, +__XXX___, +________, +___XX___, +__X_____, +__X_____, +_XXXX___, +__X_____, +__X_____, +__X_____, +________, +________, +________, +__XXXX__, +_X___X__, +_X___X__, +__XXXX__, +_____X__, +__XXX___, +_X______, +_X______, +_XXX____, +_X__X___, +_X__X___, +_X__X___, +_X__X___, +________, +___X____, +________, +___X____, +___X____, +___X____, +___X____, +___XX___, +________, +____X___, +________, +___XX___, +____X___, +____X___, +____X___, +_X__X___, +__XX____, +_X______, +_X______, +_X__X___, +_X_X____, +_XX_____, +_X_X____, +_X__X___, +________, +___X____, +___X____, +___X____, +___X____, +___X____, +___X____, +___XX___, +________, +________, +________, +_XX_X___, +_X_X_X__, +_X_X_X__, +_X___X__, +_X___X__, +________, +________, +________, +_XXX____, +_X__X___, +_X__X___, +_X__X___, +_X__X___, +________, +________, +________, +__XXX___, +_X___X__, +_X___X__, +_X___X__, +__XXX___, +________, +________, +________, +_XXXX___, +_X___X__, +_X___X__, +_X___X__, +_XXXX___, +_X______, +________, +________, +__XXXX__, +_X___X__, +_X___X__, +_X___X__, +__XXXX__, +_____X__, +________, +________, +_X_XX___, +__X__X__, +__X_____, +__X_____, +_XXX____, +________, +________, +________, +__XXX___, +_X______, +__XXX___, +_____X__, +__XXX___, +________, +________, +__X_____, +_XXXX___, +__X_____, +__X_____, +__X_X___, +___X____, +________, +________, +________, +_X__X___, +_X__X___, +_X__X___, +_X_XX___, +__X_X___, +________, +________, +________, +_X___X__, +_X___X__, +_X___X__, +__X_X___, +___X____, +________, +________, +________, +_X___X__, +_X___X__, +_X_X_X__, +_XXXXX__, +__X_X___, +________, +________, +________, +_X__X___, +_X__X___, +__XX____, +_X__X___, +_X__X___, +________, +________, +________, +_X__X___, +_X__X___, +_X__X___, +__XXX___, +___X____, +_XX_____, +________, +________, +_XXXX___, +____X___, +__XX____, +_X______, +_XXXX___, +________, +___XX___, +__X_____, +__X_____, +_XX_____, +__X_____, +__X_____, +___XX___, +________, +___X____, +___X____, +___X____, +________, +___X____, +___X____, +___X____, +________, +__XX____, +____X___, +____X___, +____XX__, +____X___, +____X___, +__XX____, +________, +__X_X___, +_X_X____, +________, +________, +________, +________, +________, +________, +___X____, +__XXX___, +_XX_XX__, +_X___X__, +_X___X__, +_XXXXX__, +________, +________ +}; + +#endif //OEM6X8_H_ diff --git a/flight/OSD/System/inc/oem6x8.h b/flight/OSD/System/inc/oem6x8.h new file mode 100644 index 000000000..efaa2367a --- /dev/null +++ b/flight/OSD/System/inc/oem6x8.h @@ -0,0 +1,1041 @@ +#ifndef OEM6X8_H_ +#define OEM6X8_H_ + +// Credit for this goes to MegaPirateOSD and Syberian! +// Some minor changes made to fit my code better. + +#define CHAR_ARRAY_OFFSET 0 +#define CHAR_ARRAY_LENGTH 1024 +#define CHAR_ARRAY_MAX (CHAR_ARRAY_OFFSET + CHAR_ARRAY_LENGTH) + +#define CHAR_OFFSET CHAR_ARRAY_OFFSET/8 +#define CHAR_MAX CHAR_ARRAY_MAX/8 + +static const uint8_t oem6x8[CHAR_ARRAY_LENGTH] = { // 6x8 DOS character set +________, +________, +________, +________, +________, +________, +________, +________, +__XXX___, +_X___X__, +_XX_XX__, +_X___X__, +_X_X_X__, +_X___X__, +__XXX___, +________, +__XXX___, +_XXXXX__, +_X_X_X__, +_XXXXX__, +_X___X__, +_XXXXX__, +__XXX___, +________, +________, +__X_X___, +_XXXXX__, +_XXXXX__, +_XXXXX__, +__XXX___, +___X____, +________, +________, +___X____, +__XXX___, +_XXXXX__, +_XXXXX__, +__XXX___, +___X____, +________, +___X____, +__XXX___, +__XXX___, +___X____, +_XXXXX__, +_XXXXX__, +___X____, +________, +________, +___X____, +__XXX___, +_XXXXX__, +_XXXXX__, +___X____, +__XXX___, +________, +________, +________, +________, +__XX____, +__XX____, +________, +________, +________, +XXXXXX__, +XXXXXX__, +XXXXXX__, +XX__XX__, +XX__XX__, +XXXXXX__, +XXXXXX__, +XXXXXX__, +________, +________, +_XXXX___, +_X__X___, +_X__X___, +_XXXX___, +________, +________, +XXXXXX__, +XXXXXX__, +X____X__, +X_XX_X__, +X_XX_X__, +X____X__, +XXXXXX__, +XXXXXX__, +________, +___XXX__, +____XX__, +__XX_X__, +_X__X___, +_X__X___, +__XX____, +________, +__XXX___, +_X___X__, +_X___X__, +__XXX___, +___X____, +__XXX___, +___X____, +________, +___X____, +___XX___, +___X_X__, +___X____, +__XX____, +_XXX____, +_XX_____, +________, +____XX__, +__XX_X__, +__X_XX__, +__XX_X__, +__X_XX__, +_XX_XX__, +_XX_____, +________, +________, +_X_X_X__, +__XXX___, +_XX_XX__, +__XXX___, +_X_X_X__, +________, +________, +__X_____, +__XX____, +__XXX___, +__XXXX__, +__XXX___, +__XX____, +__X_____, +________, +____X___, +___XX___, +__XXX___, +_XXXX___, +__XXX___, +___XX___, +____X___, +________, +___X____, +__XXX___, +_XXXXX__, +___X____, +_XXXXX__, +__XXX___, +___X____, +________, +__X_X___, +__X_X___, +__X_X___, +__X_X___, +__X_X___, +________, +__X_X___, +________, +__XXXX__, +_X_X_X__, +_X_X_X__, +__XX_X__, +___X_X__, +___X_X__, +___X_X__, +________, +__XXX___, +_X___X__, +__XX____, +__X_X___, +___XX___, +_X___X__, +__XXX___, +________, +________, +________, +________, +________, +________, +_XXXX___, +_XXXX___, +________, +___X____, +__XXX___, +_XXXXX__, +___X____, +_XXXXX__, +__XXX___, +___X____, +__XXX___, +___X____, +__XXX___, +_XXXXX__, +___X____, +___X____, +___X____, +___X____, +________, +___X____, +___X____, +___X____, +___X____, +_XXXXX__, +__XXX___, +___X____, +________, +________, +___X____, +___XX___, +_XXXXX__, +___XX___, +___X____, +________, +________, +________, +___X____, +__XX____, +_XXXXX__, +__XX____, +___X____, +________, +________, +________, +________, +________, +_X______, +_X______, +_X______, +_XXXXX__, +________, +________, +__X_X___, +__X_X___, +_XXXXX__, +__X_X___, +__X_X___, +________, +________, +___X____, +___X____, +__XXX___, +__XXX___, +_XXXXX__, +_XXXXX__, +________, +________, +_XXXXX__, +_XXXXX__, +__XXX___, +__XXX___, +___X____, +___X____, +________, +________, +________, +________, +________, +________, +________, +________, +________, +________, +___X____, +__XXX___, +__XXX___, +___X____, +___X____, +________, +___X____, +________, +_XX_XX__, +_XX_XX__, +_X__X___, +________, +________, +________, +________, +________, +________, +__X_X___, +_XXXXX__, +__X_X___, +__X_X___, +_XXXXX__, +__X_X___, +________, +__X_____, +__XXX___, +_X______, +__XX____, +____X___, +_XXX____, +___X____, +________, +_XX__X__, +_XX__X__, +____X___, +___X____, +__X_____, +_X__XX__, +_X__XX__, +________, +__X_____, +_X_X____, +_X_X____, +__X_____, +_X_X_X__, +_X__X___, +__XX_X__, +________, +__XX____, +__XX____, +__X_____, +________, +________, +________, +________, +________, +___X____, +__X_____, +__X_____, +__X_____, +__X_____, +__X_____, +___X____, +________, +__X_____, +___X____, +___X____, +___X____, +___X____, +___X____, +__X_____, +________, +________, +__X_X___, +__XXX___, +_XXXXX__, +__XXX___, +__X_X___, +________, +________, +________, +___X____, +___X____, +_XXXXX__, +___X____, +___X____, +________, +________, +________, +________, +________, +________, +________, +__XX____, +__XX____, +__X_____, +________, +________, +________, +_XXXXX__, +________, +________, +________, +________, +________, +________, +________, +________, +________, +__XX____, +__XX____, +________, +________, +_____X__, +____X___, +___X____, +__X_____, +_X______, +________, +________, +__XXX___, +_X___X__, +_X__XX__, +_X_X_X__, +_XX__X__, +_X___X__, +__XXX___, +________, +___X____, +__XX____, +___X____, +___X____, +___X____, +___X____, +__XXX___, +________, +__XXX___, +_X___X__, +_____X__, +___XX___, +__X_____, +_X______, +_XXXXX__, +________, +__XXX___, +_X___X__, +_____X__, +__XXX___, +_____X__, +_X___X__, +__XXX___, +________, +____X___, +___XX___, +__X_X___, +_X__X___, +_XXXXX__, +____X___, +____X___, +________, +_XXXXX__, +_X______, +_X______, +_XXXX___, +_____X__, +_X___X__, +__XXX___, +________, +___XX___, +__X_____, +_X______, +_XXXX___, +_X___X__, +_X___X__, +__XXX___, +________, +_XXXXX__, +_____X__, +____X___, +___X____, +__X_____, +__X_____, +__X_____, +________, +__XXX___, +_X___X__, +_X___X__, +__XXX___, +_X___X__, +_X___X__, +__XXX___, +________, +__XXX___, +_X___X__, +_X___X__, +__XXXX__, +_____X__, +____X___, +__XX____, +________, +________, +________, +__XX____, +__XX____, +________, +__XX____, +__XX____, +________, +________, +________, +__XX____, +__XX____, +________, +__XX____, +__XX____, +__X_____, +____X___, +___X____, +__X_____, +_X______, +__X_____, +___X____, +____X___, +________, +________, +________, +_XXXXX__, +________, +________, +_XXXXX__, +________, +________, +__X_____, +___X____, +____X___, +_____X__, +____X___, +___X____, +__X_____, +________, +__XXX___, +_X___X__, +_____X__, +___XX___, +___X____, +________, +___X____, +________, +__XXX___, +_X___X__, +_X_XXX__, +_X_X_X__, +_X_XXX__, +_X______, +__XXX___, +________, +__XXX___, +_X___X__, +_X___X__, +_X___X__, +_XXXXX__, +_X___X__, +_X___X__, +________, +_XXXX___, +_X___X__, +_X___X__, +_XXXX___, +_X___X__, +_X___X__, +_XXXX___, +________, +__XXX___, +_X___X__, +_X______, +_X______, +_X______, +_X___X__, +__XXX___, +________, +_XXXX___, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_XXXX___, +________, +_XXXXX__, +_X______, +_X______, +_XXXX___, +_X______, +_X______, +_XXXXX__, +________, +_XXXXX__, +_X______, +_X______, +_XXXX___, +_X______, +_X______, +_X______, +________, +__XXX___, +_X___X__, +_X______, +_X_XXX__, +_X___X__, +_X___X__, +__XXXX__, +________, +_X___X__, +_X___X__, +_X___X__, +_XXXXX__, +_X___X__, +_X___X__, +_X___X__, +________, +__XXX___, +___X____, +___X____, +___X____, +___X____, +___X____, +__XXX___, +________, +_____X__, +_____X__, +_____X__, +_____X__, +_X___X__, +_X___X__, +__XXX___, +________, +_X___X__, +_X__X___, +_X_X____, +_XX_____, +_X_X____, +_X__X___, +_X___X__, +________, +_X______, +_X______, +_X______, +_X______, +_X______, +_X______, +_XXXXX__, +________, +_X___X__, +_XX_XX__, +_X_X_X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +________, +_X___X__, +_XX__X__, +_X_X_X__, +_X__XX__, +_X___X__, +_X___X__, +_X___X__, +________, +__XXX___, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +__XXX___, +________, +_XXXX___, +_X___X__, +_X___X__, +_XXXX___, +_X______, +_X______, +_X______, +________, +__XXX___, +_X___X__, +_X___X__, +_X___X__, +_X_X_X__, +_X__X___, +__XX_X__, +________, +_XXXX___, +_X___X__, +_X___X__, +_XXXX___, +_X__X___, +_X___X__, +_X___X__, +________, +__XXX___, +_X___X__, +_X______, +__XXX___, +_____X__, +_X___X__, +__XXX___, +________, +_XXXXX__, +___X____, +___X____, +___X____, +___X____, +___X____, +___X____, +________, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +__XXX___, +________, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +_X___X__, +__X_X___, +___X____, +________, +_X___X__, +_X___X__, +_X_X_X__, +_X_X_X__, +_X_X_X__, +_X_X_X__, +__X_X___, +________, +_X___X__, +_X___X__, +__X_X___, +___X____, +__X_X___, +_X___X__, +_X___X__, +________, +_X___X__, +_X___X__, +_X___X__, +__X_X___, +___X____, +___X____, +___X____, +________, +_XXXX___, +____X___, +___X____, +__X_____, +_X______, +_X______, +_XXXX___, +________, +__XXX___, +__X_____, +__X_____, +__X_____, +__X_____, +__X_____, +__XXX___, +________, +________, +_X______, +__X_____, +___X____, +____X___, +_____X__, +________, +________, +__XXX___, +____X___, +____X___, +____X___, +____X___, +____X___, +__XXX___, +________, +___X____, +__X_X___, +_X___X__, +________, +________, +________, +________, +________, +________, +________, +________, +________, +________, +________, +________, +XXXXXX__, +__XX____, +__XX____, +___X____, +________, +________, +________, +________, +________, +________, +________, +__XXX___, +_____X__, +__XXXX__, +_X___X__, +__XXXX__, +________, +_X______, +_X______, +_XXXX___, +_X___X__, +_X___X__, +_X___X__, +_XXXX___, +________, +________, +________, +__XXX___, +_X___X__, +_X______, +_X___X__, +__XXX___, +________, +_____X__, +_____X__, +__XXXX__, +_X___X__, +_X___X__, +_X___X__, +__XXXX__, +________, +________, +________, +__XXX___, +_X___X__, +_XXXX___, +_X______, +__XXX___, +________, +___XX___, +__X_____, +__X_____, +_XXXX___, +__X_____, +__X_____, +__X_____, +________, +________, +________, +__XXXX__, +_X___X__, +_X___X__, +__XXXX__, +_____X__, +__XXX___, +_X______, +_X______, +_XXX____, +_X__X___, +_X__X___, +_X__X___, +_X__X___, +________, +___X____, +________, +___X____, +___X____, +___X____, +___X____, +___XX___, +________, +____X___, +________, +___XX___, +____X___, +____X___, +____X___, +_X__X___, +__XX____, +_X______, +_X______, +_X__X___, +_X_X____, +_XX_____, +_X_X____, +_X__X___, +________, +___X____, +___X____, +___X____, +___X____, +___X____, +___X____, +___XX___, +________, +________, +________, +_XX_X___, +_X_X_X__, +_X_X_X__, +_X___X__, +_X___X__, +________, +________, +________, +_XXX____, +_X__X___, +_X__X___, +_X__X___, +_X__X___, +________, +________, +________, +__XXX___, +_X___X__, +_X___X__, +_X___X__, +__XXX___, +________, +________, +________, +_XXXX___, +_X___X__, +_X___X__, +_X___X__, +_XXXX___, +_X______, +________, +________, +__XXXX__, +_X___X__, +_X___X__, +_X___X__, +__XXXX__, +_____X__, +________, +________, +_X_XX___, +__X__X__, +__X_____, +__X_____, +_XXX____, +________, +________, +________, +__XXX___, +_X______, +__XXX___, +_____X__, +__XXX___, +________, +________, +__X_____, +_XXXX___, +__X_____, +__X_____, +__X_X___, +___X____, +________, +________, +________, +_X__X___, +_X__X___, +_X__X___, +_X_XX___, +__X_X___, +________, +________, +________, +_X___X__, +_X___X__, +_X___X__, +__X_X___, +___X____, +________, +________, +________, +_X___X__, +_X___X__, +_X_X_X__, +_XXXXX__, +__X_X___, +________, +________, +________, +_X__X___, +_X__X___, +__XX____, +_X__X___, +_X__X___, +________, +________, +________, +_X__X___, +_X__X___, +_X__X___, +__XXX___, +___X____, +_XX_____, +________, +________, +_XXXX___, +____X___, +__XX____, +_X______, +_XXXX___, +________, +___XX___, +__X_____, +__X_____, +_XX_____, +__X_____, +__X_____, +___XX___, +________, +___X____, +___X____, +___X____, +________, +___X____, +___X____, +___X____, +________, +__XX____, +____X___, +____X___, +____XX__, +____X___, +____X___, +__XX____, +________, +__X_X___, +_X_X____, +________, +________, +________, +________, +________, +________, +___X____, +__XXX___, +_XX_XX__, +_X___X__, +_X___X__, +_XXXXX__, +________, +________ +}; + +#endif //OEM6X8_H_ diff --git a/flight/OSD/System/inc/op_config.h b/flight/OSD/System/inc/op_config.h new file mode 100644 index 000000000..97910f392 --- /dev/null +++ b/flight/OSD/System/inc/op_config.h @@ -0,0 +1,39 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotCore OpenPilot Core + * @{ + * + * @file op_config.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief OpenPilot configuration header. + * Compile time config for OpenPilot Application + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef OP_CONFIG_H +#define OP_CONFIG_H + +#endif /* OP_CONFIG_H */ +/** + * @} + * @} + */ diff --git a/flight/OSD/System/inc/openpilot.h b/flight/OSD/System/inc/openpilot.h new file mode 100644 index 000000000..59ae76fd4 --- /dev/null +++ b/flight/OSD/System/inc/openpilot.h @@ -0,0 +1,53 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotCore OpenPilot Core + * @{ + * @file openpilot.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Main OpenPilot header. + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef OPENPILOT_H +#define OPENPILOT_H + + +/* PIOS Includes */ +#include + +/* OpenPilot Libraries */ +#include "op_config.h" +#include "utlist.h" +#include "uavobjectmanager.h" +#include "eventdispatcher.h" +#include "alarms.h" +#include "taskmonitor.h" +#include "uavtalk.h" + +/* Global Functions */ +void OpenPilotInit(void); + +#endif /* OPENPILOT_H */ +/** + * @} + * @} + */ diff --git a/flight/OSD/System/inc/oposd.h b/flight/OSD/System/inc/oposd.h new file mode 100644 index 000000000..b1efc1fce --- /dev/null +++ b/flight/OSD/System/inc/oposd.h @@ -0,0 +1,74 @@ +/** + ****************************************************************************** + * + * @file main.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Main modem header. + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#include + +// ***************************************************************************** + +// firmware version +#define VERSION_MAJOR 0 // 0 to 255 +#define VERSION_MINOR 9 // 0 to 255 + +// macro's for reading internal flash memory +#define mem8(addr) (*((volatile uint8_t *)(addr))) +#define mem16(addr) (*((volatile uint16_t *)(addr))) +#define mem32(addr) (*((volatile uint32_t *)(addr))) + +enum { + FREQBAND_UNKNOWN = 0, + FREQBAND_434MHz, + FREQBAND_868MHz, + FREQBAND_915MHz +}; + +enum { + MODE_NORMAL = 0, // normal 2-way packet mode + MODE_STREAM_TX, // 1-way continuous tx packet mode + MODE_STREAM_RX, // 1-way continuous rx packet mode + MODE_PPM_TX, // PPM tx mode + MODE_PPM_RX, // PPM rx mode + MODE_SCAN_SPECTRUM, // scan the receiver over the whole band + MODE_TX_BLANK_CARRIER_TEST, // blank carrier Tx mode (for calibrating the carrier frequency say) + MODE_TX_SPECTRUM_TEST // pseudo random Tx data mode (for checking the Tx carrier spectrum) +}; + +// ***************************************************************************** + +extern volatile uint32_t random32; + +extern bool booting; + +extern uint32_t flash_size; + +extern char serial_number_str[25]; +extern uint32_t serial_number_crc32; + +// ***************************************************************************** + +#endif diff --git a/flight/OSD/System/inc/pios_board_posix.h b/flight/OSD/System/inc/pios_board_posix.h new file mode 100644 index 000000000..741f36ba7 --- /dev/null +++ b/flight/OSD/System/inc/pios_board_posix.h @@ -0,0 +1,84 @@ +/** + ****************************************************************************** + * + * @file pios_board.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Defines board hardware for the OpenPilot Version 1.1 hardware. + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef PIOS_BOARD_H +#define PIOS_BOARD_H + + + + +//------------------------ +// PIOS_LED +//------------------------ +//#define PIOS_LED_LED1_GPIO_PORT GPIOC +//#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_12 +//#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOC +//#define PIOS_LED_LED2_GPIO_PORT GPIOC +//#define PIOS_LED_LED2_GPIO_PIN GPIO_Pin_13 +//#define PIOS_LED_LED2_GPIO_CLK RCC_APB2Periph_GPIOC +#define PIOS_LED_NUM 2 +//#define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT, PIOS_LED_LED2_GPIO_PORT } +//#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN } +//#define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK } + + +//------------------------- +// COM +// +// See also pios_board_posix.c +//------------------------- +//#define PIOS_USART_TX_BUFFER_SIZE 256 +#define PIOS_COM_BUFFER_SIZE 1024 +#define PIOS_UDP_RX_BUFFER_SIZE PIOS_COM_BUFFER_SIZE + +#define PIOS_COM_TELEM_RF 0 +#define PIOS_COM_GPS 1 +#define PIOS_COM_TELEM_USB 2 + +#ifdef PIOS_ENABLE_AUX_UART +#define PIOS_COM_AUX 3 +#define PIOS_COM_DEBUG PIOS_COM_AUX +#endif + +/** + * glue macros for file IO + * STM32 uses DOSFS for file IO + */ +#define PIOS_FOPEN_READ(filename,file) (file=fopen((char*)filename,"r"))==NULL + +#define PIOS_FOPEN_WRITE(filename,file) (file=fopen((char*)filename,"w"))==NULL + +#define PIOS_FREAD(file,bufferadr,length,resultadr) (*resultadr=fread((uint8_t*)bufferadr,1,length,*file)) != length + +#define PIOS_FWRITE(file,bufferadr,length,resultadr) *resultadr=fwrite((uint8_t*)bufferadr,1,length,*file) + + + +#define PIOS_FCLOSE(file) fclose(file) + +#define PIOS_FUNLINK(file) unlink((char*)filename) + +#endif /* PIOS_BOARD_H */ diff --git a/flight/OSD/System/inc/pios_config.h b/flight/OSD/System/inc/pios_config.h new file mode 100644 index 000000000..4109a5074 --- /dev/null +++ b/flight/OSD/System/inc/pios_config.h @@ -0,0 +1,72 @@ +/** + ****************************************************************************** + * + * @file pios_config.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief PiOS configuration header. + * - Central compile time config for the project. + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef PIOS_CONFIG_H +#define PIOS_CONFIG_H + +/* Enable/Disable PiOS Modules */ +#define PIOS_INCLUDE_ADC +#define PIOS_INCLUDE_DELAY +#define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP +//#define PIOS_INCLUDE_SPI +#define PIOS_INCLUDE_SYS +#define PIOS_INCLUDE_USART +#define PIOS_INCLUDE_COM +#define PIOS_INCLUDE_FREERTOS +#define PIOS_INCLUDE_GPIO +#define PIOS_INCLUDE_EXTI +#define PIOS_INCLUDE_USB +#define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_RTC +#define PIOS_INCLUDE_VIDEO +//#define PIOS_INCLUDE_WDG + +/* Com systems to include */ +#define PIOS_INCLUDE_COM +#define PIOS_INCLUDE_COM_TELEM +#define PIOS_INCLUDE_GPS + + +#define PIOS_INCLUDE_INITCALL /* Include init call structures */ +#define PIOS_TELEM_PRIORITY_QUEUE /* Enable a priority queue in telemetry */ +#define PIOS_QUATERNION_STABILIZATION /* Stabilization options */ +//#define PIOS_GPS_SETS_HOMELOCATION /* GPS options */ + +/* Alarm Thresholds */ +#define HEAP_LIMIT_WARNING 4000 +#define HEAP_LIMIT_CRITICAL 1000 +#define IRQSTACK_LIMIT_WARNING 150 +#define IRQSTACK_LIMIT_CRITICAL 80 +#define CPULOAD_LIMIT_WARNING 80 +#define CPULOAD_LIMIT_CRITICAL 95 + +// This actually needs calibrating +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD (8379692) + +#endif /* PIOS_CONFIG_H */ diff --git a/flight/OSD/System/inc/pios_config_posix.h b/flight/OSD/System/inc/pios_config_posix.h new file mode 100644 index 000000000..ddf7ee5d4 --- /dev/null +++ b/flight/OSD/System/inc/pios_config_posix.h @@ -0,0 +1,54 @@ +/** + ****************************************************************************** + * + * @file pios_config.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief PiOS configuration header. + * Central compile time config for the project. + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef PIOS_CONFIG_POSIX_H +#define PIOS_CONFIG_POSIX_H + + +/* Enable/Disable PiOS Modules */ +#define PIOS_INCLUDE_SYS +#define PIOS_INCLUDE_DELAY +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_SDCARD +#define PIOS_INCLUDE_FREERTOS +#define PIOS_INCLUDE_COM +#define PIOS_INCLUDE_UDP +#define PIOS_INCLUDE_SERVO + + +/* Defaults for Logging */ +#define LOG_FILENAME "PIOS.LOG" +#define STARTUP_LOG_ENABLED 1 + +/* COM Module */ +#define GPS_BAUDRATE 19200 +#define TELEM_BAUDRATE 19200 +#define AUXUART_ENABLED 0 +#define AUXUART_BAUDRATE 19200 + + +#endif /* PIOS_CONFIG_POSIX_H */ diff --git a/flight/OSD/System/inc/pios_usb_board_data.h b/flight/OSD/System/inc/pios_usb_board_data.h new file mode 100644 index 000000000..68ddb5034 --- /dev/null +++ b/flight/OSD/System/inc/pios_usb_board_data.h @@ -0,0 +1,45 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_USB_BOARD Board specific USB definitions + * @brief Board specific USB definitions + * @{ + * + * @file pios_usb_board_data.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Board specific USB definitions + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_USB_BOARD_DATA_H +#define PIOS_USB_BOARD_DATA_H + +#define PIOS_USB_BOARD_CDC_DATA_LENGTH 64 +#define PIOS_USB_BOARD_CDC_MGMT_LENGTH 32 +#define PIOS_USB_BOARD_HID_DATA_LENGTH 64 + +#define PIOS_USB_BOARD_EP_NUM 4 + +#include "pios_usb_defs.h" /* USB_* macros */ + +#define PIOS_USB_BOARD_PRODUCT_ID USB_PRODUCT_ID_OSD +#define PIOS_USB_BOARD_DEVICE_VER USB_OP_DEVICE_VER(USB_OP_BOARD_ID_OSD, USB_OP_BOARD_MODE_FW) + +#endif /* PIOS_USB_BOARD_DATA_H */ diff --git a/flight/OSD/System/inc/pios_usb_hid_desc.h b/flight/OSD/System/inc/pios_usb_hid_desc.h new file mode 100644 index 000000000..4810c1274 --- /dev/null +++ b/flight/OSD/System/inc/pios_usb_hid_desc.h @@ -0,0 +1,56 @@ +/******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** +* File Name : usb_desc.h +* Author : MCD Application Team +* Version : V3.2.1 +* Date : 07/05/2010 +* Description : Descriptor Header for Custom HID Demo +******************************************************************************** +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USB_DESC_H +#define __USB_DESC_H + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Exported define -----------------------------------------------------------*/ +#define USB_DEVICE_DESCRIPTOR_TYPE 0x01 +#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 +#define USB_STRING_DESCRIPTOR_TYPE 0x03 +#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 +#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 + +#define HID_DESCRIPTOR_TYPE 0x21 +#define PIOS_HID_SIZ_HID_DESC 0x09 +#define PIOS_HID_OFF_HID_DESC 0x12 + +#define PIOS_HID_SIZ_DEVICE_DESC 18 +#define PIOS_HID_SIZ_CONFIG_DESC 41 +#define PIOS_HID_SIZ_REPORT_DESC 36 +#define PIOS_HID_SIZ_STRING_LANGID 4 +#define PIOS_HID_SIZ_STRING_VENDOR 28 +#define PIOS_HID_SIZ_STRING_PRODUCT 20 +#define PIOS_HID_SIZ_STRING_SERIAL 52 /* 96 bits, 12 bytes, 24 characters, 48 in unicode */ + +#define STANDARD_ENDPOINT_DESC_SIZE 0x09 + +/* Exported functions ------------------------------------------------------- */ +extern const uint8_t PIOS_HID_DeviceDescriptor[PIOS_HID_SIZ_DEVICE_DESC]; +extern const uint8_t PIOS_HID_ConfigDescriptor[PIOS_HID_SIZ_CONFIG_DESC]; +extern const uint8_t PIOS_HID_ReportDescriptor[PIOS_HID_SIZ_REPORT_DESC]; +extern const uint8_t PIOS_HID_StringLangID[PIOS_HID_SIZ_STRING_LANGID]; +extern const uint8_t PIOS_HID_StringVendor[PIOS_HID_SIZ_STRING_VENDOR]; +extern const uint8_t PIOS_HID_StringProduct[PIOS_HID_SIZ_STRING_PRODUCT]; +extern uint8_t PIOS_HID_StringSerial[PIOS_HID_SIZ_STRING_SERIAL]; + +#endif /* __USB_DESC_H */ + +/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ diff --git a/flight/OSD/System/inc/pios_usssb.h b/flight/OSD/System/inc/pios_usssb.h new file mode 100644 index 000000000..bab436469 --- /dev/null +++ b/flight/OSD/System/inc/pios_usssb.h @@ -0,0 +1,79 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_USB USB Functions + * @brief PIOS USB interface code + * @{ + * + * @file pios_usb.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * Parts by Thorsten Klose (tk@midibox.org) + * @brief USB functions header. + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_USB_H +#define PIOS_USB_H + +/* Local defines */ +/* Following settings allow to customise the USB device descriptor */ +#ifndef PIOS_USB_VENDOR_ID +#define PIOS_USB_VENDOR_ID 0x20A0 +#endif + + +#ifndef PIOS_USB_PRODUCT_ID +#define PIOS_USB_PRODUCT_ID 0x415C // PipXtreme PID +#endif + +#ifndef PIOS_USB_VERSION_ID +#define PIOS_USB_VERSION_ID 0x0302 // PipXtreme, board revision 1, Running state (02) +#endif + +/* Internal defines which are used by PIOS USB HID (don't touch) */ +#define PIOS_USB_EP_NUM 2 + +/* Buffer table base address */ +#define PIOS_USB_BTABLE_ADDRESS 0x000 + +/* EP0 rx/tx buffer base address */ +#define PIOS_USB_ENDP0_RXADDR 0x040 +#define PIOS_USB_ENDP0_TXADDR 0x080 + +/* EP1 Rx/Tx buffer base address for HID driver */ +#define PIOS_USB_ENDP1_TXADDR 0x0C0 +#define PIOS_USB_ENDP1_RXADDR 0x100 + + +/* Global Variables */ +extern void (*pEpInt_IN[7])(void); +extern void (*pEpInt_OUT[7])(void); + +/* Public Functions */ +extern int32_t PIOS_USB_Init(uint32_t mode); +extern int32_t PIOS_USB_IsInitialized(void); +extern int32_t PIOS_USB_CableConnected(void); + +#endif /* PIOS_USB_H */ + +/** + * @} + * @} + */ diff --git a/flight/OSD/System/inc/taskmonitor.h b/flight/OSD/System/inc/taskmonitor.h new file mode 100644 index 000000000..112598f1b --- /dev/null +++ b/flight/OSD/System/inc/taskmonitor.h @@ -0,0 +1,43 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotLibraries OpenPilot System Libraries + * @{ + * @file taskmonitor.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Include file of the task monitoring library + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef TASKMONITOR_H +#define TASKMONITOR_H + +#include "taskinfo.h" + +int32_t TaskMonitorInitialize(void); +int32_t TaskMonitorAdd(TaskInfoRunningElem task, xTaskHandle handle); +int32_t TaskMonitorRemove(TaskInfoRunningElem task); +void TaskMonitorUpdateAll(void); + +#endif // TASKMONITOR_H + +/** + * @} + * @} + */ diff --git a/flight/OSD/System/inc/usb_conf.h b/flight/OSD/System/inc/usb_conf.h new file mode 100644 index 000000000..913060c7f --- /dev/null +++ b/flight/OSD/System/inc/usb_conf.h @@ -0,0 +1,186 @@ +/******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** +* File Name : usb_conf.h +* Author : MCD Application Team +* Version : V3.2.1 +* Date : 07/05/2010 +* Description : Custom HID demo configuration file +******************************************************************************** +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USB_CONF_H +#define __USB_CONF_H + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +/* External variables --------------------------------------------------------*/ +/*-------------------------------------------------------------*/ +/* EP_NUM */ +/* defines how many endpoints are used by the device */ +/*-------------------------------------------------------------*/ +#define EP_NUM (2) + +#ifndef STM32F10X_CL +/*-------------------------------------------------------------*/ +/* -------------- Buffer Description Table -----------------*/ +/*-------------------------------------------------------------*/ +/* buffer table base address */ +/* buffer table base address */ +#define BTABLE_ADDRESS (0x00) + +/* EP0 */ +/* rx/tx buffer base address */ +#define ENDP0_RXADDR (0x18) +#define ENDP0_TXADDR (0x58) + +/* EP1 */ +/* tx buffer base address */ +#define ENDP1_TXADDR (0x100) +#define ENDP1_RXADDR (0x124) + +/*-------------------------------------------------------------*/ +/* ------------------- ISTR events -------------------------*/ +/*-------------------------------------------------------------*/ +/* IMR_MSK */ +/* mask defining which events has to be handled */ +/* by the device application software */ +#define IMR_MSK (CNTR_CTRM | CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM \ + | CNTR_ESOFM | CNTR_RESETM ) +#endif /* STM32F10X_CL */ + +#ifdef STM32F10X_CL + +/******************************************************************************* +* FIFO Size Configuration +* +* (i) Dedicated data FIFO SPRAM of 1.25 Kbytes = 1280 bytes = 320 32-bits words +* available for the endpoints IN and OUT. +* Device mode features: +* -1 bidirectional CTRL EP 0 +* -3 IN EPs to support any kind of Bulk, Interrupt or Isochronous transfer +* -3 OUT EPs to support any kind of Bulk, Interrupt or Isochronous transfer +* +* ii) Receive data FIFO size = RAM for setup packets + +* OUT endpoint control information + +* data OUT packets + miscellaneous +* Space = ONE 32-bits words +* --> RAM for setup packets = 4 * n + 6 space +* (n is the nbr of CTRL EPs the device core supports) +* --> OUT EP CTRL info = 1 space +* (one space for status information written to the FIFO along with each +* received packet) +* --> data OUT packets = (Largest Packet Size / 4) + 1 spaces +* (MINIMUM to receive packets) +* --> OR data OUT packets = at least 2*(Largest Packet Size / 4) + 1 spaces +* (if high-bandwidth EP is enabled or multiple isochronous EPs) +* --> miscellaneous = 1 space per OUT EP +* (one space for transfer complete status information also pushed to the +* FIFO with each endpoint's last packet) +* +* (iii)MINIMUM RAM space required for each IN EP Tx FIFO = MAX packet size for +* that particular IN EP. More space allocated in the IN EP Tx FIFO results +* in a better performance on the USB and can hide latencies on the AHB. +* +* (iv) TXn min size = 16 words. (n : Transmit FIFO index) +* (v) When a TxFIFO is not used, the Configuration should be as follows: +* case 1 : n > m and Txn is not used (n,m : Transmit FIFO indexes) +* --> Txm can use the space allocated for Txn. +* case2 : n < m and Txn is not used (n,m : Transmit FIFO indexes) +* --> Txn should be configured with the minimum space of 16 words +* (vi) The FIFO is used optimally when used TxFIFOs are allocated in the top +* of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones. +*******************************************************************************/ + +#define RX_FIFO_SIZE 128 +#define TX0_FIFO_SIZE 64 +#define TX1_FIFO_SIZE 64 +#define TX2_FIFO_SIZE 16 +#define TX3_FIFO_SIZE 16 + +/* OTGD-FS-DEVICE IP interrupts Enable definitions */ +/* Uncomment the define to enable the selected interrupt */ +//#define INTR_MODEMISMATCH +#define INTR_SOFINTR +#define INTR_RXSTSQLVL /* Mandatory */ +//#define INTR_NPTXFEMPTY +//#define INTR_GINNAKEFF +//#define INTR_GOUTNAKEFF +//#define INTR_ERLYSUSPEND +#define INTR_USBSUSPEND /* Mandatory */ +#define INTR_USBRESET /* Mandatory */ +#define INTR_ENUMDONE /* Mandatory */ +//#define INTR_ISOOUTDROP +//#define INTR_EOPFRAME +//#define INTR_EPMISMATCH +#define INTR_INEPINTR /* Mandatory */ +#define INTR_OUTEPINTR /* Mandatory */ +//#define INTR_INCOMPLISOIN +//#define INTR_INCOMPLISOOUT +#define INTR_WKUPINTR /* Mandatory */ + +/* OTGD-FS-DEVICE IP interrupts subroutines */ +/* Comment the define to enable the selected interrupt subroutine and replace it + by user code */ +#define INTR_MODEMISMATCH_Callback NOP_Process +#define INTR_SOFINTR_Callback NOP_Process +#define INTR_RXSTSQLVL_Callback NOP_Process +#define INTR_NPTXFEMPTY_Callback NOP_Process +#define INTR_NPTXFEMPTY_Callback NOP_Process +#define INTR_GINNAKEFF_Callback NOP_Process +#define INTR_GOUTNAKEFF_Callback NOP_Process +#define INTR_ERLYSUSPEND_Callback NOP_Process +#define INTR_USBSUSPEND_Callback NOP_Process +#define INTR_USBRESET_Callback NOP_Process +#define INTR_ENUMDONE_Callback NOP_Process +#define INTR_ISOOUTDROP_Callback NOP_Process +#define INTR_EOPFRAME_Callback NOP_Process +#define INTR_EPMISMATCH_Callback NOP_Process +#define INTR_INEPINTR_Callback NOP_Process +#define INTR_OUTEPINTR_Callback NOP_Process +#define INTR_INCOMPLISOIN_Callback NOP_Process +#define INTR_INCOMPLISOOUT_Callback NOP_Process +#define INTR_WKUPINTR_Callback NOP_Process + +/* Isochronous data update */ +#define INTR_RXSTSQLVL_ISODU_Callback NOP_Process + +/* Isochronous transfer parameters */ +/* Size of a single Isochronous buffer (size of a single transfer) */ +#define ISOC_BUFFER_SZE 1 +/* Number of sub-buffers (number of single buffers/transfers), should be even */ +#define NUM_SUB_BUFFERS 2 + +#endif /* STM32F10X_CL */ + + +/* CTR service routines */ +/* associated to defined endpoints */ +#define EP1_IN_Callback NOP_Process +#define EP2_IN_Callback NOP_Process +#define EP3_IN_Callback NOP_Process +#define EP4_IN_Callback NOP_Process +#define EP5_IN_Callback NOP_Process +#define EP6_IN_Callback NOP_Process +#define EP7_IN_Callback NOP_Process + +//#define EP1_OUT_Callback NOP_Process +#define EP2_OUT_Callback NOP_Process +#define EP3_OUT_Callback NOP_Process +#define EP4_OUT_Callback NOP_Process +#define EP5_OUT_Callback NOP_Process +#define EP6_OUT_Callback NOP_Process +#define EP7_OUT_Callback NOP_Process + +#endif /*__USB_CONF_H*/ + +/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ + diff --git a/flight/OSD/System/inc/watchdog.h b/flight/OSD/System/inc/watchdog.h new file mode 100644 index 000000000..ba3fba199 --- /dev/null +++ b/flight/OSD/System/inc/watchdog.h @@ -0,0 +1,32 @@ +/** + ****************************************************************************** + * + * @file watchdog.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief RF Module hardware layer + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _WATCHDOG_H_ +#define _WATCHDOG_H_ + +uint16_t watchdog_Init(uint16_t delayMs); +void watchdog_Clear(void); + +#endif diff --git a/flight/OSD/System/inc/xconvert.h b/flight/OSD/System/inc/xconvert.h new file mode 100644 index 000000000..be0f5aace --- /dev/null +++ b/flight/OSD/System/inc/xconvert.h @@ -0,0 +1,264 @@ +#ifndef XCONVERT_H_ +#define XCONVERT_H_ + +// Credit for this goes to MegaPirateOSD and Syberian! +// Some minor changes made to fit my code better. + +#define ________ 0 +#define _______X 1 +#define ______X_ 2 +#define ______XX 3 +#define _____X__ 4 +#define _____X_X 5 +#define _____XX_ 6 +#define _____XXX 7 +#define ____X___ 8 +#define ____X__X 9 +#define ____X_X_ 10 +#define ____X_XX 11 +#define ____XX__ 12 +#define ____XX_X 13 +#define ____XXX_ 14 +#define ____XXXX 15 +#define ___X____ 16 +#define ___X___X 17 +#define ___X__X_ 18 +#define ___X__XX 19 +#define ___X_X__ 20 +#define ___X_X_X 21 +#define ___X_XX_ 22 +#define ___X_XXX 23 +#define ___XX___ 24 +#define ___XX__X 25 +#define ___XX_X_ 26 +#define ___XX_XX 27 +#define ___XXX__ 28 +#define ___XXX_X 29 +#define ___XXXX_ 30 +#define ___XXXXX 31 +#define __X_____ 32 +#define __X____X 33 +#define __X___X_ 34 +#define __X___XX 35 +#define __X__X__ 36 +#define __X__X_X 37 +#define __X__XX_ 38 +#define __X__XXX 39 +#define __X_X___ 40 +#define __X_X__X 41 +#define __X_X_X_ 42 +#define __X_X_XX 43 +#define __X_XX__ 44 +#define __X_XX_X 45 +#define __X_XXX_ 46 +#define __X_XXXX 47 +#define __XX____ 48 +#define __XX___X 49 +#define __XX__X_ 50 +#define __XX__XX 51 +#define __XX_X__ 52 +#define __XX_X_X 53 +#define __XX_XX_ 54 +#define __XX_XXX 55 +#define __XXX___ 56 +#define __XXX__X 57 +#define __XXX_X_ 58 +#define __XXX_XX 59 +#define __XXXX__ 60 +#define __XXXX_X 61 +#define __XXXXX_ 62 +#define __XXXXXX 63 +#define _X______ 64 +#define _X_____X 65 +#define _X____X_ 66 +#define _X____XX 67 +#define _X___X__ 68 +#define _X___X_X 69 +#define _X___XX_ 70 +#define _X___XXX 71 +#define _X__X___ 72 +#define _X__X__X 73 +#define _X__X_X_ 74 +#define _X__X_XX 75 +#define _X__XX__ 76 +#define _X__XX_X 77 +#define _X__XXX_ 78 +#define _X__XXXX 79 +#define _X_X____ 80 +#define _X_X___X 81 +#define _X_X__X_ 82 +#define _X_X__XX 83 +#define _X_X_X__ 84 +#define _X_X_X_X 85 +#define _X_X_XX_ 86 +#define _X_X_XXX 87 +#define _X_XX___ 88 +#define _X_XX__X 89 +#define _X_XX_X_ 90 +#define _X_XX_XX 91 +#define _X_XXX__ 92 +#define _X_XXX_X 93 +#define _X_XXXX_ 94 +#define _X_XXXXX 95 +#define _XX_____ 96 +#define _XX____X 97 +#define _XX___X_ 98 +#define _XX___XX 99 +#define _XX__X__ 100 +#define _XX__X_X 101 +#define _XX__XX_ 102 +#define _XX__XXX 103 +#define _XX_X___ 104 +#define _XX_X__X 105 +#define _XX_X_X_ 106 +#define _XX_X_XX 107 +#define _XX_XX__ 108 +#define _XX_XX_X 109 +#define _XX_XXX_ 110 +#define _XX_XXXX 111 +#define _XXX____ 112 +#define _XXX___X 113 +#define _XXX__X_ 114 +#define _XXX__XX 115 +#define _XXX_X__ 116 +#define _XXX_X_X 117 +#define _XXX_XX_ 118 +#define _XXX_XXX 119 +#define _XXXX___ 120 +#define _XXXX__X 121 +#define _XXXX_X_ 122 +#define _XXXX_XX 123 +#define _XXXXX__ 124 +#define _XXXXX_X 125 +#define _XXXXXX_ 126 +#define _XXXXXXX 127 +#define X_______ 128 +#define X______X 129 +#define X_____X_ 130 +#define X_____XX 131 +#define X____X__ 132 +#define X____X_X 133 +#define X____XX_ 134 +#define X____XXX 135 +#define X___X___ 136 +#define X___X__X 137 +#define X___X_X_ 138 +#define X___X_XX 139 +#define X___XX__ 140 +#define X___XX_X 141 +#define X___XXX_ 142 +#define X___XXXX 143 +#define X__X____ 144 +#define X__X___X 145 +#define X__X__X_ 146 +#define X__X__XX 147 +#define X__X_X__ 148 +#define X__X_X_X 149 +#define X__X_XX_ 150 +#define X__X_XXX 151 +#define X__XX___ 152 +#define X__XX__X 153 +#define X__XX_X_ 154 +#define X__XX_XX 155 +#define X__XXX__ 156 +#define X__XXX_X 157 +#define X__XXXX_ 158 +#define X__XXXXX 159 +#define X_X_____ 160 +#define X_X____X 161 +#define X_X___X_ 162 +#define X_X___XX 163 +#define X_X__X__ 164 +#define X_X__X_X 165 +#define X_X__XX_ 166 +#define X_X__XXX 167 +#define X_X_X___ 168 +#define X_X_X__X 169 +#define X_X_X_X_ 170 +#define X_X_X_XX 171 +#define X_X_XX__ 172 +#define X_X_XX_X 173 +#define X_X_XXX_ 174 +#define X_X_XXXX 175 +#define X_XX____ 176 +#define X_XX___X 177 +#define X_XX__X_ 178 +#define X_XX__XX 179 +#define X_XX_X__ 180 +#define X_XX_X_X 181 +#define X_XX_XX_ 182 +#define X_XX_XXX 183 +#define X_XXX___ 184 +#define X_XXX__X 185 +#define X_XXX_X_ 186 +#define X_XXX_XX 187 +#define X_XXXX__ 188 +#define X_XXXX_X 189 +#define X_XXXXX_ 190 +#define X_XXXXXX 191 +#define XX______ 192 +#define XX_____X 193 +#define XX____X_ 194 +#define XX____XX 195 +#define XX___X__ 196 +#define XX___X_X 197 +#define XX___XX_ 198 +#define XX___XXX 199 +#define XX__X___ 200 +#define XX__X__X 201 +#define XX__X_X_ 202 +#define XX__X_XX 203 +#define XX__XX__ 204 +#define XX__XX_X 205 +#define XX__XXX_ 206 +#define XX__XXXX 207 +#define XX_X____ 208 +#define XX_X___X 209 +#define XX_X__X_ 210 +#define XX_X__XX 211 +#define XX_X_X__ 212 +#define XX_X_X_X 213 +#define XX_X_XX_ 214 +#define XX_X_XXX 215 +#define XX_XX___ 216 +#define XX_XX__X 217 +#define XX_XX_X_ 218 +#define XX_XX_XX 219 +#define XX_XXX__ 220 +#define XX_XXX_X 221 +#define XX_XXXX_ 222 +#define XX_XXXXX 223 +#define XXX_____ 224 +#define XXX____X 225 +#define XXX___X_ 226 +#define XXX___XX 227 +#define XXX__X__ 228 +#define XXX__X_X 229 +#define XXX__XX_ 230 +#define XXX__XXX 231 +#define XXX_X___ 232 +#define XXX_X__X 233 +#define XXX_X_X_ 234 +#define XXX_X_XX 235 +#define XXX_XX__ 236 +#define XXX_XX_X 237 +#define XXX_XXX_ 238 +#define XXX_XXXX 239 +#define XXXX____ 240 +#define XXXX___X 241 +#define XXXX__X_ 242 +#define XXXX__XX 243 +#define XXXX_X__ 244 +#define XXXX_X_X 245 +#define XXXX_XX_ 246 +#define XXXX_XXX 247 +#define XXXXX___ 248 +#define XXXXX__X 249 +#define XXXXX_X_ 250 +#define XXXXX_XX 251 +#define XXXXXX__ 252 +#define XXXXXX_X 253 +#define XXXXXXX_ 254 +#define XXXXXXXX 255 + +#endif //XCONVERT_H_ \ No newline at end of file diff --git a/flight/OSD/System/osd.c b/flight/OSD/System/osd.c new file mode 100644 index 000000000..a4abdbcd7 --- /dev/null +++ b/flight/OSD/System/osd.c @@ -0,0 +1,320 @@ + +/** + ****************************************************************************** + * + * @file main.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Main modem functions + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +// ***************************************************************************** + +//#define USE_WATCHDOG // comment this out if you don't want to use the watchdog + +// ***************************************************************************** +// OpenPilot Includes + +#include + +#include "oposd.h" +#include "watchdog.h" +#include "systemmod.h" + +/* Task Priorities */ +#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3) + +/* Global Variables */ + +/* Prototype of PIOS_Board_Init() function */ +extern void PIOS_Board_Init(void); +extern void Stack_Change(void); +static void Stack_Change_Weak () __attribute__ ((weakref ("Stack_Change"))); + + +/* Function Prototypes */ +static void initTask(void *parameters); +/* Local Variables */ +#define INIT_TASK_PRIORITY (tskIDLE_PRIORITY + configMAX_PRIORITIES - 1) // max priority +#define INIT_TASK_STACK (1024 / 4) // XXX this seems excessive +static xTaskHandle initTaskHandle; + +// ***************************************************************************** +// Global Variables + +// ***************************************************************************** +// Local Variables + +#if defined(USE_WATCHDOG) + volatile uint16_t watchdog_timer; + uint16_t watchdog_delay; +#endif + +// ***************************************************************************** + +#if defined(USE_WATCHDOG) + + void processWatchdog(void) + { + // random32 = UpdateCRC32(random32, IWDG->SR); + + if (watchdog_timer < watchdog_delay) + return; + + // the watchdog needs resetting + + watchdog_timer = 0; + + watchdog_Clear(); + } + + void enableWatchdog(void) + { // enable a watchdog + watchdog_timer = 0; + watchdog_delay = watchdog_Init(1000); // 1 second watchdog timeout + } + +#endif + +// ***************************************************************************** + +void sequenceLEDs(void) +{ + for (int i = 0; i < 2; i++) + { + //USB_LED_ON; + PIOS_DELAY_WaitmS(100); + //USB_LED_OFF; + PIOS_DELAY_WaitmS(100); + + #if defined(USE_WATCHDOG) + processWatchdog(); // process the watchdog + #endif + } +} + +// ***************************************************************************** +// find out what caused our reset and act on it + +void processReset(void) +{ + if (RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET) + { // Independant Watchdog Reset + + #if defined(PIOS_COM_DEBUG) + DEBUG_PRINTF("\r\nINDEPENDANT WATCHDOG CAUSED A RESET\r\n"); + #endif + + // all led's ON + //USB_LED_ON; + + + PIOS_DELAY_WaitmS(500); // delay a bit + + // all led's OFF + //USB_LED_OFF; + + + } +/* + if (RCC_GetFlagStatus(RCC_FLAG_WWDGRST) != RESET) + { // Window Watchdog Reset + + DEBUG_PRINTF("\r\nWINDOW WATCHDOG CAUSED A REBOOT\r\n"); + + // all led's ON + USB_LED_ON; + LINK_LED_ON; + RX_LED_ON; + TX_LED_ON; + + PIOS_DELAY_WaitmS(500); // delay a bit + + // all led's OFF + USB_LED_OFF; + LINK_LED_OFF; + RX_LED_OFF; + TX_LED_OFF; + } +*/ + if (RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET) + { // Power-On Reset + #if defined(PIOS_COM_DEBUG) + DEBUG_PRINTF("\r\nPOWER-ON-RESET\r\n"); + #endif + } + + if (RCC_GetFlagStatus(RCC_FLAG_SFTRST) != RESET) + { // Software Reset + #if defined(PIOS_COM_DEBUG) + DEBUG_PRINTF("\r\nSOFTWARE RESET\r\n"); + #endif + } + + if (RCC_GetFlagStatus(RCC_FLAG_LPWRRST) != RESET) + { // Low-Power Reset + #if defined(PIOS_COM_DEBUG) + DEBUG_PRINTF("\r\nLOW POWER RESET\r\n"); + #endif + } + + if (RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET) + { // Pin Reset + #if defined(PIOS_COM_DEBUG) + DEBUG_PRINTF("\r\nPIN RESET\r\n"); + #endif + } + + // Clear reset flags + RCC_ClearFlag(); +} + +/*static void updateOnceEveryFrame() { +#ifdef TEXT_ENABLED + clearText(); + for (uint8_t i = 0; i < TEXT_LINES; ++i) { + updateText(i); + } +#endif //TEXT_ENABLED + +#ifdef GRAPICSENABLED + clearGraphics(); + updateGrapics(); +#endif //GRAPICSENABLED +} +*/ + +int main() +{ + int result; + // ************* + // init various variables + // ************* + /* NOTE: Do NOT modify the following start-up sequence */ + /* Any new initialization functions should be added in OpenPilotInit() */ + vPortInitialiseBlocks(); + + // Bring up System using CMSIS functions, enables the LEDs. + PIOS_SYS_Init(); + + /* For Revolution we use a FreeRTOS task to bring up the system so we can */ + /* always rely on FreeRTOS primitive */ + result = xTaskCreate(initTask, (const signed char *)"init", + INIT_TASK_STACK, NULL, INIT_TASK_PRIORITY, + &initTaskHandle); + PIOS_Assert(result == pdPASS); + + // turn all the leds off + //USB_LED_OFF; + + + #if defined(PIOS_COM_DEBUG) + DEBUG_PRINTF("\r\n"); + #endif + + // ************* + // Main executive loop + clearGraphics(); + introGraphics(); + PIOS_DELAY_WaitmS(1000); + //clearText(); + introText(); + PIOS_DELAY_WaitmS(1000); + /*for(int i=0;i<10000;i++){ + updateTextPixmap(activeTextId); + PIOS_DELAY_WaituS(10); + }*/ + + /* swap the stack to use the IRQ stack */ + //Stack_Change(); + + /* Start the FreeRTOS scheduler which should never returns.*/ + vTaskStartScheduler(); + + /* If all is well we will never reach here as the scheduler will now be running. */ + + /* Do some indication to user that something bad just happened */ + PIOS_LED_Off(PIOS_LED_HEARTBEAT); \ + for(;;) { \ + PIOS_LED_Toggle(PIOS_LED_HEARTBEAT); \ + PIOS_DELAY_WaitmS(100); \ + }; + + return 0; +/* + for (;;) + { +#ifdef TEXT_ENABLED + if (update == 2) { + update = 0; +#ifdef TEXT_INVERTED_ENABLED + clearTextInverted(); +#endif //TEXT_INVERTED_ENABLED + updateTextPixmap(activeTextId); + } + else if (update == 1) { +#else + if (update == 1) { +#endif //TEXTENABLED + update = 0; + updateOnceEveryFrame(); + } + + #if defined(USE_WATCHDOG) + processWatchdog(); // process the watchdog + #endif + } + + // ************* + // we should never arrive here + + // disable all interrupts + PIOS_IRQ_Disable(); + + // turn off all leds + USB_LED_OFF; + + + PIOS_SYS_Reset(); + + while (1); +*/ + return 0; +} + +/** + * Initialisation task. + * + * Runs board and module initialisation, then terminates. + */ +void +initTask(void *parameters) +{ + /* board driver init */ + PIOS_Board_Init(); + + /* Initialize modules */ + MODULE_INITIALISE_ALL; + + /* terminate this task */ + vTaskDelete(NULL); +} + +// ***************************************************************************** diff --git a/flight/OSD/System/pios_board.c b/flight/OSD/System/pios_board.c new file mode 100644 index 000000000..afc122eb1 --- /dev/null +++ b/flight/OSD/System/pios_board.c @@ -0,0 +1,1263 @@ +/** + ****************************************************************************** + * + * @file pios_board.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Defines board specific static initializers for hardware for the OPOSD board. + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#define TxBufferSize3 33 + + +/* Private macro -------------------------------------------------------------*/ +#define countof(a) (sizeof(a) / sizeof(*(a))) + +/* Private variables ---------------------------------------------------------*/ +//uint8_t TxBuffer2[TxBufferSize2]; +uint8_t TxBuffer3[TxBufferSize3]; +//uint8_t RxBuffer2[TxBufferSize2]; +uint8_t RxBuffer3[TxBufferSize3]; +//uint8_t UART1_REVDATA[380]; + + + +/** + * PIOS_Board_Init() + * initializes all the core subsystems on this specific hardware + * called from System/openpilot.c + */ + +#if defined(PIOS_INCLUDE_RTC) +/* + * Realtime Clock (RTC) + */ +#include + +void PIOS_RTC_IRQ_Handler (void); +void RTC_WKUP_IRQHandler() __attribute__ ((alias ("PIOS_RTC_IRQ_Handler"))); +static const struct pios_rtc_cfg pios_rtc_main_cfg = { + .clksrc = RCC_RTCCLKSource_HSE_Div8, // Divide 8 Mhz crystal down to 1 + // For some reason it's acting like crystal is 16 Mhz. This clock is then divided + // by another 16 to give a nominal 62.5 khz clock + .prescaler = 100, // Every 100 cycles gives 625 Hz + .irq = { + .init = { + .NVIC_IRQChannel = RTC_WKUP_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, +}; + +void PIOS_RTC_IRQ_Handler (void) +{ + PIOS_RTC_irq_handler (); +} + +#endif + +#if defined(PIOS_INCLUDE_LED) + +#include +static const struct pios_led pios_leds[] = { + [PIOS_LED_HEARTBEAT] = { + .pin = { + .gpio = GPIOD, + .init = { + .GPIO_Pin = GPIO_Pin_13, + .GPIO_Speed = GPIO_Speed_50MHz, + .GPIO_Mode = GPIO_Mode_OUT, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, + }, + [PIOS_LED_ALARM] = { + .pin = { + .gpio = GPIOD, + .init = { + .GPIO_Pin = GPIO_Pin_12, + .GPIO_Speed = GPIO_Speed_50MHz, + .GPIO_Mode = GPIO_Mode_OUT, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, + }, +}; + +static const struct pios_led_cfg pios_led_cfg = { + .leds = pios_leds, + .num_leds = NELEMENTS(pios_leds), +}; + +#endif /* PIOS_INCLUDE_LED */ + + + +#if defined(PIOS_INCLUDE_GPS) + +#include + +/* + * GPS USART + */ +static const struct pios_usart_cfg pios_usart_gps_cfg = { + .regs = USART1, + .remap = GPIO_AF_USART1, + .init = { + .USART_BaudRate = 38400, + .USART_WordLength = USART_WordLength_8b, + .USART_Parity = USART_Parity_No, + .USART_StopBits = USART_StopBits_1, + .USART_HardwareFlowControl = + USART_HardwareFlowControl_None, + .USART_Mode = USART_Mode_Rx | USART_Mode_Tx, + }, + .irq = { + .init = { + .NVIC_IRQChannel = USART1_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + .rx = { + .gpio = GPIOA, + .init = { + .GPIO_Pin = GPIO_Pin_10, + .GPIO_Speed = GPIO_Speed_2MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, + .tx = { + .gpio = GPIOA, + .init = { + .GPIO_Pin = GPIO_Pin_9, + .GPIO_Speed = GPIO_Speed_2MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, +}; + +#endif /* PIOS_INCLUDE_GPS */ + +#ifdef PIOS_INCLUDE_COM_AUX +/* + * AUX USART + */ +static const struct pios_usart_cfg pios_usart_aux_cfg = { + .regs = USART1, + .remap = GPIO_AF_USART1, + .init = { + .USART_BaudRate = 230400, + .USART_WordLength = USART_WordLength_8b, + .USART_Parity = USART_Parity_No, + .USART_StopBits = USART_StopBits_1, + .USART_HardwareFlowControl = + USART_HardwareFlowControl_None, + .USART_Mode = USART_Mode_Rx | USART_Mode_Tx, + }, + .irq = { + .init = { + .NVIC_IRQChannel = USART1_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + .rx = { + .gpio = GPIOA, + .init = { + .GPIO_Pin = GPIO_Pin_10, + .GPIO_Speed = GPIO_Speed_2MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, + .tx = { + .gpio = GPIOA, + .init = { + .GPIO_Pin = GPIO_Pin_9, + .GPIO_Speed = GPIO_Speed_2MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, +}; + +#endif /* PIOS_COM_AUX */ + +#ifdef PIOS_INCLUDE_COM_TELEM +/* + * Telemetry on main USART + */ +static const struct pios_usart_cfg pios_usart_telem_main_cfg = { + .regs = USART6, + .remap = GPIO_AF_USART6, + .init = { + .USART_BaudRate = 57600, + .USART_WordLength = USART_WordLength_8b, + .USART_Parity = USART_Parity_No, + .USART_StopBits = USART_StopBits_1, + .USART_HardwareFlowControl = + USART_HardwareFlowControl_None, + .USART_Mode = USART_Mode_Rx | USART_Mode_Tx, + }, + .irq = { + .init = { + .NVIC_IRQChannel = USART6_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + .rx = { + .gpio = GPIOC, + .init = { + .GPIO_Pin = GPIO_Pin_7, + .GPIO_Speed = GPIO_Speed_2MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, + .tx = { + .gpio = GPIOC, + .init = { + .GPIO_Pin = GPIO_Pin_6, + .GPIO_Speed = GPIO_Speed_2MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, +}; + +#endif /* PIOS_COM_TELEM */ + + +#if defined(PIOS_INCLUDE_VIDEO) + +#include +static const struct pios_exti_cfg pios_exti_hsync_cfg __exti_config = { + .vector = PIOS_Hsync_ISR, + .line = EXTI_Line0, + .pin = { + .gpio = GPIOD, + .init = { + .GPIO_Pin = GPIO_Pin_0, + .GPIO_Speed = GPIO_Speed_100MHz, + .GPIO_Mode = GPIO_Mode_IN, + .GPIO_OType = GPIO_OType_OD, + .GPIO_PuPd = GPIO_PuPd_NOPULL, + }, + }, + .irq = { + .init = { + .NVIC_IRQChannel = EXTI0_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + .exti = { + .init = { + .EXTI_Line = EXTI_Line0, // matches above GPIO pin + .EXTI_Mode = EXTI_Mode_Interrupt, + .EXTI_Trigger = EXTI_Trigger_Rising_Falling, + .EXTI_LineCmd = ENABLE, + }, + }, +}; +static const struct pios_exti_cfg pios_exti_vsync_cfg __exti_config = { + .vector = PIOS_Vsync_ISR, + .line = EXTI_Line11, + .pin = { + .gpio = GPIOC, + .init = { + .GPIO_Pin = GPIO_Pin_11, + .GPIO_Speed = GPIO_Speed_100MHz, + .GPIO_Mode = GPIO_Mode_IN, + .GPIO_OType = GPIO_OType_OD, + .GPIO_PuPd = GPIO_PuPd_NOPULL, + }, + }, + .irq = { + .init = { + .NVIC_IRQChannel = EXTI15_10_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + .exti = { + .init = { + .EXTI_Line = EXTI_Line11, // matches above GPIO pin + .EXTI_Mode = EXTI_Mode_Interrupt, + .EXTI_Trigger = EXTI_Trigger_Falling, + .EXTI_LineCmd = ENABLE, + }, + }, +}; + + +static const struct pios_video_cfg pios_video_cfg = { + .mask = { + .regs = SPI3, + .remap = GPIO_AF_SPI3, + .init = { + .SPI_Mode = SPI_Mode_Master, + .SPI_Direction = SPI_Direction_1Line_Tx, + .SPI_DataSize = SPI_DataSize_16b, + .SPI_NSS = SPI_NSS_Soft, + .SPI_FirstBit = SPI_FirstBit_MSB, + .SPI_CRCPolynomial = 7, + .SPI_CPOL = SPI_CPOL_Low, + .SPI_CPHA = SPI_CPHA_2Edge, + .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4, + }, + .use_crc = false, + .dma = { + .irq = { + // Note this is the stream ID that triggers interrupts (in this case RX) + .flags = (DMA_IT_TCIF7), + .init = { + .NVIC_IRQChannel = DMA1_Stream7_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + + .rx = { + //not used + .channel = DMA1_Stream4, + .init = { + .DMA_Channel = DMA_Channel_0, + .DMA_PeripheralBaseAddr = (uint32_t) & (SPI3->DR), + .DMA_DIR = DMA_DIR_PeripheralToMemory, + .DMA_PeripheralInc = DMA_PeripheralInc_Disable, + .DMA_MemoryInc = DMA_MemoryInc_Enable, + .DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord, + .DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord, + .DMA_Mode = DMA_Mode_Normal, + .DMA_Priority = DMA_Priority_Medium, + //TODO: Enable FIFO + .DMA_FIFOMode = DMA_FIFOMode_Disable, + .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, + .DMA_MemoryBurst = DMA_MemoryBurst_Single, + .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, + }, + }, + .tx = { + .channel = DMA1_Stream7, + .init = { + .DMA_Channel = DMA_Channel_0, + .DMA_PeripheralBaseAddr = (uint32_t) & (SPI3->DR), + .DMA_DIR = DMA_DIR_MemoryToPeripheral, + .DMA_BufferSize = BUFFER_LINE_LENGTH, + .DMA_PeripheralInc = DMA_PeripheralInc_Disable, + .DMA_MemoryInc = DMA_MemoryInc_Enable, + .DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord, + .DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord, + .DMA_Mode = DMA_Mode_Normal, + .DMA_Priority = DMA_Priority_High, + .DMA_FIFOMode = DMA_FIFOMode_Disable, + .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, + .DMA_MemoryBurst = DMA_MemoryBurst_Single, + .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, + }, + }, + }, + .sclk = { + .gpio = GPIOC, + .init = { + .GPIO_Pin = GPIO_Pin_10, + .GPIO_Speed = GPIO_Speed_100MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_NOPULL + }, + }, + .miso = { + .gpio = GPIOC, + .init = { + .GPIO_Pin = GPIO_Pin_11, + .GPIO_Speed = GPIO_Speed_50MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_NOPULL + }, + }, + .mosi = { + .gpio = GPIOC, + .init = { + .GPIO_Pin = GPIO_Pin_12, + .GPIO_Speed = GPIO_Speed_50MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_NOPULL + }, + }, + .slave_count = 1, + }, + .level = { + .regs = SPI1, + .remap = GPIO_AF_SPI1, + .init = { + .SPI_Mode = SPI_Mode_Slave, + .SPI_Direction = SPI_Direction_1Line_Tx, + .SPI_DataSize = SPI_DataSize_16b, + .SPI_NSS = SPI_NSS_Soft, + .SPI_FirstBit = SPI_FirstBit_MSB, + .SPI_CRCPolynomial = 7, + .SPI_CPOL = SPI_CPOL_Low, + .SPI_CPHA = SPI_CPHA_2Edge, + .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2, + }, + .use_crc = false, + .dma = { + .irq = { + .flags = (DMA_IT_TCIF5), + .init = { + .NVIC_IRQChannel = DMA2_Stream5_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + + .rx = { + //not used + .channel = DMA2_Stream0, + .init = { + .DMA_Channel = DMA_Channel_3, + .DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR), + .DMA_DIR = DMA_DIR_PeripheralToMemory, + .DMA_PeripheralInc = DMA_PeripheralInc_Disable, + .DMA_MemoryInc = DMA_MemoryInc_Enable, + .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte, + .DMA_MemoryDataSize = DMA_MemoryDataSize_Byte, + .DMA_Mode = DMA_Mode_Normal, + .DMA_Priority = DMA_Priority_Medium, + .DMA_FIFOMode = DMA_FIFOMode_Disable, + /* .DMA_FIFOThreshold */ + .DMA_MemoryBurst = DMA_MemoryBurst_Single, + .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, + }, + }, + .tx = { + .channel = DMA2_Stream5, + .init = { + .DMA_Channel = DMA_Channel_3, + .DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR), + .DMA_DIR = DMA_DIR_MemoryToPeripheral, + .DMA_BufferSize = BUFFER_LINE_LENGTH, + .DMA_PeripheralInc = DMA_PeripheralInc_Disable, + .DMA_MemoryInc = DMA_MemoryInc_Enable, + .DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord, + .DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord, + .DMA_Mode = DMA_Mode_Normal, + .DMA_Priority = DMA_Priority_High, + .DMA_FIFOMode = DMA_FIFOMode_Disable, + .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, + .DMA_MemoryBurst = DMA_MemoryBurst_Single, + .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, + }, + }, + }, + .sclk = { + .gpio = GPIOB, + .init = { + .GPIO_Pin = GPIO_Pin_3, + .GPIO_Speed = GPIO_Speed_100MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, + .miso = { + .gpio = GPIOB, + .init = { + .GPIO_Pin = GPIO_Pin_4, + .GPIO_Speed = GPIO_Speed_50MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, + .mosi = { + .gpio = GPIOB, + .init = { + .GPIO_Pin = GPIO_Pin_5, + .GPIO_Speed = GPIO_Speed_50MHz, + .GPIO_Mode = GPIO_Mode_AF, + .GPIO_OType = GPIO_OType_PP, + .GPIO_PuPd = GPIO_PuPd_UP + }, + }, + .slave_count = 1, + + }, + ///////////////// + + .hsync = &pios_exti_hsync_cfg, + .vsync = &pios_exti_vsync_cfg, +}; + + + + +void PIOS_VIDEO_DMA_Handler(void); +void DMA1_Stream7_IRQHandler(void) __attribute__ ((alias("PIOS_VIDEO_DMA_Handler"))); +void DMA2_Stream5_IRQHandler(void) __attribute__ ((alias("PIOS_VIDEO_DMA_Handler"))); + +/** + * @brief Interrupt for half and full buffer transfer + * + * This interrupt handler swaps between the two halfs of the double buffer to make + * sure the ahrs uses the most recent data. Only swaps data when AHRS is idle, but + * really this is a pretense of a sanity check since the DMA engine is consantly + * running in the background. Keep an eye on the ekf_too_slow variable to make sure + * it's keeping up. + */ +void PIOS_VIDEO_DMA_Handler(void) +{ + if (DMA_GetFlagStatus(DMA1_Stream7,DMA_FLAG_TCIF7)) { // whole double buffer filled + DMA_ClearFlag(DMA1_Stream5,DMA_FLAG_TCIF7); + //PIOS_LED_Toggle(LED2); + } + else if (DMA_GetFlagStatus(DMA1_Stream7,DMA_FLAG_HTIF7)) { + DMA_ClearFlag(DMA1_Stream5,DMA_FLAG_HTIF7); + } + else { + + } + + if (DMA_GetFlagStatus(DMA2_Stream5,DMA_FLAG_TCIF5)) { // whole double buffer filled + DMA_ClearFlag(DMA2_Stream5,DMA_FLAG_TCIF5); + //PIOS_LED_Toggle(LED3); + } + else if (DMA_GetFlagStatus(DMA2_Stream5,DMA_FLAG_HTIF5)) { + DMA_ClearFlag(DMA2_Stream5,DMA_FLAG_HTIF5); + } + else { + + } + +} + +#endif + + +/* +* ADC system +*/ + +#include + +void PIOS_ADC_handler(void) +{ + PIOS_ADC_DMA_Handler(); +} + +void DMA2_Stream4_IRQHandler() __attribute__ ((alias("PIOS_ADC_handler"))); + +const struct pios_adc_cfg pios_adc_cfg = { + .dma = { + .irq = { + .flags = (DMA_FLAG_TCIF4 | DMA_FLAG_TEIF4 | DMA_FLAG_HTIF4), + .init = { + .NVIC_IRQChannel = DMA2_Stream4_IRQn + }, + }, + /* XXX there is secret knowledge here regarding the use of ADC1 by the pios_adc code */ + .rx = { + .channel = DMA2_Stream4, // stream0 may be used by SPI1 + .init = { + .DMA_Channel = DMA_Channel_0, + .DMA_PeripheralBaseAddr = (uint32_t) & ADC1->DR + }, + } + }, + .half_flag = DMA_IT_HTIF4, + .full_flag = DMA_IT_TCIF4, +}; + +struct pios_adc_dev pios_adc_devs[] = { + { + .cfg = &pios_adc_cfg, + .callback_function = NULL, + .data_queue = NULL + }, +}; + +uint8_t pios_adc_num_devices = NELEMENTS(pios_adc_devs); + + +/* Private define ------------------------------------------------------------*/ +#define DAC_DHR12R2_ADDRESS 0x40007414 +#define DAC_DHR8R1_ADDRESS 0x40007410 + + +/* Private variables ---------------------------------------------------------*/ +DAC_InitTypeDef DAC_InitStructure; + +const uint16_t Sine12bit[32] = { + 2047, 2447, 2831, 3185, 3498, 3750, 3939, 4056, 4095, 4056, + 3939, 3750, 3495, 3185, 2831, 2447, 2047, 1647, 1263, 909, + 599, 344, 155, 38, 0, 38, 155, 344, 599, 909, 1263, 1647}; + + +const uint8_t Escalator8bit[6] = {0x0, 0x33, 0x66, 0x99, 0xCC, 0xFF}; + + +/** + * @brief TIM6 Configuration + * @note TIM6 configuration is based on CPU @168MHz and APB1 @42MHz + * @note TIM6 Update event occurs each 37.5MHz/256 = 16.406 KHz + * @param None + * @retval None + */ +void TIM6_Config(void) +{ + TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; + /* TIM6 Periph clock enable */ + RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6, ENABLE); + + /* Time base configuration */ + TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); + TIM_TimeBaseStructure.TIM_Period = 27; + TIM_TimeBaseStructure.TIM_Prescaler = 0; + TIM_TimeBaseStructure.TIM_ClockDivision = 0; + TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; + TIM_TimeBaseInit(TIM6, &TIM_TimeBaseStructure); + + /* TIM6 TRGO selection */ + TIM_SelectOutputTrigger(TIM6, TIM_TRGOSource_Update); + + /* TIM6 enable counter */ + TIM_Cmd(TIM6, ENABLE); +} + + +/** + * @brief DAC Channel2 SineWave Configuration + * @param None + * @retval None + */ +void DAC_Ch2_SineWaveConfig(void) +{ + DMA_InitTypeDef DMA_InitStructure; + + /* DAC channel2 Configuration */ + DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO; + DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None; + DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable; + DAC_Init(DAC_Channel_2, &DAC_InitStructure); + + /* DMA1_Stream5 channel7 configuration **************************************/ + DMA_DeInit(DMA1_Stream6); + DMA_InitStructure.DMA_Channel = DMA_Channel_7; + DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(uint32_t)&DAC->DHR12R2; + DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&Sine12bit; + DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; + DMA_InitStructure.DMA_BufferSize = 32; + DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; + DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; + DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; + DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; + DMA_InitStructure.DMA_Priority = DMA_Priority_High; + DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; + DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull; + DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; + DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; + DMA_Init(DMA1_Stream6, &DMA_InitStructure); + + /* Enable DMA1_Stream5 */ + DMA_Cmd(DMA1_Stream6, ENABLE); + + /* Enable DAC Channel2 */ + DAC_Cmd(DAC_Channel_2, ENABLE); + + /* Enable DMA for DAC Channel2 */ + DAC_DMACmd(DAC_Channel_2, ENABLE); +} + +void DAC_Ch1_SineWaveConfig(void) +{ + DMA_InitTypeDef DMA_InitStructure; + + /* DAC channel2 Configuration */ + DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO; + DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None; + DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable; + DAC_Init(DAC_Channel_1, &DAC_InitStructure); + + /* DMA1_Stream5 channel7 configuration **************************************/ + DMA_DeInit(DMA1_Stream5); + DMA_InitStructure.DMA_Channel = DMA_Channel_7; + DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(uint32_t)&DAC->DHR12R1; + DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&Sine12bit; + DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; + DMA_InitStructure.DMA_BufferSize = 32; + DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; + DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; + DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; + DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; + DMA_InitStructure.DMA_Priority = DMA_Priority_High; + DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; + DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull; + DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; + DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; + DMA_Init(DMA1_Stream5, &DMA_InitStructure); + + /* Enable DMA1_Stream5 */ + DMA_Cmd(DMA1_Stream5, ENABLE); + + /* Enable DAC Channel2 */ + DAC_Cmd(DAC_Channel_1, ENABLE); + + /* Enable DMA for DAC Channel2 */ + DAC_DMACmd(DAC_Channel_1, ENABLE); +} + + + + +static void Clock(uint32_t spektrum_id); + +void initUSARTs(void) +{ + GPIO_InitTypeDef GPIO_InitStructure; + USART_InitTypeDef USART_InitStructure; + + //RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); + //RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); + //RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE); + + /* Configure USART Tx as alternate function push-pull */ + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_PinAFConfig(GPIOA,GPIO_PinSource0,GPIO_AF_UART4); + GPIO_Init(GPIOA, &GPIO_InitStructure); + + + /* Configure USART Rx as input floating */ + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; + GPIO_PinAFConfig(GPIOA,GPIO_PinSource1,GPIO_AF_UART4); + GPIO_Init(GPIOA, &GPIO_InitStructure); + + + USART_InitStructure.USART_BaudRate = 57600; + USART_InitStructure.USART_WordLength = USART_WordLength_8b; + USART_InitStructure.USART_StopBits = USART_StopBits_1; + USART_InitStructure.USART_Parity = USART_Parity_No; + USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; + USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; + + USART_Init(UART4, &USART_InitStructure); + USART_DMACmd(UART4, USART_DMAReq_Rx, ENABLE); + DMA_Cmd(DMA1_Stream2, ENABLE); + USART_Cmd(UART4, ENABLE); +} + +#define DMA_Channel_USART4_RX DMA1_Stream2 +#define DMA_Channel_USART4_TX DMA1_Stream4 +#define DMA_FLAG_USART3_TC_RX DMA1_FLAG_TC3 +#define DMA_FLAG_USART3_TC_TX DMA1_FLAG_TC2 +#define USART3_DR_Base 0x40004804 + +void init_USART_dma() +{ + DMA_InitTypeDef DMA_InitStructure; + + /*RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); + + DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&(USART3->DR); + DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; + DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; + DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; + DMA_InitStructure.DMA_BufferSize = size; + DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; + DMA_InitStructure.DMA_Priority = DMA_Priority_Low; + DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; + DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)buff[0]; + DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; + + DMA_DeInit(DMA_Channel_USART3_RX); + DMA_Init(DMA_Channel_USART3_RX, &DMA_InitStructure); + //DMA_ITConfig(DMA1_Channel3, DMA_IT_TC, ENABLE); + + DMA_Cmd(DMA_Channel_USART3_RX, ENABLE); + USART_DMACmd(USART3, USART_DMAReq_Rx, ENABLE);*/ + + /*DMA Channel2 USART3 TX*/ + DMA_DeInit(DMA1_Stream4); + DMA_InitStructure.DMA_Channel = DMA_Channel_4; + DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&UART4->DR; + DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)TxBuffer3; + DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; /*read from ram*/ + DMA_InitStructure.DMA_BufferSize = TxBufferSize3; /*if content is 0,stop TX*/ + DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; + DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; + DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; + DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; + //DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; + DMA_InitStructure.DMA_Priority = DMA_Priority_Low; + //DMA_Init(DMA1_Channel2, &DMA_InitStructure); + DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; + DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; + DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; + DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; + + /*DMA Channel3 USART3 RX*/ + DMA_DeInit(DMA1_Stream2); + DMA_InitStructure.DMA_Channel = DMA_Channel_4; + DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&UART4->DR; + DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)RxBuffer3; + DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory; + DMA_InitStructure.DMA_BufferSize = sizeof(RxBuffer3); + DMA_Init(DMA1_Stream2, &DMA_InitStructure); + +} + +#if defined(PIOS_INCLUDE_USB) +#include "pios_usb_priv.h" + +static const struct pios_usb_cfg pios_usb_main_cfg = { + .irq = { + .init = { + .NVIC_IRQChannel = OTG_FS_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW, + .NVIC_IRQChannelSubPriority = 3, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + .vsense = { + .gpio = GPIOD, + .init = { + .GPIO_Pin = GPIO_Pin_11, + .GPIO_Speed = GPIO_Speed_25MHz, + .GPIO_Mode = GPIO_Mode_IN, + .GPIO_OType = GPIO_OType_OD, + }, + } +}; + +#include "pios_usb_board_data_priv.h" +#include "pios_usb_desc_hid_cdc_priv.h" +#include "pios_usb_desc_hid_only_priv.h" +#include "pios_usbhook.h" + +#endif /* PIOS_INCLUDE_USB */ + +#if defined(PIOS_INCLUDE_COM_MSG) + +#include + +#endif /* PIOS_INCLUDE_COM_MSG */ + +#if defined(PIOS_INCLUDE_USB_HID) +#include + +const struct pios_usb_hid_cfg pios_usb_hid_cfg = { + .data_if = 0, + .data_rx_ep = 1, + .data_tx_ep = 1, +}; +#endif /* PIOS_INCLUDE_USB_HID */ + +#if defined(PIOS_INCLUDE_USB_CDC) +#include + +const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = { + .ctrl_if = 1, + .ctrl_tx_ep = 2, + + .data_if = 2, + .data_rx_ep = 3, + .data_tx_ep = 3, +}; +#endif /* PIOS_INCLUDE_USB_CDC */ + +#define PIOS_COM_TELEM_RF_RX_BUF_LEN 512 +#define PIOS_COM_TELEM_RF_TX_BUF_LEN 512 + +#define PIOS_COM_GPS_RX_BUF_LEN 32 + +#define PIOS_COM_TELEM_USB_RX_BUF_LEN 65 +#define PIOS_COM_TELEM_USB_TX_BUF_LEN 65 + +#define PIOS_COM_BRIDGE_RX_BUF_LEN 65 +#define PIOS_COM_BRIDGE_TX_BUF_LEN 12 + +uint32_t pios_com_aux_id; +uint32_t pios_com_gps_id; +uint32_t pios_com_telem_usb_id; +uint32_t pios_com_telem_rf_id; + + +void PIOS_Board_Init(void) { + + // Delay system + PIOS_DELAY_Init(); + + PIOS_LED_Init(&pios_led_cfg); + + /* Initialize UAVObject libraries */ + EventDispatcherInitialize(); + UAVObjInitialize(); + + + /* Initialize the alarms library */ + AlarmsInitialize(); + + /* Initialize the task monitor library */ + TaskMonitorInitialize(); + + + +#if defined(PIOS_INCLUDE_RTC) + /* Initialize the real-time clock and its associated tick */ + PIOS_RTC_Init(&pios_rtc_main_cfg); + if (!PIOS_RTC_RegisterTickCallback(Clock, 0)) { + PIOS_DEBUG_Assert(0); + } +#endif + +#if 0 + + +#if defined(PIOS_INCLUDE_USB) + /* Initialize board specific USB data */ + PIOS_USB_BOARD_DATA_Init(); + + /* Flags to determine if various USB interfaces are advertised */ + bool usb_hid_present = false; + bool usb_cdc_present = false; + + uint8_t hwsettings_usb_devicetype; + HwSettingsUSB_DeviceTypeGet(&hwsettings_usb_devicetype); + + switch (hwsettings_usb_devicetype) { + case HWSETTINGS_USB_DEVICETYPE_HIDONLY: + if (PIOS_USB_DESC_HID_ONLY_Init()) { + PIOS_Assert(0); + } + usb_hid_present = true; + break; + case HWSETTINGS_USB_DEVICETYPE_HIDVCP: + if (PIOS_USB_DESC_HID_CDC_Init()) { + PIOS_Assert(0); + } + usb_hid_present = true; + usb_cdc_present = true; + break; + case HWSETTINGS_USB_DEVICETYPE_VCPONLY: + break; + default: + PIOS_Assert(0); + } + + uint32_t pios_usb_id; + PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg); + +#if defined(PIOS_INCLUDE_USB_CDC) + + uint8_t hwsettings_usb_vcpport; + /* Configure the USB VCP port */ + HwSettingsUSB_VCPPortGet(&hwsettings_usb_vcpport); + + if (!usb_cdc_present) { + /* Force VCP port function to disabled if we haven't advertised VCP in our USB descriptor */ + hwsettings_usb_vcpport = HWSETTINGS_USB_VCPPORT_DISABLED; + } + + switch (hwsettings_usb_vcpport) { + case HWSETTINGS_USB_VCPPORT_DISABLED: + break; + case HWSETTINGS_USB_VCPPORT_USBTELEMETRY: +#if defined(PIOS_INCLUDE_COM) + { + uint32_t pios_usb_cdc_id; + if (PIOS_USB_CDC_Init(&pios_usb_cdc_id, &pios_usb_cdc_cfg, pios_usb_id)) { + PIOS_Assert(0); + } + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_USB_RX_BUF_LEN); + uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_USB_TX_BUF_LEN); + PIOS_Assert(rx_buffer); + PIOS_Assert(tx_buffer); + if (PIOS_COM_Init(&pios_com_telem_usb_id, &pios_usb_cdc_com_driver, pios_usb_cdc_id, + rx_buffer, PIOS_COM_TELEM_USB_RX_BUF_LEN, + tx_buffer, PIOS_COM_TELEM_USB_TX_BUF_LEN)) { + PIOS_Assert(0); + } + } +#endif /* PIOS_INCLUDE_COM */ + break; + case HWSETTINGS_USB_VCPPORT_COMBRIDGE: +#if defined(PIOS_INCLUDE_COM) + { + uint32_t pios_usb_cdc_id; + if (PIOS_USB_CDC_Init(&pios_usb_cdc_id, &pios_usb_cdc_cfg, pios_usb_id)) { + PIOS_Assert(0); + } + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_BRIDGE_RX_BUF_LEN); + uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_BRIDGE_TX_BUF_LEN); + PIOS_Assert(rx_buffer); + PIOS_Assert(tx_buffer); + if (PIOS_COM_Init(&pios_com_vcp_id, &pios_usb_cdc_com_driver, pios_usb_cdc_id, + rx_buffer, PIOS_COM_BRIDGE_RX_BUF_LEN, + tx_buffer, PIOS_COM_BRIDGE_TX_BUF_LEN)) { + PIOS_Assert(0); + } + } +#endif /* PIOS_INCLUDE_COM */ + break; + } +#endif /* PIOS_INCLUDE_USB_CDC */ + +#if defined(PIOS_INCLUDE_USB_HID) + /* Configure the usb HID port */ + uint8_t hwsettings_usb_hidport; + HwSettingsUSB_HIDPortGet(&hwsettings_usb_hidport); + + if (!usb_hid_present) { + /* Force HID port function to disabled if we haven't advertised HID in our USB descriptor */ + hwsettings_usb_hidport = HWSETTINGS_USB_HIDPORT_DISABLED; + } + + switch (hwsettings_usb_hidport) { + case HWSETTINGS_USB_HIDPORT_DISABLED: + break; + case HWSETTINGS_USB_HIDPORT_USBTELEMETRY: +#if defined(PIOS_INCLUDE_COM) + { + uint32_t pios_usb_hid_id; + if (PIOS_USB_HID_Init(&pios_usb_hid_id, &pios_usb_hid_cfg, pios_usb_id)) { + PIOS_Assert(0); + } + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_USB_RX_BUF_LEN); + uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_USB_TX_BUF_LEN); + PIOS_Assert(rx_buffer); + PIOS_Assert(tx_buffer); + if (PIOS_COM_Init(&pios_com_telem_usb_id, &pios_usb_hid_com_driver, pios_usb_hid_id, + rx_buffer, PIOS_COM_TELEM_USB_RX_BUF_LEN, + tx_buffer, PIOS_COM_TELEM_USB_TX_BUF_LEN)) { + PIOS_Assert(0); + } + } +#endif /* PIOS_INCLUDE_COM */ + break; + } + +#endif /* PIOS_INCLUDE_USB_HID */ + + if (usb_hid_present || usb_cdc_present) { + PIOS_USBHOOK_Activate(); + } +#endif /* PIOS_INCLUDE_USB */ +#endif + +#if defined(PIOS_INCLUDE_COM) +#if defined(PIOS_INCLUDE_GPS) + + uint32_t pios_usart_gps_id; + if (PIOS_USART_Init(&pios_usart_gps_id, &pios_usart_gps_cfg)) { + PIOS_Assert(0); + } + + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_GPS_RX_BUF_LEN); + PIOS_Assert(rx_buffer); + if (PIOS_COM_Init(&pios_com_gps_id, &pios_usart_com_driver, pios_usart_gps_id, + rx_buffer, PIOS_COM_GPS_RX_BUF_LEN, + NULL, 0)) { + PIOS_Assert(0); + } + +#endif /* PIOS_INCLUDE_GPS */ + +#if defined(PIOS_INCLUDE_COM_AUX) + { + uint32_t pios_usart_aux_id; + + if (PIOS_USART_Init(&pios_usart_aux_id, &pios_usart_aux_cfg)) { + PIOS_DEBUG_Assert(0); + } + + const uint32_t BUF_SIZE = 512; + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(BUF_SIZE); + uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(BUF_SIZE); + PIOS_Assert(rx_buffer); + PIOS_Assert(tx_buffer); + + if (PIOS_COM_Init(&pios_com_aux_id, &pios_usart_com_driver, pios_usart_aux_id, + rx_buffer, BUF_SIZE, + tx_buffer, BUF_SIZE)) { + PIOS_DEBUG_Assert(0); + } + } +#else + pios_com_aux_id = 0; +#endif /* PIOS_INCLUDE_COM_AUX */ + +#if defined(PIOS_INCLUDE_COM_TELEM) + { /* Eventually add switch for this port function */ + uint32_t pios_usart_telem_rf_id; + if (PIOS_USART_Init(&pios_usart_telem_rf_id, &pios_usart_gps_cfg)) { + PIOS_Assert(0); + } + + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_RX_BUF_LEN); + uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_TX_BUF_LEN); + PIOS_Assert(rx_buffer); + PIOS_Assert(tx_buffer); + if (PIOS_COM_Init(&pios_com_telem_rf_id, &pios_usart_com_driver, pios_usart_telem_rf_id, + rx_buffer, PIOS_COM_TELEM_RF_RX_BUF_LEN, + tx_buffer, PIOS_COM_TELEM_RF_TX_BUF_LEN)) { + PIOS_Assert(0); + } + } +#else + pios_com_telem_rf_id = 0; +#endif /* PIOS_INCLUDE_COM_TELEM */ +#endif /* PIOS_INCLUDE_COM */ + +/* + uint32_t pios_usart_hkosd_id; + if (PIOS_USART_Init(&pios_usart_hkosd_id, &pios_usart_serial_cfg)) { + PIOS_Assert(0); + } + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_HKOSD_RX_BUF_LEN); + PIOS_Assert(rx_buffer); + + uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_HKOSD_TX_BUF_LEN); + PIOS_Assert(tx_buffer); + if (PIOS_COM_Init(&pios_com_hkosd_id, &pios_usart_com_driver, pios_usart_hkosd_id, + rx_buffer, PIOS_COM_HKOSD_RX_BUF_LEN, + tx_buffer, PIOS_COM_HKOSD_TX_BUF_LEN)) { + PIOS_Assert(0); + }*/ + +/* + uint32_t pios_usart_serial_id; + if (PIOS_USART_Init(&pios_usart_serial_id, &pios_usart_serial_cfg)) { + PIOS_DEBUG_Assert(0); + } + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_RX_BUF_LEN); + uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_TX_BUF_LEN); + PIOS_Assert(rx_buffer); + PIOS_Assert(tx_buffer); + + if (PIOS_COM_Init(&pios_com_serial_id, &pios_usart_com_driver, pios_usart_serial_id, + rx_buffer, PIOS_COM_TELEM_RF_RX_BUF_LEN, + tx_buffer, PIOS_COM_TELEM_RF_TX_BUF_LEN)) { + PIOS_Assert(0); + }*/ + +#if 1 +/* Preconfiguration before using DAC----------------------------------------*/ +GPIO_InitTypeDef GPIO_InitStructure; + +/* DAC Periph clock enable */ + RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE); + + /* DAC channel 1 & 2 (DAC_OUT1 = PA.4)(DAC_OUT2 = PA.5) configuration */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_Init(GPIOA, &GPIO_InitStructure); + + /* TIM6 Configuration ------------------------------------------------------*/ + TIM6_Config(); + + DAC_DeInit(); + DAC_Ch1_SineWaveConfig(); + //DAC_Ch2_SineWaveConfig(); +#endif + // ADC system + PIOS_ADC_Init(); + + // SPI link to master + /*if (PIOS_SPI_Init(&pios_spi_port_id, &pios_spi_port_cfg)) { + PIOS_DEBUG_Assert(0); + }*/ + + init_USART_dma(); + initUSARTs(); + extern t_fifo_buffer rx; + fifoBuf_init(&rx,RxBuffer3,sizeof(RxBuffer3)); + + PIOS_Video_Init(&pios_video_cfg); + + //uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_HKOSD_RX_BUF_LEN); + + //uint8_t test[16]; + + +} + +uint16_t supv_timer=0; + +static void Clock(uint32_t spektrum_id) { + /* 125hz */ + ++supv_timer; + if(supv_timer >= 625) { + supv_timer = 0; + time.sec++; + } + if (time.sec >= 60) { + time.sec = 0; + time.min++; + } + if (time.min >= 60) { + time.min = 0; + time.hour++; + } + if (time.hour >= 99) { + time.hour = 0; + } +} diff --git a/flight/OSD/System/pios_usb_board_data.c b/flight/OSD/System/pios_usb_board_data.c new file mode 100644 index 000000000..823496c29 --- /dev/null +++ b/flight/OSD/System/pios_usb_board_data.c @@ -0,0 +1,120 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_USB_BOARD Board specific USB definitions + * @brief Board specific USB definitions + * @{ + * + * @file pios_usb_board_data.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Board specific USB definitions + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "pios_usb_board_data.h" /* struct usb_*, USB_* */ +#include "pios_sys.h" /* PIOS_SYS_SerialNumberGet */ +#include "pios_usbhook.h" /* PIOS_USBHOOK_* */ + +static const uint8_t usb_product_id[22] = { + sizeof(usb_product_id), + USB_DESC_TYPE_STRING, + 'R', 0, + 'e', 0, + 'v', 0, + 'o', 0, + 'l', 0, + 'u', 0, + 't', 0, + 'i', 0, + 'o', 0, + 'n', 0, +}; + +static uint8_t usb_serial_number[52] = { + sizeof(usb_serial_number), + USB_DESC_TYPE_STRING, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0 +}; + +static const struct usb_string_langid usb_lang_id = { + .bLength = sizeof(usb_lang_id), + .bDescriptorType = USB_DESC_TYPE_STRING, + .bLangID = htousbs(USB_LANGID_ENGLISH_UK), +}; + +static const uint8_t usb_vendor_id[28] = { + sizeof(usb_vendor_id), + USB_DESC_TYPE_STRING, + 'o', 0, + 'p', 0, + 'e', 0, + 'n', 0, + 'p', 0, + 'i', 0, + 'l', 0, + 'o', 0, + 't', 0, + '.', 0, + 'o', 0, + 'r', 0, + 'g', 0 +}; + +int32_t PIOS_USB_BOARD_DATA_Init(void) +{ + /* Load device serial number into serial number string */ + uint8_t sn[25]; + PIOS_SYS_SerialNumberGet((char *)sn); + for (uint8_t i = 0; sn[i] != '\0' && (2 * i) < usb_serial_number[0]; i++) { + usb_serial_number[2 + 2 * i] = sn[i]; + } + + PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id)); + PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number)); + + PIOS_USBHOOK_RegisterString(USB_STRING_DESC_LANG, (uint8_t *)&usb_lang_id, sizeof(usb_lang_id)); + PIOS_USBHOOK_RegisterString(USB_STRING_DESC_VENDOR, (uint8_t *)&usb_vendor_id, sizeof(usb_vendor_id)); + + return 0; +} diff --git a/flight/OSD/System/pios_usb_hid_desc.c b/flight/OSD/System/pios_usb_hid_desc.c new file mode 100644 index 000000000..157e85831 --- /dev/null +++ b/flight/OSD/System/pios_usb_hid_desc.c @@ -0,0 +1,220 @@ +/******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** +* File Name : usb_desc.c +* Author : MCD Application Team +* Version : V3.2.1 +* Date : 07/05/2010 +* Description : Descriptors for Custom HID Demo +******************************************************************************** +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +#include "usb_lib.h" +#include "pios_usb.h" +#include "pios_usb_hid.h" +#include "pios_usb_hid_desc.h" + +// ************************************************* +// USB Standard Device Descriptor + +const uint8_t PIOS_HID_DeviceDescriptor[PIOS_HID_SIZ_DEVICE_DESC] = + { + 0x12, // bLength + USB_DEVICE_DESCRIPTOR_TYPE, // bDescriptorType + 0x00, // bcdUSB + 0x02, + 0x00, // bDeviceClass + 0x00, // bDeviceSubClass + 0x00, // bDeviceProtocol + 0x40, // bMaxPacketSize40 + (uint8_t)((PIOS_USB_VENDOR_ID) & 0xff), // idVendor + (uint8_t)((PIOS_USB_VENDOR_ID) >> 8), + (uint8_t)((PIOS_USB_PRODUCT_ID) & 0xff), // idProduct + (uint8_t)((PIOS_USB_PRODUCT_ID) >> 8), + (uint8_t)((PIOS_USB_VERSION_ID) & 0xff), // bcdDevice + (uint8_t)((PIOS_USB_VERSION_ID) >> 8), + 0x01, // Index of string descriptor describing manufacturer + 0x02, // Index of string descriptor describing product + 0x03, // Index of string descriptor describing the device serial number + 0x01 // bNumConfigurations + }; + +// ************************************************* +// USB Configuration Descriptor +// All Descriptors (Configuration, Interface, Endpoint, Class, Vendor + +const uint8_t PIOS_HID_ConfigDescriptor[PIOS_HID_SIZ_CONFIG_DESC] = + { + 0x09, // bLength: Configuation Descriptor size + USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType: Configuration + PIOS_HID_SIZ_CONFIG_DESC, + // wTotalLength: Bytes returned + 0x00, + 0x01, // bNumInterfaces: 1 interface + 0x01, // bConfigurationValue: Configuration value + 0x00, // iConfiguration: Index of string descriptor describing the configuration + 0xC0, // bmAttributes: Bus powered + 0x7D, // MaxPower 250 mA - needed to power the RF transmitter + + // ************** Descriptor of Custom HID interface **************** + // 09 + 0x09, // bLength: Interface Descriptor size + USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: Interface descriptor type + 0x00, // bInterfaceNumber: Number of Interface + 0x00, // bAlternateSetting: Alternate setting + 0x02, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x00, // bInterfaceSubClass : 1=BOOT, 0=no boot + 0x00, // nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse + 0, // iInterface: Index of string descriptor + + // ******************** Descriptor of Custom HID HID ******************** + // 18 + 0x09, // bLength: HID Descriptor size + HID_DESCRIPTOR_TYPE, // bDescriptorType: HID + 0x10, // bcdHID: HID Class Spec release number + 0x01, + 0x00, // bCountryCode: Hardware target country + 0x01, // bNumDescriptors: Number of HID class descriptors to follow + 0x22, // bDescriptorType + PIOS_HID_SIZ_REPORT_DESC, // wItemLength: Total length of Report descriptor + 0x00, + + // ******************** Descriptor of Custom HID endpoints ****************** + // 27 + 0x07, // bLength: Endpoint Descriptor size + USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: + + 0x81, // bEndpointAddress: Endpoint Address (IN) + 0x03, // bmAttributes: Interrupt endpoint + 0x40, // wMaxPacketSize: 2 Bytes max + 0x00, + 0x04, // bInterval: Polling Interval in ms + // 34 + + 0x07, // bLength: Endpoint Descriptor size + USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: + // Endpoint descriptor type + 0x01, // bEndpointAddress: + // Endpoint Address (OUT) + 0x03, // bmAttributes: Interrupt endpoint + 0x40, // wMaxPacketSize: 2 Bytes max + 0x00, + 0x04, // bInterval: Polling Interval in ms + // 41 + }; + +// ************************************************* + + const uint8_t PIOS_HID_ReportDescriptor[PIOS_HID_SIZ_REPORT_DESC] = + { + 0x06, 0x9c, 0xff, // USAGE_PAGE (Vendor Page: 0xFF00) + 0x09, 0x01, // USAGE (Demo Kit) + 0xa1, 0x01, // COLLECTION (Application) + // 6 + + // Data 1 + 0x85, 0x01, // REPORT_ID (1) + 0x09, 0x02, // USAGE (LED 1) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0xff, // LOGICAL_MAXIMUM (255) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, PIOS_USB_HID_DATA_LENGTH+1, // REPORT_COUNT (1) + 0x81, 0x83, // INPUT (Const,Var,Array) + // 20 + + // Data 1 + 0x85, 0x02, // REPORT_ID (2) + 0x09, 0x03, // USAGE (LED 1) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0xff, // LOGICAL_MAXIMUM (255) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, PIOS_USB_HID_DATA_LENGTH+1, // REPORT_COUNT (1) + 0x91, 0x82, // OUTPUT (Data,Var,Abs,Vol) + // 34 + + 0xc0 // END_COLLECTION + }; + +// ************************************************* +// USB String Descriptors (optional) + +const uint8_t PIOS_HID_StringLangID[PIOS_HID_SIZ_STRING_LANGID] = + { + PIOS_HID_SIZ_STRING_LANGID, + USB_STRING_DESCRIPTOR_TYPE, + 0x09, 0x08 // LangID = 0x0809: UK. English +// 0x09, 0x04 // LangID = 0x0409: U.S. English + }; + +const uint8_t PIOS_HID_StringVendor[PIOS_HID_SIZ_STRING_VENDOR] = + { + PIOS_HID_SIZ_STRING_VENDOR, // Size of Vendor string + USB_STRING_DESCRIPTOR_TYPE, // bDescriptorType + // Manufacturer: "STMicroelectronics" + 'o', 0, + 'p', 0, + 'e', 0, + 'n', 0, + 'p', 0, + 'i', 0, + 'l', 0, + 'o', 0, + 't', 0, + '.', 0, + 'o', 0, + 'r', 0, + 'g', 0 + }; + +const uint8_t PIOS_HID_StringProduct[PIOS_HID_SIZ_STRING_PRODUCT] = + { + PIOS_HID_SIZ_STRING_PRODUCT, // bLength + USB_STRING_DESCRIPTOR_TYPE, // bDescriptorType + 'P', 0, + 'i', 0, + 'p', 0, + 'X', 0, + 't', 0, + 'r', 0, + 'e', 0, + 'm', 0, + 'e', 0 + }; + +uint8_t PIOS_HID_StringSerial[PIOS_HID_SIZ_STRING_SERIAL] = + { + PIOS_HID_SIZ_STRING_SERIAL, // bLength + USB_STRING_DESCRIPTOR_TYPE, // bDescriptorType + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0 + }; + +// ************************************************* diff --git a/flight/OSD/System/taskmonitor.c b/flight/OSD/System/taskmonitor.c new file mode 100644 index 000000000..e452eeda3 --- /dev/null +++ b/flight/OSD/System/taskmonitor.c @@ -0,0 +1,150 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotLibraries OpenPilot System Libraries + * @{ + * @file taskmonitor.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Task monitoring library + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "openpilot.h" +//#include "taskmonitor.h" + +// Private constants + +// Private types + +// Private variables +static xSemaphoreHandle lock; +static xTaskHandle handles[TASKINFO_RUNNING_NUMELEM]; +static uint32_t lastMonitorTime; + +// Private functions + +/** + * Initialize library + */ +int32_t TaskMonitorInitialize(void) +{ + lock = xSemaphoreCreateRecursiveMutex(); + memset(handles, 0, sizeof(xTaskHandle)*TASKINFO_RUNNING_NUMELEM); + lastMonitorTime = 0; +#if defined(DIAGNOSTICS) + lastMonitorTime = portGET_RUN_TIME_COUNTER_VALUE(); +#endif + return 0; +} + +/** + * Register a task handle with the library + */ +int32_t TaskMonitorAdd(TaskInfoRunningElem task, xTaskHandle handle) +{ + if (task < TASKINFO_RUNNING_NUMELEM) + { + xSemaphoreTakeRecursive(lock, portMAX_DELAY); + handles[task] = handle; + xSemaphoreGiveRecursive(lock); + return 0; + } + else + { + return -1; + } +} + +/** + * Remove a task handle from the library + */ +int32_t TaskMonitorRemove(TaskInfoRunningElem task) +{ + if (task < TASKINFO_RUNNING_NUMELEM) + { + xSemaphoreTakeRecursive(lock, portMAX_DELAY); + handles[task] = 0; + xSemaphoreGiveRecursive(lock); + return 0; + } + else + { + return -1; + } +} + +/** + * Update the status of all tasks + */ +void TaskMonitorUpdateAll(void) +{ +#if defined(DIAGNOSTICS) + TaskInfoData data; + int n; + + // Lock + xSemaphoreTakeRecursive(lock, portMAX_DELAY); + +#if ( configGENERATE_RUN_TIME_STATS == 1 ) + uint32_t currentTime; + uint32_t deltaTime; + + /* + * Calculate the amount of elapsed run time between the last time we + * measured and now. Scale so that we can convert task run times + * directly to percentages. + */ + currentTime = portGET_RUN_TIME_COUNTER_VALUE(); + deltaTime = ((currentTime - lastMonitorTime) / 100) ? : 1; /* avoid divide-by-zero if the interval is too small */ + lastMonitorTime = currentTime; +#endif + + // Update all task information + for (n = 0; n < TASKINFO_RUNNING_NUMELEM; ++n) + { + if (handles[n] != 0) + { + data.Running[n] = TASKINFO_RUNNING_TRUE; +#if defined(ARCH_POSIX) || defined(ARCH_WIN32) + data.StackRemaining[n] = 10000; +#else + data.StackRemaining[n] = uxTaskGetStackHighWaterMark(handles[n]) * 4; +#if ( configGENERATE_RUN_TIME_STATS == 1 ) + /* Generate run time stats */ + data.RunningTime[n] = uxTaskGetRunTime(handles[n]) / deltaTime; + +#endif +#endif + + } + else + { + data.Running[n] = TASKINFO_RUNNING_FALSE; + data.StackRemaining[n] = 0; + data.RunningTime[n] = 0; + } + } + + // Update object + TaskInfoSet(&data); + + // Done + xSemaphoreGiveRecursive(lock); +#endif +} diff --git a/flight/OSD/System/watchdog.c b/flight/OSD/System/watchdog.c new file mode 100644 index 000000000..044e3d3f3 --- /dev/null +++ b/flight/OSD/System/watchdog.c @@ -0,0 +1,71 @@ +/** + ****************************************************************************** + * + * @file watchdog.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Modem packet handling routines + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "pios.h" +#include "stm32f10x_iwdg.h" +#include "stm32f10x_dbgmcu.h" + +/** + * @brief Initialize the watchdog timer for a specified timeout + * + * It is important to note that this function returns the achieved timeout + * for this hardware. For hardware indendence this should be checked when + * scheduling updates. Other hardware dependent details may need to be + * considered such as a window time which sets a minimum update time, + * and this function should return a recommended delay for clearing. + * + * For the STM32 nominal clock rate is 32 khz, but for the maximum clock rate of + * 60 khz and a prescalar of 4 yields a clock rate of 15 khz. The delay that is + * set in the watchdog assumes the nominal clock rate, but the delay for FreeRTOS + * to use is 75% of the minimal delay. + * + * @param[in] delayMs The delay period in ms + * @returns Maximum recommended delay between updates + */ +uint16_t watchdog_Init(uint16_t delayMs) +{ + uint16_t delay = ((uint32_t)delayMs * 60) / 16; + if (delay > 0x0fff) + delay = 0x0fff; + + DBGMCU_Config(DBGMCU_IWDG_STOP, ENABLE); // make the watchdog stop counting in debug mode + IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); + IWDG_SetPrescaler(IWDG_Prescaler_16); + IWDG_SetReload(delay); + IWDG_ReloadCounter(); + IWDG_Enable(); + + return ((((uint32_t)delay * 16) / 60) * .75f); +} + +/** + * @brief Clear the watchdog timer + * + * This function must be called at the appropriate delay to prevent a reset event occuring + */ +void watchdog_Clear(void) +{ + IWDG_ReloadCounter(); +} diff --git a/flight/PiOS/Boards/STM32F4xx_OSD.h b/flight/PiOS/Boards/STM32F4xx_OSD.h new file mode 100644 index 000000000..d7de4e235 --- /dev/null +++ b/flight/PiOS/Boards/STM32F4xx_OSD.h @@ -0,0 +1,467 @@ + /** + ****************************************************************************** + * + * @file pios_board.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Defines board hardware for the OpenPilot Version 1.1 hardware. + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_BOARD_H +#define PIOS_BOARD_H + +// ***************************************************************** +// Timers and Channels Used + +/* +Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4 +------+------------+------------+------------+------------ +TIM1 | DELAY | +TIM2 | | PPM Output | PPM Input | +TIM3 | TIMER INTERRUPT | +TIM4 | STOPWATCH | +------+------------+------------+------------+------------ +*/ + +//------------------------ +// DMA Channels Used +//------------------------ +/* Channel 1 - */ +/* Channel 2 - */ +/* Channel 3 - */ +/* Channel 4 - */ +/* Channel 5 - */ +/* Channel 6 - */ +/* Channel 7 - */ +/* Channel 8 - */ +/* Channel 9 - */ +/* Channel 10 - */ +/* Channel 11 - */ +/* Channel 12 - */ + +//------------------------- +// System Settings +// +// See also System_stm32f4xx.c +//------------------------- +//These macros are deprecated +//please use PIOS_PERIPHERAL_APBx_CLOCK According to the table below +//#define PIOS_MASTER_CLOCK +//#define PIOS_PERIPHERAL_CLOCK +//#define PIOS_PERIPHERAL_CLOCK + +#define PIOS_SYSCLK 108000000 +// Peripherals that belongs to APB1 are: +// DAC |PWR |CAN1,2 +// I2C1,2,3 |UART4,5 |USART3,2 +// I2S3Ext |SPI3/I2S3 |SPI2/I2S2 +// I2S2Ext |IWDG |WWDG +// RTC/BKP reg +// TIM2,3,4,5,6,7,12,13,14 + +// Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2) +// Default APB1 Prescaler = 4 +#define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 2) + +// Peripherals belonging to APB2 +// SDIO |EXTI |SYSCFG |SPI1 +// ADC1,2,3 +// USART1,6 +// TIM1,8,9,10,11 +// +// Default APB2 Prescaler = 2 +// +#define PIOS_PERIPHERAL_APB2_CLOCK PIOS_SYSCLK + + +//------------------------ +// BOOTLOADER_SETTINGS +//------------------------ +#define BOARD_READABLE TRUE +#define BOARD_WRITABLE TRUE +#define MAX_DEL_RETRYS 3 + +//------------------------ +// TELEMETRY +//------------------------ +#define TELEM_QUEUE_SIZE 20 +#define PIOS_TELEM_STACK_SIZE 624 + +// ***************************************************************** +// System Settings + +#define PIOS_MASTER_CLOCK 108000000ul +#define PIOS_PERIPHERAL_CLOCK (PIOS_MASTER_CLOCK / 2) + +// ***************************************************************** +// Interrupt Priorities + +#define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS +#define PIOS_IRQ_PRIO_MID 8 // higher than RTOS +#define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc... +#define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc... + + +//------------------------ +// WATCHDOG_SETTINGS +//------------------------ +#define PIOS_WATCHDOG_TIMEOUT 250 +#define PIOS_WDG_REGISTER RTC_BKP_DR4 +#define PIOS_WDG_ACTUATOR 0x0001 +#define PIOS_WDG_STABILIZATION 0x0002 +#define PIOS_WDG_ATTITUDE 0x0004 +#define PIOS_WDG_MANUAL 0x0008 + + +// ***************************************************************** +// PIOS_LED +#define PIOS_LED_HEARTBEAT 0 +#define PIOS_LED_ALARM 1 + +#define PIOS_LED_LED1_GPIO_PORT GPIOD +#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_13 //LD3 +#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOD +#define PIOS_LED_LED2_GPIO_PORT GPIOD +#define PIOS_LED_LED2_GPIO_PIN GPIO_Pin_12 //LD4 +#define PIOS_LED_LED2_GPIO_CLK RCC_APB2Periph_GPIOD +#define PIOS_LED_LED3_GPIO_PORT GPIOD +#define PIOS_LED_LED3_GPIO_PIN GPIO_Pin_14 //LD5 +#define PIOS_LED_LED3_GPIO_CLK RCC_APB2Periph_GPIOD +#define PIOS_LED_LED4_GPIO_PORT GPIOD +#define PIOS_LED_LED4_GPIO_PIN GPIO_Pin_15 //LD6 +#define PIOS_LED_LED4_GPIO_CLK RCC_APB2Periph_GPIOD +#define PIOS_LED_NUM 4 +#define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT, PIOS_LED_LED2_GPIO_PORT, PIOS_LED_LED3_GPIO_PORT, PIOS_LED_LED4_GPIO_PORT } +#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN, PIOS_LED_LED3_GPIO_PIN, PIOS_LED_LED4_GPIO_PIN } +#define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK, PIOS_LED_LED3_GPIO_CLK, PIOS_LED_LED4_GPIO_CLK } + + +/*#define USB_LED_ON PIOS_LED_On(LED1) +#define USB_LED_OFF PIOS_LED_Off(LED1) +#define USB_LED_TOGGLE PIOS_LED_Toggle(LED1) +*/ + +// ***************************************************************** +// Delay Timer + +//#define PIOS_DELAY_TIMER TIM2 +//#define PIOS_DELAY_TIMER_RCC_FUNC RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE) +#define PIOS_DELAY_TIMER TIM1 +#define PIOS_DELAY_TIMER_RCC_FUNC RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE) + +// ***************************************************************** +// Timer interrupt + +/*#define TIMER_INT_TIMER TIM3 +#define TIMER_INT_FUNC TIM3_IRQHandler +#define TIMER_INT_PRIORITY 2 + +// ***************************************************************** +// Stop watch timer + +#define STOPWATCH_TIMER TIM4*/ + +//------------------------ +// PIOS_SPI +// See also pios_board.c +//------------------------ +#define PIOS_SPI_MAX_DEVS 1 +extern uint32_t pios_spi_port_id; +#define PIOS_SPI_PORT (pios_spi_port_id) + +//------------------------- +// PIOS_USART +// +// See also pios_board.c +//------------------------- +#define PIOS_USART_MAX_DEVS 5 + +//------------------------- +// PIOS_COM +// +// See also pios_board.c +//------------------------- +#define PIOS_COM_MAX_DEVS 4 +extern uint32_t pios_com_telem_rf_id; +extern uint32_t pios_com_gps_id; +extern uint32_t pios_com_aux_id; +extern uint32_t pios_com_telem_usb_id; +#define PIOS_COM_AUX (pios_com_aux_id) +#define PIOS_COM_GPS (pios_com_gps_id) +#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id) +#define PIOS_COM_TELEM_RF (pios_com_telem_rf_id) +#define PIOS_COM_DEBUG PIOS_COM_AUX + + +extern uint32_t pios_com_hkosd_id; +#define PIOS_COM_OSD (pios_com_hkosd_id) + +//extern uint32_t pios_com_serial_id; +//#define PIOS_COM_SERIAL (pios_com_serial_id) +//#define PIOS_COM_DEBUG PIOS_COM_SERIAL // uncomment this to send debug info out the serial port + +//extern uint32_t pios_com_gps_id; +//#define PIOS_COM_GPS (pios_com_gps_id) + + +#if defined(PIOS_INCLUDE_USB_HID) +extern uint32_t pios_com_telem_usb_id; +#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id) +#endif + +#if defined(PIOS_COM_DEBUG) +// #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedString(PIOS_COM_DEBUG, __VA_ARGS__) + #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__) +#else + #define DEBUG_PRINTF(...) +#endif + +// ***************************************************************** +// ADC + +//------------------------- +// ADC +// PIOS_ADC_PinGet(0) = External voltage +// PIOS_ADC_PinGet(1) = AUX1 (PX2IO external pressure port) +// PIOS_ADC_PinGet(2) = AUX2 (Current sensor, if available) +// PIOS_ADC_PinGet(3) = AUX3 +// PIOS_ADC_PinGet(4) = VREF +// PIOS_ADC_PinGet(5) = Temperature sensor +//------------------------- + +#define PIOS_DMA_PIN_CONFIG \ +{ \ +{GPIOC, GPIO_Pin_0, ADC_Channel_10}, \ +{GPIOC, GPIO_Pin_1, ADC_Channel_11}, \ +{GPIOC, GPIO_Pin_2, ADC_Channel_12}, \ +{GPIOC, GPIO_Pin_3, ADC_Channel_13}, \ +{NULL, 0, ADC_Channel_Vrefint}, /* Voltage reference */\ +{NULL, 0, ADC_Channel_TempSensor} /* Temperature sensor */\ +} + +/* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */ +/* which is annoying because this then determines the rate at which we generate buffer turnover events */ +/* the objective here is to get enough buffer space to support 100Hz averaging rate */ +#define PIOS_ADC_NUM_CHANNELS 6 +#define PIOS_ADC_MAX_OVERSAMPLING 10 +#define PIOS_ADC_USE_ADC2 0 + +// ***************************************************************** +// GPIO output pins + +// GPIO_Mode_Out_OD Open Drain Output +// GPIO_Mode_Out_PP Push-Pull Output +// GPIO_Mode_AF_OD Open Drain Output Alternate-Function +// GPIO_Mode_AF_PP Push-Pull Output Alternate-Function + +// Serial port RTS line +#define PIOS_GPIO_OUT_0_PORT GPIOB +#define PIOS_GPIO_OUT_0_PIN GPIO_Pin_15 +#define PIOS_GPIO_OUT_0_GPIO_CLK RCC_APB2Periph_GPIOB + +// RF module chip-select line +#define PIOS_GPIO_OUT_1_PORT GPIOA +#define PIOS_GPIO_OUT_1_PIN GPIO_Pin_4 +#define PIOS_GPIO_OUT_1_GPIO_CLK RCC_APB2Periph_GPIOA + +// PPM OUT line +#define PIOS_GPIO_OUT_2_PORT GPIOB +#define PIOS_GPIO_OUT_2_PIN GPIO_Pin_10 +#define PIOS_GPIO_OUT_2_GPIO_CLK RCC_APB2Periph_GPIOB + +// spare pin +#define PIOS_GPIO_OUT_3_PORT GPIOA +#define PIOS_GPIO_OUT_3_PIN GPIO_Pin_0 +#define PIOS_GPIO_OUT_3_GPIO_CLK RCC_APB2Periph_GPIOA + +// spare pin +#define PIOS_GPIO_OUT_4_PORT GPIOA +#define PIOS_GPIO_OUT_4_PIN GPIO_Pin_1 +#define PIOS_GPIO_OUT_4_GPIO_CLK RCC_APB2Periph_GPIOA + +// spare pin +#define PIOS_GPIO_OUT_5_PORT GPIOC +#define PIOS_GPIO_OUT_5_PIN GPIO_Pin_13 +#define PIOS_GPIO_OUT_5_GPIO_CLK RCC_APB2Periph_GPIOC + +// spare pin +#define PIOS_GPIO_OUT_6_PORT GPIOC +#define PIOS_GPIO_OUT_6_PIN GPIO_Pin_14 +#define PIOS_GPIO_OUT_6_GPIO_CLK RCC_APB2Periph_GPIOC + +// spare pin +#define PIOS_GPIO_OUT_7_PORT GPIOC +#define PIOS_GPIO_OUT_7_PIN GPIO_Pin_15 +#define PIOS_GPIO_OUT_7_GPIO_CLK RCC_APB2Periph_GPIOC + +#define PIOS_GPIO_NUM 8 +#define PIOS_GPIO_PORTS {PIOS_GPIO_OUT_0_PORT, PIOS_GPIO_OUT_1_PORT, PIOS_GPIO_OUT_2_PORT, PIOS_GPIO_OUT_3_PORT, PIOS_GPIO_OUT_4_PORT, PIOS_GPIO_OUT_5_PORT, PIOS_GPIO_OUT_6_PORT, PIOS_GPIO_OUT_7_PORT} +#define PIOS_GPIO_PINS {PIOS_GPIO_OUT_0_PIN, PIOS_GPIO_OUT_1_PIN, PIOS_GPIO_OUT_2_PIN, PIOS_GPIO_OUT_3_PIN, PIOS_GPIO_OUT_4_PIN, PIOS_GPIO_OUT_5_PIN, PIOS_GPIO_OUT_6_PIN, PIOS_GPIO_OUT_7_PIN} +#define PIOS_GPIO_CLKS {PIOS_GPIO_OUT_0_GPIO_CLK, PIOS_GPIO_OUT_1_GPIO_CLK, PIOS_GPIO_OUT_2_GPIO_CLK, PIOS_GPIO_OUT_3_GPIO_CLK, PIOS_GPIO_OUT_4_GPIO_CLK, PIOS_GPIO_OUT_5_GPIO_CLK, PIOS_GPIO_OUT_6_GPIO_CLK, PIOS_GPIO_OUT_7_GPIO_CLK} + +#define SERIAL_RTS_ENABLE PIOS_GPIO_Enable(0) +#define SERIAL_RTS_SET PIOS_GPIO_Off(0) +#define SERIAL_RTS_CLEAR PIOS_GPIO_On(0) + +#define RF_CS_ENABLE PIOS_GPIO_Enable(1) +#define RF_CS_HIGH PIOS_GPIO_Off(1) +#define RF_CS_LOW PIOS_GPIO_On(1) + +#define PPM_OUT_PIN PIOS_GPIO_OUT_2_PIN +#define PPM_OUT_PORT PIOS_GPIO_OUT_2_PORT +#define PPM_OUT_ENABLE PIOS_GPIO_Enable(2) +#define PPM_OUT_HIGH PIOS_GPIO_Off(2) +#define PPM_OUT_LOW PIOS_GPIO_On(2) + +#define SPARE1_ENABLE PIOS_GPIO_Enable(3) +#define SPARE1_HIGH PIOS_GPIO_Off(3) +#define SPARE1_LOW PIOS_GPIO_On(3) + +#define SPARE2_ENABLE PIOS_GPIO_Enable(4) +#define SPARE2_HIGH PIOS_GPIO_Off(4) +#define SPARE2_LOW PIOS_GPIO_On(4) + +#define SPARE3_ENABLE PIOS_GPIO_Enable(5) +#define SPARE3_HIGH PIOS_GPIO_Off(5) +#define SPARE3_LOW PIOS_GPIO_On(5) + +#define SPARE4_ENABLE PIOS_GPIO_Enable(6) +#define SPARE4_HIGH PIOS_GPIO_Off(6) +#define SPARE4_LOW PIOS_GPIO_On(6) + +#define SPARE5_ENABLE PIOS_GPIO_Enable(7) +#define SPARE5_HIGH PIOS_GPIO_Off(7) +#define SPARE5_LOW PIOS_GPIO_On(7) + +// ***************************************************************** +// GPIO input pins + +// GPIO_Mode_AIN Analog Input +// GPIO_Mode_IN_FLOATING Input Floating +// GPIO_Mode_IPD Input Pull-Down +// GPIO_Mode_IPU Input Pull-up + +// API mode line +#define GPIO_IN_0_PORT GPIOB +#define GPIO_IN_0_PIN GPIO_Pin_13 +#define GPIO_IN_0_MODE GPIO_Mode_IPU + +// Serial port CTS line +#define GPIO_IN_1_PORT GPIOB +#define GPIO_IN_1_PIN GPIO_Pin_14 +#define GPIO_IN_1_MODE GPIO_Mode_IPU + +// VBUS sense line +#define GPIO_IN_2_PORT GPIOA +#define GPIO_IN_2_PIN GPIO_Pin_8 +#define GPIO_IN_2_MODE GPIO_Mode_IN_FLOATING + +// 868MHz jumper option +#define GPIO_IN_3_PORT GPIOB +#define GPIO_IN_3_PIN GPIO_Pin_8 +#define GPIO_IN_3_MODE GPIO_Mode_IPU + +// 915MHz jumper option +#define GPIO_IN_4_PORT GPIOB +#define GPIO_IN_4_PIN GPIO_Pin_9 +#define GPIO_IN_4_MODE GPIO_Mode_IPU + +// RF INT line +#define GPIO_IN_5_PORT GPIOA +#define GPIO_IN_5_PIN GPIO_Pin_2 +#define GPIO_IN_5_MODE GPIO_Mode_IN_FLOATING + +// RF misc line +#define GPIO_IN_6_PORT GPIOB +#define GPIO_IN_6_PIN GPIO_Pin_0 +#define GPIO_IN_6_MODE GPIO_Mode_IN_FLOATING + +// PPM IN line +#define PPM_IN_PORT GPIOB +#define PPM_IN_PIN GPIO_Pin_11 +#define PPM_IN_MODE GPIO_Mode_IPD + +#define GPIO_IN_NUM 8 +#define GPIO_IN_PORTS { GPIO_IN_0_PORT, GPIO_IN_1_PORT, GPIO_IN_2_PORT, GPIO_IN_3_PORT, GPIO_IN_4_PORT, GPIO_IN_5_PORT, GPIO_IN_6_PORT, PPM_IN_PORT } +#define GPIO_IN_PINS { GPIO_IN_0_PIN, GPIO_IN_1_PIN, GPIO_IN_2_PIN, GPIO_IN_3_PIN, GPIO_IN_4_PIN, GPIO_IN_5_PIN, GPIO_IN_6_PIN, PPM_IN_PIN } +#define GPIO_IN_MODES { GPIO_IN_0_MODE, GPIO_IN_1_MODE, GPIO_IN_2_MODE, GPIO_IN_3_MODE, GPIO_IN_4_MODE, GPIO_IN_5_MODE, GPIO_IN_6_MODE, PPM_IN_MODE } + +#define API_MODE_PIN 0 +#define SERIAL_CTS_PIN 1 +#define VBUS_SENSE_PIN 2 +#define _868MHz_PIN 3 +#define _915MHz_PIN 4 +#define RF_INT_PIN 5 +#define RF_MISC_PIN 6 + +// ***************************************************************** +// USB + +#if defined(PIOS_INCLUDE_USB_HID) + #define PIOS_USB_ENABLED 1 + #define PIOS_USB_DETECT_GPIO_PORT GPIO_IN_2_PORT + #define PIOS_USB_DETECT_GPIO_PIN GPIO_IN_2_PIN + #define PIOS_USB_DETECT_EXTI_LINE EXTI_Line4 + #define PIOS_IRQ_USB_PRIORITY 8 + #define PIOS_USB_RX_BUFFER_SIZE 512 + #define PIOS_USB_TX_BUFFER_SIZE 512 +#endif + + +// ***************************************************************** +// VIDEO +#define PIOS_VIDEO_HSYNC_GPIO_PORT GPIOD +#define PIOS_VIDEO_HSYNC_GPIO_PIN GPIO_Pin_0 +#define PIOS_VIDEO_HSYNC_PORT_SOURCE GPIO_PortSourceGPIOD +#define PIOS_VIDEO_HSYNC_PIN_SOURCE GPIO_PinSource0 +#define PIOS_VIDEO_HSYNC_CLK RCC_AHB1Periph_GPIOD +#define PIOS_VIDEO_HSYNC_EXTI_LINE EXTI_Line0 +#define PIOS_VIDEO_HSYNC_EXTI_PORT_SOURCE EXTI_PortSourceGPIOD +#define PIOS_VIDEO_HSYNC_EXTI_PIN_SOURCE EXTI_PinSource0 +#define PIOS_VIDEO_HSYNC_IRQn EXTI0_IRQn +#define PIOS_VIDEO_HSYNC_PRIO PIOS_IRQ_PRIO_HIGHEST +//#define PIOS_VIDEO_SYNC_PRIO 1 + +#define PIOS_VIDEO_VSYNC_GPIO_PORT GPIOC +#define PIOS_VIDEO_VSYNC_GPIO_PIN GPIO_Pin_11 +#define PIOS_VIDEO_VSYNC_PORT_SOURCE GPIO_PortSourceGPIOC +#define PIOS_VIDEO_VSYNC_PIN_SOURCE GPIO_PinSource11 +#define PIOS_VIDEO_VSYNC_CLK RCC_AHB1Periph_GPIOC +#define PIOS_VIDEO_VSYNC_EXTI_LINE EXTI_Line11 +#define PIOS_VIDEO_VSYNC_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC +#define PIOS_VIDEO_VSYNC_EXTI_PIN_SOURCE EXTI_PinSource11 +#define PIOS_VIDEO_VSYNC_IRQn EXTI15_10_IRQn +#define PIOS_VIDEO_VSYNC_PRIO PIOS_IRQ_PRIO_HIGHEST + + +// ***************************************************************** +//-------------------------- +// Timer controller settings +//-------------------------- +#define PIOS_TIM_MAX_DEVS 6 + +//------------------------- +// USB +//------------------------- +#define PIOS_USB_MAX_DEVS 1 +#define PIOS_USB_ENABLED 1 /* Should remove all references to this */ +#define PIOS_USB_HID_MAX_DEVS 1 + + +#endif /* PIOS_BOARD_H */ diff --git a/flight/PiOS/Boards/pios_board.h b/flight/PiOS/Boards/pios_board.h index 1b2588bc5..5fd6fefc9 100644 --- a/flight/PiOS/Boards/pios_board.h +++ b/flight/PiOS/Boards/pios_board.h @@ -13,6 +13,8 @@ #include "STM32F2xx_INS.h" #elif USE_STM32F4xx_OP #include "STM32F4xx_Revolution.h" +#elif USE_STM32F4xx_OSD +#include "STM32F4xx_OSD.h" #else #error Board definition has not been provided. #endif diff --git a/flight/PiOS/Common/pios_video.c b/flight/PiOS/Common/pios_video.c new file mode 100644 index 000000000..d52ad2355 --- /dev/null +++ b/flight/PiOS/Common/pios_video.c @@ -0,0 +1,264 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_VIDEO Code for OSD video generator + * @brief OSD generator, Parts from CL-OSD and SUPEROSD project + * @{ + * + * @file pios_video.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief OSD generator, Parts from CL-OSD and SUPEROSD projects + * @see The GNU Public License (GPL) Version 3 + * + ****************************************************************************** + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "pios.h" +#if defined(PIOS_INCLUDE_VIDEO) + +extern xSemaphoreHandle osdSemaphore; + +static const struct pios_video_cfg * dev_cfg; + +// Define the buffers. +// For 256x192 pixel mode: +// buffer0_level/buffer0_mask becomes buffer_level; and +// buffer1_level/buffer1_mask becomes buffer_mask; +// For 192x128 pixel mode, allocations are as the names are written. +// divide by 8 because two bytes to a word. +// Must be allocated in one block, so it is in a struct. +struct _buffers +{ + uint16_t buffer0_level[GRAPHICS_HEIGHT*GRAPHICS_WIDTH]; + uint16_t buffer0_mask[GRAPHICS_HEIGHT*GRAPHICS_WIDTH]; + uint16_t buffer1_level[GRAPHICS_HEIGHT*GRAPHICS_WIDTH]; + uint16_t buffer1_mask[GRAPHICS_HEIGHT*GRAPHICS_WIDTH]; +} buffers; + +// Remove the struct definition (makes it easier to write for.) +#define buffer0_level (buffers.buffer0_level) +#define buffer0_mask (buffers.buffer0_mask) +#define buffer1_level (buffers.buffer1_level) +#define buffer1_mask (buffers.buffer1_mask) + +// We define pointers to each of these buffers. +uint16_t *draw_buffer_level; +uint16_t *draw_buffer_mask; +uint16_t *disp_buffer_level; +uint16_t *disp_buffer_mask; + +volatile uint8_t gLineType = LINE_TYPE_UNKNOWN; +volatile uint16_t gActiveLine = 0; +volatile uint16_t gActivePixmapLine = 0; +volatile uint16_t line=0; +volatile uint16_t Vsync_update=0; +static int16_t m_osdLines=0; + +/** + * swap_buffers: Swaps the two buffers. Contents in the display + * buffer is seen on the output and the display buffer becomes + * the new draw buffer. + */ +void swap_buffers() +{ + // While we could use XOR swap this is more reliable and + // dependable and it's only called a few times per second. + // Many compliers should optimise these to EXCH instructions. + uint16_t *tmp; + SWAP_BUFFS(tmp, disp_buffer_mask, draw_buffer_mask); + SWAP_BUFFS(tmp, disp_buffer_level, draw_buffer_level); +} + +void PIOS_Hsync_ISR() { + //PIOS_LED_Toggle(LED2); + //uint16_t currLine = gActivePixmapLine; + //PIOS_LED_Off(LED3); + /*for(int g=0;g<130;g++) + { + asm("nop"); + }*/ + //PIOS_DELAY_WaituS(5); // wait 5us to see if H or V sync + //if(dev_cfg->hsync_io.gpio->IDR & dev_cfg->hsync_io.init.GPIO_Pin) { + if(PIOS_VIDEO_HSYNC_GPIO_PORT->IDR & PIOS_VIDEO_HSYNC_GPIO_PIN) { + //rising + //if (gActiveLine != 0) { + //PIOS_LED_On(LED2); + if(gLineType == LINE_TYPE_GRAPHICS) + { + for(int g=0;g<130;g++) + { + asm("nop"); + } + // Activate new line + DMA_Cmd(dev_cfg->level.dma.tx.channel, ENABLE); + DMA_Cmd(dev_cfg->mask.dma.tx.channel, ENABLE); + } + //} + } else { + //falling + gLineType = LINE_TYPE_UNKNOWN; // Default case + gActiveLine++; + /*if (gActiveLine == UPDATE_LINE) { + gUpdateScreenData = 1; // trigger frame update + } + else */ + if ((gActiveLine >= GRAPHICS_LINE) && (gActiveLine < (GRAPHICS_LINE + GRAPHICS_HEIGHT))) { + gLineType = LINE_TYPE_GRAPHICS; + gActivePixmapLine = (gActiveLine - GRAPHICS_LINE); + line = gActivePixmapLine*GRAPHICS_WIDTH; + } + //if (gActiveLine != 0) { + //if(DMA_GetFlagStatus(DMA1_Stream5,DMA_FLAG_TCIF5)) + { + //PIOS_LED_Off(LED2); + if(gLineType == LINE_TYPE_GRAPHICS) + { + // Load new line + DMA_Cmd(dev_cfg->mask.dma.tx.channel, DISABLE); + DMA_Cmd(dev_cfg->level.dma.tx.channel, DISABLE); + DMA_MemoryTargetConfig(dev_cfg->level.dma.tx.channel,(uint32_t)&disp_buffer_level[line],DMA_Memory_0); + DMA_MemoryTargetConfig(dev_cfg->mask.dma.tx.channel,(uint32_t)&disp_buffer_mask[line],DMA_Memory_0); + //DMA_ClearFlag(dev_cfg->mask.dma.tx.channel,DMA_FLAG_TCIF5); // <-- TODO: HARDCODED + //DMA_ClearFlag(dev_cfg->level.dma.tx.channel,DMA_FLAG_TCIF5); // <-- TODO: HARDCODED + DMA_SetCurrDataCounter(dev_cfg->level.dma.tx.channel,BUFFER_LINE_LENGTH); + DMA_SetCurrDataCounter(dev_cfg->mask.dma.tx.channel,BUFFER_LINE_LENGTH); + } + } + //} + } +} + +void PIOS_Vsync_ISR() { + static portBASE_TYPE xHigherPriorityTaskWoken; + //PIOS_LED_Toggle(LED3); + + //if(gActiveLine > 200) + m_osdLines = gActiveLine; + { + gActiveLine = 0; + Vsync_update++; + if(Vsync_update>=1) + { + swap_buffers(); + Vsync_update=0; + xSemaphoreGiveFromISR(osdSemaphore, &xHigherPriorityTaskWoken); + } + } +} + +uint16_t PIOS_Video_GetOSDLines(void) { + return m_osdLines; +} + +void PIOS_Video_Init(const struct pios_video_cfg * cfg){ + + dev_cfg = cfg; // store config before enabling interrupt + + if (cfg->mask.remap) { + GPIO_PinAFConfig(cfg->mask.sclk.gpio, + __builtin_ctz(cfg->mask.sclk.init.GPIO_Pin), + cfg->mask.remap); + GPIO_PinAFConfig(cfg->mask.mosi.gpio, + __builtin_ctz(cfg->mask.mosi.init.GPIO_Pin), + cfg->mask.remap); + } + if (cfg->level.remap) + { + GPIO_PinAFConfig(cfg->level.sclk.gpio, + GPIO_PinSource3, + //__builtin_ctz(cfg->mask.sclk.init.GPIO_Pin), + cfg->level.remap); + GPIO_PinAFConfig(cfg->level.miso.gpio, + GPIO_PinSource4, + //__builtin_ctz(cfg->level.miso.init.GPIO_Pin), + cfg->level.remap); + } + + /* SPI3 MASTER MASKBUFFER */ + GPIO_Init(cfg->mask.sclk.gpio, (GPIO_InitTypeDef*)&(cfg->mask.sclk.init)); + GPIO_Init(cfg->mask.mosi.gpio, (GPIO_InitTypeDef*)&(cfg->mask.mosi.init)); + + /* SPI1 SLAVE FRAMEBUFFER */ + GPIO_Init(cfg->level.sclk.gpio, (GPIO_InitTypeDef*)&(cfg->level.sclk.init)); + GPIO_Init(cfg->level.miso.gpio, (GPIO_InitTypeDef*)&(cfg->level.miso.init)); + + /* Initialize the SPI block */ + SPI_Init(cfg->level.regs, (SPI_InitTypeDef*)&(cfg->level.init)); + SPI_Init(cfg->mask.regs, (SPI_InitTypeDef*)&(cfg->mask.init)); + + /* Enable SPI */ + SPI_Cmd(cfg->level.regs, ENABLE); + SPI_Cmd(cfg->mask.regs, ENABLE); + + /* Configure DMA for SPI Tx MASTER */ + DMA_Cmd(cfg->mask.dma.tx.channel, DISABLE); + DMA_Init(cfg->mask.dma.tx.channel, (DMA_InitTypeDef*)&(cfg->mask.dma.tx.init)); + + /* Configure DMA for SPI Tx SLAVE */ + DMA_Cmd(cfg->level.dma.tx.channel, DISABLE); + DMA_Init(cfg->level.dma.tx.channel, (DMA_InitTypeDef*)&(cfg->level.dma.tx.init)); + + + /* Trigger interrupt when for half conversions too to indicate double buffer */ + DMA_ITConfig(cfg->mask.dma.tx.channel, DMA_IT_TC, ENABLE); + /*DMA_ClearFlag(cfg->mask.dma.tx.channel,DMA_FLAG_TCIF5); + DMA_ClearITPendingBit(cfg->mask.dma.tx.channel, DMA_IT_TCIF5); + + DMA_ClearFlag(cfg->level.dma.tx.channel,DMA_FLAG_TCIF5); + DMA_ClearITPendingBit(cfg->level.dma.tx.channel, DMA_IT_TCIF5); +*/ + + /* Configure DMA interrupt */ + NVIC_Init(&cfg->level.dma.irq.init); + NVIC_Init(&cfg->mask.dma.irq.init); + + + + /* Enable SPI interrupts to DMA */ + SPI_I2S_DMACmd(cfg->level.regs, SPI_I2S_DMAReq_Tx, ENABLE); + SPI_I2S_DMACmd(cfg->mask.regs, SPI_I2S_DMAReq_Tx, ENABLE); + + /* Initialize the GPIO pins */ + //SYSCFG_EXTILineConfig(cfg->vsync.port_source, cfg->vsync.pin_source); + //SYSCFG_EXTILineConfig(cfg->hsync.port_source, cfg->hsync.pin_source); + + /* Configure Video Sync pin input floating */ + //GPIO_Init(cfg->vsync_io.gpio, (GPIO_InitTypeDef*)&(cfg->vsync_io.init)); + //GPIO_Init(cfg->hsync_io.gpio, (GPIO_InitTypeDef*)&(cfg->hsync_io.init)); + + /* Configure the Video Line interrupt */ + PIOS_EXTI_Init(cfg->hsync); + PIOS_EXTI_Init(cfg->vsync); + //EXTI_Init(&cfg->vsync.init); + //EXTI_Init(&cfg->hsync.init); + + /* Enable and set EXTI Interrupt to the lowest priority */ + //NVIC_Init(&cfg->vsync_irq.init); + //NVIC_Init(&cfg->hsync_irq.init); + + draw_buffer_level = buffer0_level; + draw_buffer_mask = buffer0_mask; + disp_buffer_level = buffer1_level; + disp_buffer_mask = buffer1_mask; +} + + +#endif + + diff --git a/flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/osd/system_stm32f4xx.c b/flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/osd/system_stm32f4xx.c new file mode 100644 index 000000000..9c743591c --- /dev/null +++ b/flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/osd/system_stm32f4xx.c @@ -0,0 +1,552 @@ +/** + ****************************************************************************** + * @file system_stm32f4xx.c + * @author MCD Application Team + * @version V1.0.1 + * @date 24-January-2012 + * @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File. + * This file contains the system clock configuration for STM32F4xx devices, + * and is generated by the clock configuration tool + * stm32f4xx_Clock_Configuration_V1.0.1.xls + * + * 1. This file provides two functions and one global variable to be called from + * user application: + * - SystemInit(): Setups the system clock (System clock source, PLL Multiplier + * and Divider factors, AHB/APBx prescalers and Flash settings), + * depending on the configuration made in the clock xls tool. + * This function is called at startup just after reset and + * before branch to main program. This call is made inside + * the "startup_stm32f4xx.s" file. + * + * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used + * by the user application to setup the SysTick + * timer or configure other parameters. + * + * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must + * be called whenever the core clock is changed + * during program execution. + * + * 2. After each device reset the HSI (16 MHz) is used as system clock source. + * Then SystemInit() function is called, in "startup_stm32f4xx.s" file, to + * configure the system clock before to branch to main program. + * + * 3. If the system clock source selected by user fails to startup, the SystemInit() + * function will do nothing and HSI still used as system clock source. User can + * add some code to deal with this issue inside the SetSysClock() function. + * + * 4. The default value of HSE crystal is set to 25MHz, refer to "HSE_VALUE" define + * in "stm32f4xx.h" file. When HSE is used as system clock source, directly or + * through PLL, and you are using different crystal you have to adapt the HSE + * value to your own configuration. + * + * 5. This file configures the system clock as follows: + *============================================================================= + *============================================================================= + * Supported STM32F4xx device revision | Rev A + *----------------------------------------------------------------------------- + * System Clock source | PLL (HSE) + *----------------------------------------------------------------------------- + * SYSCLK(Hz) | 108000000 + *----------------------------------------------------------------------------- + * HCLK(Hz) | 108000000 + *----------------------------------------------------------------------------- + * AHB Prescaler | 1 + *----------------------------------------------------------------------------- + * APB1 Prescaler | 4 + *----------------------------------------------------------------------------- + * APB2 Prescaler | 2 + *----------------------------------------------------------------------------- + * HSE Frequency(Hz) | 8000000 + *----------------------------------------------------------------------------- + * PLL_M | 4 + *----------------------------------------------------------------------------- + * PLL_N | 216 + *----------------------------------------------------------------------------- + * PLL_P | 4 + *----------------------------------------------------------------------------- + * PLL_Q | 9 + *----------------------------------------------------------------------------- + * PLLI2S_N | NA + *----------------------------------------------------------------------------- + * PLLI2S_R | NA + *----------------------------------------------------------------------------- + * I2S input clock | NA + *----------------------------------------------------------------------------- + * VDD(V) | 3.3 + *----------------------------------------------------------------------------- + * Main regulator output voltage | Scale2 mode + *----------------------------------------------------------------------------- + * Flash Latency(WS) | 3 + *----------------------------------------------------------------------------- + * Prefetch Buffer | OFF + *----------------------------------------------------------------------------- + * Instruction cache | ON + *----------------------------------------------------------------------------- + * Data cache | ON + *----------------------------------------------------------------------------- + * Require 48MHz for USB OTG FS, | Disabled + * SDIO and RNG clock | + *----------------------------------------------------------------------------- + *============================================================================= + ****************************************************************************** + * @attention + * + * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS + * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE + * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY + * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING + * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE + * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. + * + *

© COPYRIGHT 2011 STMicroelectronics

+ ****************************************************************************** + */ + +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f4xx_system + * @{ + */ + +/** @addtogroup STM32F4xx_System_Private_Includes + * @{ + */ + +#include "stm32f4xx.h" + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_TypesDefinitions + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_Defines + * @{ + */ + +/************************* Miscellaneous Configuration ************************/ +/*!< Uncomment the following line if you need to use external SRAM mounted + on STM324xG_EVAL board as data memory */ +/* #define DATA_IN_ExtSRAM */ + +/*!< Uncomment the following line if you need to relocate your vector Table in + Internal SRAM. */ +/* #define VECT_TAB_SRAM */ +#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field. + This value must be a multiple of 0x200. */ +/******************************************************************************/ + +/************************* PLL Parameters *************************************/ +/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */ +#define PLL_M 4 +#define PLL_N 216 + +/* SYSCLK = PLL_VCO / PLL_P */ +#define PLL_P 4 + +/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */ +#define PLL_Q 9 + +/******************************************************************************/ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_Macros + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_Variables + * @{ + */ + + uint32_t SystemCoreClock = 108000000; + + __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes + * @{ + */ + +static void SetSysClock(void); +#ifdef DATA_IN_ExtSRAM + static void SystemInit_ExtMemCtl(void); +#endif /* DATA_IN_ExtSRAM */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_Functions + * @{ + */ + +/** + * @brief Setup the microcontroller system + * Initialize the Embedded Flash Interface, the PLL and update the + * SystemFrequency variable. + * @param None + * @retval None + */ +void SystemInit(void) +{ + /* FPU settings ------------------------------------------------------------*/ + #if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */ + #endif + /* Reset the RCC clock configuration to the default reset state ------------*/ + /* Set HSION bit */ + RCC->CR |= (uint32_t)0x00000001; + + /* Reset CFGR register */ + RCC->CFGR = 0x00000000; + + /* Reset HSEON, CSSON and PLLON bits */ + RCC->CR &= (uint32_t)0xFEF6FFFF; + + /* Reset PLLCFGR register */ + RCC->PLLCFGR = 0x24003010; + + /* Reset HSEBYP bit */ + RCC->CR &= (uint32_t)0xFFFBFFFF; + + /* Disable all interrupts */ + RCC->CIR = 0x00000000; + +#ifdef DATA_IN_ExtSRAM + SystemInit_ExtMemCtl(); +#endif /* DATA_IN_ExtSRAM */ + + /* Configure the System clock source, PLL Multiplier and Divider factors, + AHB/APBx prescalers and Flash settings ----------------------------------*/ + SetSysClock(); + + /* Configure the Vector Table location add offset address ------------------*/ +#ifdef VECT_TAB_SRAM + SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */ +#else + SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */ +#endif +} + +/** + * @brief Update SystemCoreClock variable according to Clock Register Values. + * The SystemCoreClock variable contains the core clock (HCLK), it can + * be used by the user application to setup the SysTick timer or configure + * other parameters. + * + * @note Each time the core clock (HCLK) changes, this function must be called + * to update SystemCoreClock variable value. Otherwise, any configuration + * based on this variable will be incorrect. + * + * @note - The system frequency computed by this function is not the real + * frequency in the chip. It is calculated based on the predefined + * constant and the selected clock source: + * + * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*) + * + * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**) + * + * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**) + * or HSI_VALUE(*) multiplied/divided by the PLL factors. + * + * (*) HSI_VALUE is a constant defined in stm32f4xx.h file (default value + * 16 MHz) but the real value may vary depending on the variations + * in voltage and temperature. + * + * (**) HSE_VALUE is a constant defined in stm32f4xx.h file (default value + * 25 MHz), user has to ensure that HSE_VALUE is same as the real + * frequency of the crystal used. Otherwise, this function may + * have wrong result. + * + * - The result of this function could be not correct when using fractional + * value for HSE crystal. + * + * @param None + * @retval None + */ +void SystemCoreClockUpdate(void) +{ + uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2; + + /* Get SYSCLK source -------------------------------------------------------*/ + tmp = RCC->CFGR & RCC_CFGR_SWS; + + switch (tmp) + { + case 0x00: /* HSI used as system clock source */ + SystemCoreClock = HSI_VALUE; + break; + case 0x04: /* HSE used as system clock source */ + SystemCoreClock = HSE_VALUE; + break; + case 0x08: /* PLL used as system clock source */ + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N + SYSCLK = PLL_VCO / PLL_P + */ + pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22; + pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; + + if (pllsource != 0) + { + /* HSE used as PLL clock source */ + pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); + } + else + { + /* HSI used as PLL clock source */ + pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); + } + + pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2; + SystemCoreClock = pllvco/pllp; + break; + default: + SystemCoreClock = HSI_VALUE; + break; + } + /* Compute HCLK frequency --------------------------------------------------*/ + /* Get HCLK prescaler */ + tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)]; + /* HCLK frequency */ + SystemCoreClock >>= tmp; +} + +/** + * @brief Configures the System clock source, PLL Multiplier and Divider factors, + * AHB/APBx prescalers and Flash settings + * @Note This function should be called only once the RCC clock configuration + * is reset to the default reset state (done in SystemInit() function). + * @param None + * @retval None + */ +static void SetSysClock(void) +{ +/******************************************************************************/ +/* PLL (clocked by HSE) used as System clock source */ +/******************************************************************************/ + __IO uint32_t StartUpCounter = 0, HSEStatus = 0; + + /* Enable HSE */ + RCC->CR |= ((uint32_t)RCC_CR_HSEON); + + /* Wait till HSE is ready and if Time out is reached exit */ + do + { + HSEStatus = RCC->CR & RCC_CR_HSERDY; + StartUpCounter++; + } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT)); + + if ((RCC->CR & RCC_CR_HSERDY) != RESET) + { + HSEStatus = (uint32_t)0x01; + } + else + { + HSEStatus = (uint32_t)0x00; + } + + if (HSEStatus == (uint32_t)0x01) + { + /* Select regulator voltage output Scale 2 mode, System frequency up to 144 MHz */ + RCC->APB1ENR |= RCC_APB1ENR_PWREN; + PWR->CR &= (uint32_t)~(PWR_CR_VOS); + + /* HCLK = SYSCLK / 1*/ + RCC->CFGR |= RCC_CFGR_HPRE_DIV1; + + /* PCLK2 = HCLK / 2*/ + RCC->CFGR |= RCC_CFGR_PPRE2_DIV2; + + /* PCLK1 = HCLK / 4*/ + RCC->CFGR |= RCC_CFGR_PPRE1_DIV4; + + /* Configure the main PLL */ + RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) | + (RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24); + + /* Enable the main PLL */ + RCC->CR |= RCC_CR_PLLON; + + /* Wait till the main PLL is ready */ + while((RCC->CR & RCC_CR_PLLRDY) == 0) + { + } + + /* Configure Flash prefetch, Instruction cache, Data cache and wait state */ + FLASH->ACR = FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_3WS; + + /* Select the main PLL as system clock source */ + RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW)); + RCC->CFGR |= RCC_CFGR_SW_PLL; + + /* Wait till the main PLL is used as system clock source */ + while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL); + { + } + } + else + { /* If HSE fails to start-up, the application will have wrong clock + configuration. User can add here some code to deal with this error */ + } + +} + +/** + * @brief Setup the external memory controller. Called in startup_stm32f4xx.s + * before jump to __main + * @param None + * @retval None + */ +#ifdef DATA_IN_ExtSRAM +/** + * @brief Setup the external memory controller. + * Called in startup_stm32f4xx.s before jump to main. + * This function configures the external SRAM mounted on STM324xG_EVAL board + * This SRAM will be used as program data memory (including heap and stack). + * @param None + * @retval None + */ +void SystemInit_ExtMemCtl(void) +{ +/*-- GPIOs Configuration -----------------------------------------------------*/ +/* + +-------------------+--------------------+------------------+------------------+ + + SRAM pins assignment + + +-------------------+--------------------+------------------+------------------+ + | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 | + | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 | + | PD4 <-> FSMC_NOE | PE3 <-> FSMC_A19 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 | + | PD5 <-> FSMC_NWE | PE4 <-> FSMC_A20 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 | + | PD8 <-> FSMC_D13 | PE7 <-> FSMC_D4 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 | + | PD9 <-> FSMC_D14 | PE8 <-> FSMC_D5 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 | + | PD10 <-> FSMC_D15 | PE9 <-> FSMC_D6 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | + | PD11 <-> FSMC_A16 | PE10 <-> FSMC_D7 | PF13 <-> FSMC_A7 |------------------+ + | PD12 <-> FSMC_A17 | PE11 <-> FSMC_D8 | PF14 <-> FSMC_A8 | + | PD13 <-> FSMC_A18 | PE12 <-> FSMC_D9 | PF15 <-> FSMC_A9 | + | PD14 <-> FSMC_D0 | PE13 <-> FSMC_D10 |------------------+ + | PD15 <-> FSMC_D1 | PE14 <-> FSMC_D11 | + | | PE15 <-> FSMC_D12 | + +-------------------+--------------------+ +*/ + /* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */ + RCC->AHB1ENR = 0x00000078; + + /* Connect PDx pins to FSMC Alternate function */ + GPIOD->AFR[0] = 0x00cc00cc; + GPIOD->AFR[1] = 0xcc0ccccc; + /* Configure PDx pins in Alternate function mode */ + GPIOD->MODER = 0xaaaa0a0a; + /* Configure PDx pins speed to 100 MHz */ + GPIOD->OSPEEDR = 0xffff0f0f; + /* Configure PDx pins Output type to push-pull */ + GPIOD->OTYPER = 0x00000000; + /* No pull-up, pull-down for PDx pins */ + GPIOD->PUPDR = 0x00000000; + + /* Connect PEx pins to FSMC Alternate function */ + GPIOE->AFR[0] = 0xc00cc0cc; + GPIOE->AFR[1] = 0xcccccccc; + /* Configure PEx pins in Alternate function mode */ + GPIOE->MODER = 0xaaaa828a; + /* Configure PEx pins speed to 100 MHz */ + GPIOE->OSPEEDR = 0xffffc3cf; + /* Configure PEx pins Output type to push-pull */ + GPIOE->OTYPER = 0x00000000; + /* No pull-up, pull-down for PEx pins */ + GPIOE->PUPDR = 0x00000000; + + /* Connect PFx pins to FSMC Alternate function */ + GPIOF->AFR[0] = 0x00cccccc; + GPIOF->AFR[1] = 0xcccc0000; + /* Configure PFx pins in Alternate function mode */ + GPIOF->MODER = 0xaa000aaa; + /* Configure PFx pins speed to 100 MHz */ + GPIOF->OSPEEDR = 0xff000fff; + /* Configure PFx pins Output type to push-pull */ + GPIOF->OTYPER = 0x00000000; + /* No pull-up, pull-down for PFx pins */ + GPIOF->PUPDR = 0x00000000; + + /* Connect PGx pins to FSMC Alternate function */ + GPIOG->AFR[0] = 0x00cccccc; + GPIOG->AFR[1] = 0x000000c0; + /* Configure PGx pins in Alternate function mode */ + GPIOG->MODER = 0x00080aaa; + /* Configure PGx pins speed to 100 MHz */ + GPIOG->OSPEEDR = 0x000c0fff; + /* Configure PGx pins Output type to push-pull */ + GPIOG->OTYPER = 0x00000000; + /* No pull-up, pull-down for PGx pins */ + GPIOG->PUPDR = 0x00000000; + +/*-- FSMC Configuration ------------------------------------------------------*/ + /* Enable the FSMC interface clock */ + RCC->AHB3ENR = 0x00000001; + + /* Configure and enable Bank1_SRAM2 */ + FSMC_Bank1->BTCR[2] = 0x00001015; + FSMC_Bank1->BTCR[3] = 0x00010603; + FSMC_Bank1E->BWTR[2] = 0x0fffffff; + /* + Bank1_SRAM2 is configured as follow: + + p.FSMC_AddressSetupTime = 3; + p.FSMC_AddressHoldTime = 0; + p.FSMC_DataSetupTime = 6; + p.FSMC_BusTurnAroundDuration = 1; + p.FSMC_CLKDivision = 0; + p.FSMC_DataLatency = 0; + p.FSMC_AccessMode = FSMC_AccessMode_A; + + FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2; + FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; + FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_PSRAM; + FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; + FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; + FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; + FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; + FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; + FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; + FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; +*/ +} +#endif /* DATA_IN_ExtSRAM */ + + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ + diff --git a/flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/system_stm32f4xx.c b/flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/revolution/system_stm32f4xx.c similarity index 100% rename from flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/system_stm32f4xx.c rename to flight/PiOS/STM32F4xx/Libraries/CMSIS2/Device/ST/STM32F4xx/Source/revolution/system_stm32f4xx.c diff --git a/flight/PiOS/STM32F4xx/library.mk b/flight/PiOS/STM32F4xx/library.mk index c86ea86ce..a3760d807 100644 --- a/flight/PiOS/STM32F4xx/library.mk +++ b/flight/PiOS/STM32F4xx/library.mk @@ -1,74 +1,74 @@ -# -# Rules to (help) build the F4xx device support. -# - -# -# Directory containing this makefile -# -PIOS_DEVLIB := $(dir $(lastword $(MAKEFILE_LIST))) - -# -# Hardcoded linker script names for now -# -LINKER_SCRIPTS_APP = $(PIOS_DEVLIB)/link_STM32F4xx_OP_memory.ld \ - $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld - -LINKER_SCRIPTS_BL = $(PIOS_DEVLIB)/link_STM32F4xx_BL_memory.ld \ - $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld - -# -# Compiler options implied by the F4xx -# -CDEFS += -DSTM32F4XX -CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -CDEFS += -DUSE_STDPERIPH_DRIVER -ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard - -# -# PIOS device library source and includes -# -SRC += $(wildcard $(PIOS_DEVLIB)*.c) -EXTRAINCDIRS += $(PIOS_DEVLIB)/inc - -# -# CMSIS for the F4 -# -include $(PIOSCOMMONLIB)/CMSIS2/library.mk -CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)/Libraries/CMSIS2/Device/ST/STM32F4xx -SRC += $(wildcard $(CMSIS2_DEVICEDIR)/Source/*.c) -EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include - -# -# ST Peripheral library -# -PERIPHLIB = $(PIOS_DEVLIB)/Libraries/STM32F4xx_StdPeriph_Driver -SRC += $(wildcard $(PERIPHLIB)/src/*.c) -EXTRAINCDIRS += $(PERIPHLIB)/inc - -# -# ST USB OTG library -# -USBOTGLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_OTG_Driver -USBOTGLIB_SRC = usb_core.c usb_dcd.c usb_dcd_int.c -SRC += $(addprefix $(USBOTGLIB)/src/,$(USBOTGLIB_SRC)) -EXTRAINCDIRS += $(USBOTGLIB)/inc - -# -# ST USB Device library -# -USBDEVLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_Device_Library -SRC += $(wildcard $(USBDEVLIB)/Core/src/*.c) -EXTRAINCDIRS += $(USBDEVLIB)/Core/inc - -# -# FreeRTOS -# -# If the application has included the generic FreeRTOS support, then add in -# the device-specific pieces of the code. -# -ifneq ($(FREERTOS_DIR),) -FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source -SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4/*.c) -EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4 -endif - +# +# Rules to (help) build the F4xx device support. +# + +# +# Directory containing this makefile +# +PIOS_DEVLIB := $(dir $(lastword $(MAKEFILE_LIST))) + +# +# Hardcoded linker script names for now +# +LINKER_SCRIPTS_APP = $(PIOS_DEVLIB)/link_STM32F4xx_OP_memory.ld \ + $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld + +LINKER_SCRIPTS_BL = $(PIOS_DEVLIB)/link_STM32F4xx_BL_memory.ld \ + $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld + +# +# Compiler options implied by the F4xx +# +CDEFS += -DSTM32F4XX +CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) +CDEFS += -DUSE_STDPERIPH_DRIVER +ARCHFLAGS += -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp +#ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard + +# +# PIOS device library source and includes +# +SRC += $(wildcard $(PIOS_DEVLIB)*.c) +EXTRAINCDIRS += $(PIOS_DEVLIB)/inc + +# +# CMSIS for the F4 +# +include $(PIOSCOMMONLIB)/CMSIS2/library.mk +CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)/Libraries/CMSIS2/Device/ST/STM32F4xx +SRC += $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c) +EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include + +# +# ST Peripheral library +# +PERIPHLIB = $(PIOS_DEVLIB)/Libraries/STM32F4xx_StdPeriph_Driver +SRC += $(wildcard $(PERIPHLIB)/src/*.c) +EXTRAINCDIRS += $(PERIPHLIB)/inc + +# +# ST USB OTG library +# +USBOTGLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_OTG_Driver +USBOTGLIB_SRC = usb_core.c usb_dcd.c usb_dcd_int.c +SRC += $(addprefix $(USBOTGLIB)/src/,$(USBOTGLIB_SRC)) +EXTRAINCDIRS += $(USBOTGLIB)/inc + +# +# ST USB Device library +# +USBDEVLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_Device_Library +SRC += $(wildcard $(USBDEVLIB)/Core/src/*.c) +EXTRAINCDIRS += $(USBDEVLIB)/Core/inc + +# +# FreeRTOS +# +# If the application has included the generic FreeRTOS support, then add in +# the device-specific pieces of the code. +# +ifneq ($(FREERTOS_DIR),) +FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source +SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4/*.c) +EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4 +endif diff --git a/flight/PiOS/STM32F4xx/link_STM32F4xx_OP_memory.ld b/flight/PiOS/STM32F4xx/link_STM32F4xx_OP_memory.ld index d6082e917..eb5927ce4 100644 --- a/flight/PiOS/STM32F4xx/link_STM32F4xx_OP_memory.ld +++ b/flight/PiOS/STM32F4xx/link_STM32F4xx_OP_memory.ld @@ -1,7 +1,7 @@ MEMORY { BD_INFO (r) : ORIGIN = 0x08008000 - 0x80, LENGTH = 0x000080 - FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 0x100000 - 0x008000 + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x100000 - 0x008000 SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x020000 CCSRAM (rw) : ORIGIN = 0x10000000, LENGTH = 0x010000 } diff --git a/flight/PiOS/STM32F4xx/pios_sys.c b/flight/PiOS/STM32F4xx/pios_sys.c index 8ee9a79ce..0bd5208a7 100644 --- a/flight/PiOS/STM32F4xx/pios_sys.c +++ b/flight/PiOS/STM32F4xx/pios_sys.c @@ -299,7 +299,7 @@ void assert_failed(uint8_t * file, uint32_t line) #if defined(PIOS_LED_ALARM) PIOS_LED_On(PIOS_LED_ALARM); #endif -#if defiend(PIOS_LED_HEARTBEAT) +#if defined(PIOS_LED_HEARTBEAT) PIOS_LED_Off(PIOS_LED_HEARTBEAT); #endif diff --git a/flight/PiOS/inc/pios_usb_defs.h b/flight/PiOS/inc/pios_usb_defs.h index f0352333f..3d744e5ec 100644 --- a/flight/PiOS/inc/pios_usb_defs.h +++ b/flight/PiOS/inc/pios_usb_defs.h @@ -364,6 +364,7 @@ enum usb_op_board_ids { USB_OP_BOARD_ID_PIPXTREME = 3, USB_OP_BOARD_ID_COPTERCONTROL = 4, USB_OP_BOARD_ID_REVOLUTION = 5, + USB_OP_BOARD_ID_OSD = 6, } __attribute__((packed)); enum usb_op_board_modes { diff --git a/flight/PiOS/inc/pios_video.h b/flight/PiOS/inc/pios_video.h new file mode 100644 index 000000000..64782768c --- /dev/null +++ b/flight/PiOS/inc/pios_video.h @@ -0,0 +1,93 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_VIDEO Code for OSD video generator + * @brief OSD generator, Parts from CL-OSD and SUPEROSD project + * @{ + * + * @file pios_video.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief OSD generator, Parts from CL-OSD and SUPEROSD projects + * @see The GNU Public License (GPL) Version 3 + * + ****************************************************************************** + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_VIDEO_H +#define PIOS_VIDEO_H + +#include + +// ***************************************************************************** +#if defined(PIOS_INCLUDE_VIDEO) + +#include +#include + +struct pios_video_cfg { + const struct pios_spi_cfg mask; + const struct pios_spi_cfg level; + + const struct pios_exti_cfg * hsync; + const struct pios_exti_cfg * vsync; + + /*struct stm32_exti hsync; + struct stm32_exti vsync; + struct stm32_gpio hsync_io; + struct stm32_gpio vsync_io; + struct stm32_irq hsync_irq; + struct stm32_irq vsync_irq;*/ +}; + +// Time vars +typedef struct { + uint8_t sec; + uint8_t min; + uint8_t hour; +} TTime; + +extern TTime time; + +extern void PIOS_Video_Init(const struct pios_video_cfg * cfg); +uint16_t PIOS_Video_GetOSDLines(void); +extern void PIOS_Hsync_ISR(); +extern void PIOS_Vsync_ISR(); + +// First OSD line +#define GRAPHICS_LINE 32 + +// Real OSD size +#define GRAPHICS_WIDTH_REAL 336 +#define GRAPHICS_HEIGHT_REAL 270 + +#define GRAPHICS_WIDTH (GRAPHICS_WIDTH_REAL/16) +#define GRAPHICS_HEIGHT GRAPHICS_HEIGHT_REAL + +// dma lenght +#define BUFFER_LINE_LENGTH GRAPHICS_WIDTH //Yes, in 16 bit halfwords. + +// line types +#define LINE_TYPE_UNKNOWN 0 +#define LINE_TYPE_GRAPHICS 2 + +// Macro to swap buffers given a temporary pointer. +#define SWAP_BUFFS(tmp, a, b) { tmp = a; a = b; b = tmp; } + +#endif +#endif /* PIOS_VIDEO_H */ diff --git a/flight/PiOS/pios.h b/flight/PiOS/pios.h index 87149033f..753794d05 100644 --- a/flight/PiOS/pios.h +++ b/flight/PiOS/pios.h @@ -138,6 +138,9 @@ #if defined(PIOS_INCLUDE_BMA180) #include #endif +#if defined(PIOS_INCLUDE_VIDEO) +#include +#endif #if defined(PIOS_INCLUDE_FLASH) #include diff --git a/make/boards/osd/board-info.mk b/make/boards/osd/board-info.mk new file mode 100644 index 000000000..bcfe990b5 --- /dev/null +++ b/make/boards/osd/board-info.mk @@ -0,0 +1,23 @@ +BOARD_TYPE := 0x05 +BOARD_REVISION := 0x01 +BOOTLOADER_VERSION := 0x01 +HW_TYPE := 0x00 + +MCU := cortex-m4 +CHIP := STM32F407VGT6 +BOARD := STM32F4xx_OSD +MODEL := HD +MODEL_SUFFIX := + +OPENOCD_CONFIG := stm32f4xx.cfg + +# Note: These must match the values in link_$(BOARD)_memory.ld +#BL_BANK_BASE := 0x08000000 # Start of bootloader flash +#BL_BANK_SIZE := 0x00008000 # Should include BD_INFO region +FW_BANK_BASE := 0x08000000 # Start of firmware flash +FW_BANK_SIZE := 0x0001E000 # Should include FW_DESC_SIZE + +FW_DESC_SIZE := 0x00000064 + +OSCILLATOR_FREQ := 8000000 +SYSCLK_FREQ := 108000000 \ No newline at end of file