Modified Bob Stone's code for ILI9341 QVGA TFT's without touch capability. Navigation is now done with rotary encoders - two for position, & one setting the maxiterations.
Dependencies: SPI_TFT_ILI9341 TFT_fonts mbed
Fork of Mandelbrot by
Should have mentioned in the above: Encoder code is specific to the STM32F4, tested on Nucleo F401, should work on the Nucleo F411..
Revision 3:267e7130007d, committed 2015-01-22
- Comitter:
- gregeric
- Date:
- Thu Jan 22 10:01:49 2015 +0000
- Parent:
- 2:b1169b84a563
- Commit message:
- Increase debounce time, shown necessary after round of testing.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b1169b84a563 -r 267e7130007d main.cpp --- a/main.cpp Tue Jan 20 15:10:25 2015 +0000 +++ b/main.cpp Thu Jan 22 10:01:49 2015 +0000 @@ -56,7 +56,7 @@ #define maxiters (MINITERS+TIM4->CNT) uint16_t lastiters=MINITERS; -enum nextaction { +enum nextaction_t { idle=0, zoomin, zoomout, @@ -64,7 +64,7 @@ interrupted }; -enum nextaction buttonpressed; +nextaction_t buttonpressed; void GotZoomIn(void) { @@ -302,7 +302,7 @@ //log status @ PC serial port printf("%1.18f%+1.18fi, %+d, %d\n\r", centrex, -centrey, log2zoom, maxiters); - wait(0.2); //debounce + wait(0.3); //debounce buttonpressed=idle; UpdateStats(); @@ -311,7 +311,7 @@ tt.set_orientation(ORIENTATION); DrawMandelbrot(); - wait(0.2); //debounce + wait(0.3); //debounce //flag that we should update status bar, but not commence new render if (buttonpressed) buttonpressed=interrupted; @@ -331,8 +331,10 @@ if (shiftx!=lastshiftx || shifty!=lastshifty || maxiters!=lastiters) break; } - EraseCursor(WIDTH/2+lastshiftx, HEIGHT/2+lastshifty); - DrawCursor(WIDTH/2+shiftx, HEIGHT/2+shifty); + if(maxiters==lastiters) { //we're here cos cursor moved (speeds up redraw when twiddling maxiter knob + EraseCursor(WIDTH/2+lastshiftx, HEIGHT/2+lastshifty); + DrawCursor(WIDTH/2+shiftx, HEIGHT/2+shifty); + } lastshiftx=shiftx; lastshifty=shifty;