2020-08-02 21:32:02 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <wiringPi.h>
|
|
|
|
#include "spilcd.h"
|
|
|
|
#include "spilcd_gfx.h"
|
|
|
|
#include "base.h"
|
|
|
|
|
|
|
|
inline uint8 random_color_r(int seed) { return seed % (256 / 7) * 7; }
|
|
|
|
inline uint8 random_color_g(int seed) { return seed % (256 / 13) * 13; }
|
|
|
|
inline uint8 random_color_b(int seed) { return seed % (256 / 23) * 23; }
|
|
|
|
|
2021-03-24 12:31:07 +00:00
|
|
|
extern void lcd_setOrientation(lcd_t*, int);
|
|
|
|
|
2020-08-02 21:32:02 +00:00
|
|
|
lcd_t* demo_init()
|
|
|
|
{
|
|
|
|
setbuf(stdout, NULL);
|
|
|
|
srand(time(NULL));
|
|
|
|
|
|
|
|
wiringPiSetup();
|
|
|
|
|
2021-03-24 12:31:07 +00:00
|
|
|
lcd_t* lcd = lcd_init(40000000, 1, 15, 7, 8);
|
|
|
|
|
|
|
|
lcd_setOrientation(lcd, 2);
|
|
|
|
|
|
|
|
return lcd;
|
2020-08-02 21:32:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void demo_deinit(lcd_t* lcd)
|
|
|
|
{
|
|
|
|
printf("...waiting 2 seconds before shutdown...\n");
|
|
|
|
sleep(2);
|
|
|
|
|
|
|
|
printf("Terminating...\n");
|
|
|
|
lcd_fillScreen(lcd, 0, 0, 0);
|
|
|
|
lcd_deinit(lcd);
|
|
|
|
printf("DONE\n");
|
|
|
|
}
|
|
|
|
|