[Taranis] Curve names

[Taranis] Menu system now allows hidden rows
[Taranis] DEBUG menu removed
[stock2561] First draft!
This commit is contained in:
bsongis@gmail.com
2013-04-18 20:04:37 +00:00
parent e7a0c793bb
commit 11c1dba91e
31 changed files with 752 additions and 461 deletions
+100 -106
View File
@@ -37,109 +37,102 @@
#ifndef lcd_h
#define lcd_h
#if defined(PCBACT)
#define LCD_W 260
#define LCD_H 75
#define xcoord_t uint16_t
#define CENTER "\015"
#define CENTER_OFS (7*FW-FW/2)
#elif defined(PCBTARANIS)
#define LCD_W 212
#define LCD_H 64
#define xcoord_t uint16_t
#define CENTER "\015"
#define CENTER_OFS (7*FW-FW/2)
#if defined(PCBTARANIS)
#define LCD_W 212
#define LCD_H 64
#define xcoord_t uint16_t
#define CENTER "\015"
#define CENTER_OFS (7*FW-FW/2)
#else
#define LCD_W 128
#define LCD_H 64
#define xcoord_t uint8_t
#define CENTER
#define CENTER_OFS 0
#define LCD_W 128
#define LCD_H 64
#define xcoord_t uint8_t
#define CENTER
#define CENTER_OFS 0
#endif
#if defined(CPUARM)
#define lcdint_t int32_t
#define lcdint_t int32_t
#else
#define lcdint_t int16_t
#define lcdint_t int16_t
#endif
#if LCD_H > 64
#define LCD_LINES 9
#define LCD_LINES 9
#else
#define LCD_LINES 8
#define LCD_LINES 8
#endif
#define FW 6
#define FWNUM 5
#define FH 8
#define FW 6
#define FWNUM 5
#define FH 8
/* lcd common flags */
#define BLINK 0x01
#define BLINK 0x01
/* lcd text flags */
#define INVERS 0x02
#define DBLSIZE 0x04
#define INVERS 0x02
#define DBLSIZE 0x04
#ifdef BOLD_FONT
#define BOLD 0x40
#define BOLD 0x40
#else
#define BOLD 0x00
#define BOLD 0x00
#endif
/* lcd putc flags */
#define CONDENSED 0x08
#define CONDENSED 0x08
/* lcd puts flags */
/* no 0x80 here because of "GV"1 which is aligned LEFT */
/* no 0x10 here because of "MODEL"01 which uses LEADING0 */
#define BSS 0x20
#define ZCHAR 0x80
#define BSS 0x20
#define ZCHAR 0x80
/* lcd outdez flags */
#define UNSIGN 0x08
#define LEADING0 0x10
#define PREC1 0x20
#define PREC2 0x30
#define MODE(flags) ((((int8_t)(flags) & 0x30) - 0x10) >> 4)
#define LEFT 0x80 /* align left */
#define UNSIGN 0x08
#define LEADING0 0x10
#define PREC1 0x20
#define PREC2 0x30
#define MODE(flags) ((((int8_t)(flags) & 0x30) - 0x10) >> 4)
#define LEFT 0x80 /* align left */
/* line, rect, square flags */
#define FORCE 0x02
#define ERASE 0x04
#define ROUND 0x08
#define FORCE 0x02
#define ERASE 0x04
#define ROUND 0x08
#if defined(PCBTARANIS)
#define FILL_WHITE 0x10
#define FILL_WHITE 0x10
#endif
/* switches flags */
#define SWCONDENSED 0x20 /* means that THRm will be displayed as THR */
#define SWCONDENSED 0x20 /* means that THRm will be displayed as THR */
/* telemetry flags */
#define NO_UNIT 0x40
#define NO_UNIT 0x40
#if defined(CPUARM)
#define MIDSIZE 0x0100
#define SMLSIZE 0x0200
#define TINSIZE 0x0400
#define MIDSIZE 0x0100
#define SMLSIZE 0x0200
#define TINSIZE 0x0400
#else
#define MIDSIZE DBLSIZE
#define SMLSIZE 0x00
#define TINSIZE 0x00
#define MIDSIZE DBLSIZE
#define SMLSIZE 0x00
#define TINSIZE 0x00
#endif
#if defined(PCBTARANIS)
#define GREY(x) ((x) * 0x1000)
#define GREY_DEFAULT GREY(11)
#define GREY_MASK(x) ((x) & 0xF000)
#define GREY(x) ((x) * 0x1000)
#define GREY_DEFAULT GREY(11)
#define GREY_MASK(x) ((x) & 0xF000)
#endif
#if defined(CPUARM)
#define LcdFlags uint32_t
#define LcdFlags uint32_t
#else
#define LcdFlags uint8_t
#define LcdFlags uint8_t
#endif
#define DISPLAY_PLAN_SIZE (LCD_W*((LCD_H+7)/8))
#define DISPLAY_PLAN_SIZE (LCD_W*((LCD_H+7)/8))
#if defined(PCBTARANIS)
#define DISPLAY_BUF_SIZE (4*DISPLAY_PLAN_SIZE)
@@ -151,71 +144,72 @@ extern uint8_t displayBuf[DISPLAY_BUF_SIZE];
extern uint8_t lcdLastPos;
#if defined(PCBSTD) && defined(VOICE)
extern volatile uint8_t LcdLock ;
extern volatile uint8_t LcdLock ;
#endif
#if defined(PCBSKY9X)
extern volatile uint8_t lcdLock ;
extern volatile uint32_t lcdInputs ;
extern volatile uint8_t lcdLock ;
extern volatile uint32_t lcdInputs ;
#endif
extern void lcd_putc(xcoord_t x, uint8_t y, const unsigned char c);
extern void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags mode);
extern void lcd_putsAtt(xcoord_t x, uint8_t y, const pm_char * s, LcdFlags mode);
extern void lcd_putsiAtt(xcoord_t x, uint8_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
extern void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s,unsigned char len, LcdFlags mode);
extern void lcd_puts(xcoord_t x, uint8_t y, const pm_char * s);
extern void lcd_putsn(xcoord_t x, uint8_t y, const pm_char * s, unsigned char len);
extern void lcd_putsLeft(uint8_t y, const pm_char * s);
void lcd_putc(xcoord_t x, uint8_t y, const unsigned char c);
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags mode);
void lcd_putsAtt(xcoord_t x, uint8_t y, const pm_char * s, LcdFlags mode);
void lcd_putsiAtt(xcoord_t x, uint8_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s,unsigned char len, LcdFlags mode);
void lcd_puts(xcoord_t x, uint8_t y, const pm_char * s);
void lcd_putsn(xcoord_t x, uint8_t y, const pm_char * s, unsigned char len);
void lcd_putsLeft(uint8_t y, const pm_char * s);
#define lcd_putsCenter(y, s) lcd_puts((LCD_W-sizeof(TR_##s)*FW+FW-2)/2, y, STR_##s)
extern void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val);
extern void lcd_outdezAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0);
extern void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0, uint8_t len=0);
extern void lcd_outdez8(xcoord_t x, uint8_t y, int8_t val);
void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val);
void lcd_outdezAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0);
void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0, uint8_t len=0);
void lcd_outdez8(xcoord_t x, uint8_t y, int8_t val);
extern void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
extern void putsModelName(xcoord_t x, uint8_t y, char *name, uint8_t id, LcdFlags att);
extern void putsSwitches(xcoord_t x, uint8_t y, int8_t swtch, LcdFlags att=0);
extern void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att=0);
extern void putsFlightPhase(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
extern void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
extern void putsTmrMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att);
extern void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
void putsModelName(xcoord_t x, uint8_t y, char *name, uint8_t id, LcdFlags att);
void putsSwitches(xcoord_t x, uint8_t y, int8_t swtch, LcdFlags att=0);
void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att=0);
void putsFlightPhase(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
void putsTmrMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att);
void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
#if defined(ROTARY_ENCODERS)
void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
#endif
#define putsChn(x, y, idx, att) putsMixerSource(x, y, MIXSRC_CH1+idx-1, att)
extern void putsChnLetter(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags attr);
void putsChnLetter(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags attr);
extern void putsVolts(xcoord_t x, uint8_t y, uint16_t volts, LcdFlags att);
extern void putsVBat(xcoord_t x, uint8_t y, LcdFlags att);
void putsVolts(xcoord_t x, uint8_t y, uint16_t volts, LcdFlags att);
void putsVBat(xcoord_t x, uint8_t y, LcdFlags att);
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att);
#if defined(CPUARM)
#define putstime_t int32_t
#define putstime_t int32_t
#else
#define putstime_t int16_t
#define putstime_t int16_t
#endif
extern void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
#define SOLID 0xff
#define DOTTED 0x55
extern void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att=0);
extern void lcd_hline(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0);
extern void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att=0);
extern void lcd_vline(xcoord_t x, int8_t y, int8_t h);
void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att=0);
void lcd_hline(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0);
void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att=0);
void lcd_vline(xcoord_t x, int8_t y, int8_t h);
#if defined(CPUM64)
extern void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat);
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat);
#else
extern void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att=0);
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att=0);
#endif
extern void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
extern void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
extern void lcd_invert_line(int8_t y);
void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_invert_line(int8_t y);
#define lcd_status_line() lcd_invert_line(LCD_LINES-1)
inline void lcd_square(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0) { lcd_rect(x, y, w, w, SOLID, att); }
@@ -237,25 +231,25 @@ void lcdDrawTelemetryTopBar();
lcd_vline(x+4, y+8, 2); \
lcd_vline(x+5, y+8, 2);
extern void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
extern void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset=0, uint8_t width=0);
void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset=0, uint8_t width=0);
#define LCD_ICON(x, y, icon) lcd_bmp(x, y, icons, icon)
extern void lcdSetRefVolt(unsigned char val);
extern void lcdInit();
extern void lcd_clear();
extern void lcdSetContrast();
void lcdSetRefVolt(unsigned char val);
void lcdInit();
void lcd_clear();
void lcdSetContrast();
extern void lcdRefresh();
void lcdRefresh();
#if defined(PCBTARANIS)
const pm_char * bmpLoad(uint8_t *dest, const char *filename, const xcoord_t width, const uint8_t height);
const pm_char * bmpLoad(uint8_t *dest, const char *filename, const xcoord_t width, const uint8_t height);
#endif
#define BLINK_ON_PHASE (g_blinkTmr10ms & (1<<6))
#ifdef SIMU
extern bool lcd_refresh;
extern uint8_t lcd_buf[DISPLAY_BUF_SIZE];
extern bool lcd_refresh;
extern uint8_t lcd_buf[DISPLAY_BUF_SIZE];
#endif
#define LCD_BYTE_FILTER_PLAN(p, keep, add) *(p) = (*(p) & (keep)) | (add)