You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
802 B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <unistd.h>
  5. #include <wiringPi.h>
  6. #include "spilcd.h"
  7. #include "spilcd_gfx.h"
  8. #include "base.h"
  9. inline uint8 random_color_r(int seed) { return seed % (256 / 7) * 7; }
  10. inline uint8 random_color_g(int seed) { return seed % (256 / 13) * 13; }
  11. inline uint8 random_color_b(int seed) { return seed % (256 / 23) * 23; }
  12. extern void lcd_setOrientation(lcd_t*, int);
  13. lcd_t* demo_init()
  14. {
  15. setbuf(stdout, NULL);
  16. srand(time(NULL));
  17. wiringPiSetup();
  18. lcd_t* lcd = lcd_init(30000000, 1, 15, 7, 8);
  19. lcd_setOrientation(lcd, 4);
  20. return lcd;
  21. }
  22. void demo_deinit(lcd_t* lcd)
  23. {
  24. printf("...waiting 2 seconds before shutdown...\n");
  25. sleep(2);
  26. printf("Terminating...\n");
  27. lcd_fillScreen(lcd, 0, 0, 0);
  28. lcd_deinit(lcd);
  29. printf("DONE\n");
  30. }