Subversion Repositories dashGPS

Rev

Rev 7 | Rev 9 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include "main.h"
  2. #include "libOLED/stm32_halDisplay.H"
  3. #include "libOLED/fontclass.H"
  4. #include "libOLED/displayDial.H"
  5.  
  6. namespace
  7. {
  8.   int const WIDTH = 128;
  9.   int const HEIGHT = 64;
  10.   int const DISPLAY_RAMWIDTH = 132;
  11.  
  12. }
  13.  
  14. uint8_t displayBuffer[dataSize (WIDTH, HEIGHT)];
  15.  
  16. stm32_halDisplay_t display1 (WIDTH, HEIGHT, DISPLAY_RAMWIDTH, displayBuffer,
  17.                              &hspi1,
  18.  
  19.                              SPI_CD_GPIO_Port,
  20.                              SPI_CD_Pin,
  21.                              SPI_RESET_GPIO_Port,
  22.                              SPI_RESET_Pin,
  23.                              SPI_NSS1_GPIO_Port,
  24.                              SPI_NSS1_Pin);
  25.  
  26.  
  27. displayDial_t  dial (64, 64, 64);
  28. int cnt = 0;
  29.  
  30.  
  31. extern "C" void
  32. cc_init ()
  33. {
  34.   display1.init();
  35.   display1.clearDisplay ();
  36.  
  37.   dial.draw_scale (display1, 0 , 10 , 4, 15 ,2);
  38.  
  39.   display1.display ();
  40. }
  41.  
  42.  
  43. extern "C" void
  44. cc_run()
  45. {
  46.          if(cnt==0)
  47.            display1.clearDisplay();
  48.  
  49.          display1.gotoxy(0,8);
  50.          display1.printString(small_font,"ABCDabcd",8,WHITE);
  51.  
  52.          display1.gotoxy(0,16);
  53.          display1.printScaledString(small_font,"ABCD1234",8,128
  54.                                       ,WHITE);
  55.  
  56.          display1.gotoxy(0,48);
  57.          display1.printScaledString(large_font,"ABCD1234",8,256
  58.                               ,WHITE);
  59.                  display1.drawLine(96,cnt,127,cnt,WHITE);
  60.          display1.display();
  61.          cnt++;
  62.          cnt%=64;
  63. }
  64.