linux-st7735/demo/base.c
2020-08-02 21:32:02 +00:00

35 lines
705 B
C

#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; }
lcd_t* demo_init()
{
setbuf(stdout, NULL);
srand(time(NULL));
wiringPiSetup();
return lcd_init(40000000, 1, 10, 7, 8);
}
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");
}