[ACT] Navigation & Menus

This commit is contained in:
bsongis
2013-01-15 18:22:54 +00:00
parent 9537c3f940
commit 3a852e9be1
49 changed files with 832 additions and 674 deletions
+40 -40
View File
@@ -46,7 +46,7 @@ void lcd_clear()
void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att)
{
const pm_uchar *q = img;
#if LCD >= 260
#if LCD_W >= 260
xcoord_t w = pgm_read_byte(q++);
if (w == 255) w += pgm_read_byte(q++);
#else
@@ -56,7 +56,7 @@ void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false);
q += idx*w*hb;
for (uint8_t yb = 0; yb < hb; yb++) {
uint8_t *p = &displayBuf[ (y / 8 + yb) * DISPLAY_W + x ];
uint8_t *p = &displayBuf[ (y / 8 + yb) * LCD_W + x ];
for (xcoord_t i=0; i<w; i++){
uint8_t b = pgm_read_byte(q++);
ASSERT_IN_DISPLAY(p);
@@ -98,9 +98,9 @@ uint8_t lcdLastPos;
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
{
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
#if defined(PCBX9D)
#if defined(CPUARM)
const pm_uchar *q = (c < 0xC0) ? &font_5x7[(c-0x20)*5+4] : &font_5x7_extra[(c-0xC0)*5+4];
#else
const pm_uchar *q = &font_5x7[(c-0x20)*5+4];
@@ -134,16 +134,16 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
b1 = ~b1;
b2 = ~b2;
}
if(&p[DISPLAY_W+1] < DISPLAY_END) {
if(&p[LCD_W+1] < DISPLAY_END) {
ASSERT_IN_DISPLAY(p);
ASSERT_IN_DISPLAY(p+DISPLAY_W);
ASSERT_IN_DISPLAY(p+LCD_W);
LCD_BYTE_FILTER(p, 0, b1);
LCD_BYTE_FILTER(p+DISPLAY_W, 0, b2);
LCD_BYTE_FILTER(p+LCD_W, 0, b2);
p++;
}
}
}
#if defined(PCBX9D)
#if defined(CPUARM)
else if (flags & MIDSIZE) {
/* each letter consists of ten top bytes followed by
* by ten bottom bytes (20 bytes per * char) */
@@ -160,15 +160,15 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
b2 = ~b2;
}
uint8_t ym8 = (y % 8);
if (&p[DISPLAY_W+1] < DISPLAY_END) {
if (&p[LCD_W+1] < DISPLAY_END) {
LCD_BYTE_FILTER(p, ~(0xff << ym8), b1 << ym8);
uint8_t *r = p + DISPLAY_W;
uint8_t *r = p + LCD_W;
if (r<DISPLAY_END) {
if (ym8)
LCD_BYTE_FILTER(r, ~(0xff >> (8-ym8)), b1 >> (8-ym8));
LCD_BYTE_FILTER(r, ~(0x0f << ym8), (b2&0x0f) << ym8);
if (ym8) {
r = r + DISPLAY_W;
r = r + LCD_W;
if (r<DISPLAY_END)
LCD_BYTE_FILTER(r, ~(0x0f >> (8-ym8)), (b2&0x0f) >> (8-ym8));
}
@@ -187,7 +187,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
if (p<DISPLAY_END) {
LCD_BYTE_FILTER(p, ~(0x7f << ym8), b << ym8);
if (ym8) {
uint8_t *r = p + DISPLAY_W;
uint8_t *r = p + LCD_W;
if (r<DISPLAY_END)
LCD_BYTE_FILTER(r, ~(0x7f >> (8-ym8)), b >> (8-ym8));
}
@@ -205,7 +205,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
if (p<DISPLAY_END) {
LCD_BYTE_FILTER(p, ~(0x3f << ym8), b << ym8);
if (ym8) {
uint8_t *r = p + DISPLAY_W;
uint8_t *r = p + LCD_W;
if (r<DISPLAY_END)
LCD_BYTE_FILTER(r, ~(0x3f >> (8-ym8)), b >> (8-ym8));
}
@@ -236,7 +236,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
if (p<DISPLAY_END) {
LCD_BYTE_FILTER(p, ~(0xff << ym8), b << ym8);
if (ym8) {
uint8_t *r = p + DISPLAY_W;
uint8_t *r = p + LCD_W;
if (r<DISPLAY_END)
LCD_BYTE_FILTER(r, ~(0xff >> (8-ym8)), b >> (8-ym8));
}
@@ -282,9 +282,9 @@ void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlag
c = pgm_read_byte(s);
break;
}
if (!c || x>DISPLAY_W-6) break;
if (!c || x>LCD_W-6) break;
if (c >= 0x20) {
#if defined(PCBX9D)
#if defined(CPUARM)
if ((mode & MIDSIZE) && ((c>='a'&&c<='z')||(c>='0'&&c<='9'))) {
lcd_putcAtt(x, y, c, mode);
x-=1;
@@ -304,7 +304,7 @@ void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlag
len--;
}
lcdLastPos = x;
#if defined(PCBX9D)
#if defined(CPUARM)
if (mode&MIDSIZE)
lcdLastPos += 1;
#endif
@@ -358,7 +358,7 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags flags, uint8_t
uint8_t fw = FWNUM;
int8_t mode = MODE(flags);
bool dblsize = flags & DBLSIZE;
#if defined(PCBX9D)
#if defined(CPUARM)
bool midsize = flags & MIDSIZE;
bool tinsize = flags & TINSIZE;
#else
@@ -526,17 +526,17 @@ void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att)
{
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
if (p<DISPLAY_END)
lcd_mask(p, BITMASK(y%8), att);
}
void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att)
{
if (y >= DISPLAY_H) return;
if (x+w > DISPLAY_W) { w = DISPLAY_W - x; }
if (y >= LCD_H) return;
if (x+w > LCD_W) { w = LCD_W - x; }
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
uint8_t msk = BITMASK(y%8);
while(w) {
if(pat&1) {
@@ -559,31 +559,31 @@ void lcd_hline(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att)
#if defined(PCBSTD)
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat)
{
if (x >= DISPLAY_W) return;
if (x >= LCD_W) return;
if (h<0) { y+=h; h=-h; }
if (y<0) { h+=y; y=0; }
if (y+h > DISPLAY_H) { h = DISPLAY_H - y; }
if (y+h > LCD_H) { h = LCD_H - y; }
if (pat==DOTTED && !(y%2))
pat = ~pat;
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
y = y % 8;
if (y) {
ASSERT_IN_DISPLAY(p);
*p ^= ~(BITMASK(y)-1) & pat;
p += DISPLAY_W;
p += LCD_W;
h -= 8-y;
}
while (h>0) {
ASSERT_IN_DISPLAY(p);
*p ^= pat;
p += DISPLAY_W;
p += LCD_W;
h -= 8;
}
if (h < 0) h += 8;
if (h) {
p -= DISPLAY_W;
p -= LCD_W;
ASSERT_IN_DISPLAY(p);
*p ^= ~(BITMASK(h)-1) & pat;
}
@@ -592,15 +592,15 @@ void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat)
// allows the att parameter...
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att)
{
if (x >= DISPLAY_W) return;
if (x >= LCD_W) return;
if (h<0) { y+=h; h=-h; }
if (y<0) { h+=y; y=0; }
if (y+h > DISPLAY_H) { h = DISPLAY_H - y; }
if (y+h > LCD_H) { h = LCD_H - y; }
if (pat==DOTTED && !(y%2))
pat = ~pat;
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
y = y % 8;
if (y) {
ASSERT_IN_DISPLAY(p);
@@ -609,12 +609,12 @@ void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att)
if (h < 0)
msk -= ~(BITMASK(8+h)-1);
lcd_mask(p, msk & pat, att);
p += DISPLAY_W;
p += LCD_W;
}
while (h>=8) {
ASSERT_IN_DISPLAY(p);
lcd_mask(p, pat, att);
p += DISPLAY_W;
p += LCD_W;
h -= 8;
}
if (h>0) {
@@ -641,15 +641,15 @@ void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat, LcdFlag
void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat, LcdFlags att)
{
for (int8_t i=y; i<y+h; i++) {
if (i>=0 && i<DISPLAY_H) lcd_hlineStip(x, i, w, pat, att);
if (i>=0 && i<LCD_H) lcd_hlineStip(x, i, w, pat, att);
pat = (pat >> 1) + ((pat & 1) << 7);
}
}
void lcd_invert_line(int8_t y)
{
uint8_t *p = &displayBuf[y * DISPLAY_W];
for (xcoord_t x=0; x<DISPLAY_W; x++) {
uint8_t *p = &displayBuf[y * LCD_W];
for (xcoord_t x=0; x<LCD_W; x++) {
ASSERT_IN_DISPLAY(p);
#if defined(PCBX9D)
*(p+3*DISPLAY_PLAN_SIZE) ^= 0xff;
@@ -673,7 +673,7 @@ void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2
qr = div(tme, 60);
#if defined(PCBX9D)
#if defined(CPUARM)
if (att & MIDSIZE) {
div_t qr2 = div(qr.quot, 60);
LCD_2DOTS(x+2*8-6, y, att);
@@ -705,7 +705,7 @@ void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2
x3 = x+2*FWNUM-1+FW;
}
#if defined(PCBX9D)
#if defined(CPUARM)
if (att&MIDSIZE) {
LCD_2DOTS(x2, y, att);
}
@@ -751,7 +751,7 @@ void putsChnRaw(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att)
void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att)
{
#if defined(PCBX9D)
#if defined(PCBX9D) || defined(PCBACT)
if (idx<=NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+NUM_STICKS+1+NUM_SW_SRCRAW)
putsChnRaw(x, y, idx, att);
else if (idx<=NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+NUM_STICKS+1+NUM_SW_SRCRAW+NUM_CSW)
@@ -872,7 +872,7 @@ void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags at
#if defined(ROTARY_ENCODERS)
void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att)
{
#if defined(EXTRA_ROTARY_ENCODERS)
#if ROTARY_ENCODERS > 2
int16_t v;
if(idx < (NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA))
v = phaseaddress(phase)->rotaryEncoders[idx];