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.

35 lines
705 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. lcd_t* demo_init()
  13. {
  14. setbuf(stdout, NULL);
  15. srand(time(NULL));
  16. wiringPiSetup();
  17. return lcd_init(40000000, 1, 10, 7, 8);
  18. }
  19. void demo_deinit(lcd_t* lcd)
  20. {
  21. printf("...waiting 2 seconds before shutdown...\n");
  22. sleep(2);
  23. printf("Terminating...\n");
  24. lcd_fillScreen(lcd, 0, 0, 0);
  25. lcd_deinit(lcd);
  26. printf("DONE\n");
  27. }