void mandelUpdate() { int xmin,xmax,ymin,ymax; if (mandel.dirty) { xmin = 0; xmax = RESX; ymin = 0; ymax = RESY; mandel.dirty = false; } else if (mandel.dleft) { lcdShift(-1,0,false); xmin = 0; xmax = 1; ymin = 0; ymax = RESY; mandel.dleft = false; } else if (mandel.dright) { lcdShift(1,0,false); xmin = RESX-1; xmax = RESX; ymin = 0; ymax = RESY; mandel.dright = false; } else if (mandel.dup) { lcdShift(0,-1,false); xmin=0; xmax=RESX; ymin=0; ymax=1; mandel.dup = false; } else if (mandel.ddown) { lcdShift(0,1,false); xmin=0; xmax=RESX; ymin=RESY-1; ymax=RESY; mandel.ddown = false; } else { return; } for (int x = xmin; x<xmax; x++) { for (int y = ymin; y<ymax; y++) { mandelPixel(x,y); } } }
void spectrum_callback(uint8_t* buf, int bufLen) { TOGGLE(LED2); if (displayMode == MODE_SPECTRUM) lcdClear(); else if (displayMode == MODE_WATERFALL) lcdShift(0,1,0); for(int i = 0; i < 128; i++) // display 128 FFT magnitude points { // FFT unwrap: uint8_t v; if(i < 64) // negative frequencies v = buf[(bufLen/2)+64+i]; else // positive frequencies v = buf[i-64]; // fill display if (displayMode == MODE_SPECTRUM) { for(int j = 0; j < (v/2); j++) lcdBuffer[i+RESX*(RESY-j)] = 0x00; } else if (displayMode == MODE_WATERFALL) { lcdSetPixel(i,RESY-1,v); } } // text info lcdSetCrsr(0,0); lcdPrint("f="); lcdPrint(IntToStr(freq/1000000,4,F_LONG)); lcdPrintln("MHz "); lcdPrintln("-5MHz 0 +5MHz"); lcdDisplay(); }
static void checkScroll(void){ if(y+font->u8Height>RESY){ lcdShift(0,y+font->u8Height-RESY,false); y=RESY-font->u8Height; }; }