mirror of
https://github.com/whowechina/aic_pico.git
synced 2024-11-28 07:20:49 +01:00
AIC Touch demo run
This commit is contained in:
parent
7f80fb2036
commit
daf4e76dbf
@ -36,6 +36,10 @@
|
||||
#include "light.h"
|
||||
#include "keypad.h"
|
||||
|
||||
#include "st7789.h"
|
||||
#include "cst816t.h"
|
||||
#include "conthrax.h"
|
||||
|
||||
#define DEBUG(...) if (aic_runtime.debug) printf(__VA_ARGS__)
|
||||
|
||||
static struct {
|
||||
@ -121,13 +125,51 @@ static void light_mode_update()
|
||||
was_cardio = cardio;
|
||||
}
|
||||
|
||||
static void disp_loop()
|
||||
{
|
||||
static uint16_t phase = 0;
|
||||
phase = (phase + 1) % 256;
|
||||
for (int i = 0; i < 240; i++) {
|
||||
st7789_vline(i, 0, 320,
|
||||
st7789_rgb565(rgb32_from_hsv(phase + i, 255, 128)), 0xc0);
|
||||
}
|
||||
|
||||
static struct {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
char c;
|
||||
} signs[] = {
|
||||
{24, 26, '7'},
|
||||
{104, 26, '8'},
|
||||
{184, 26, '9'},
|
||||
{24, 96, '4'},
|
||||
{104, 96, '5'},
|
||||
{184, 96, '6'},
|
||||
{24, 166, '1'},
|
||||
{104, 166, '2'},
|
||||
{184, 166, '3'},
|
||||
{24, 236, '0'},
|
||||
{104, 236, ':'},
|
||||
{184, 236, ';'},
|
||||
};
|
||||
|
||||
uint32_t color = rgb32_from_hsv(time_us_32() / 100000, 200, 200);
|
||||
for (int i = 0; i < 12; i++) {
|
||||
st7789_char(signs[i].x + 2, signs[i].y + 2, signs[i].c, &lv_conthrax, 0x0);
|
||||
st7789_char(signs[i].x, signs[i].y, signs[i].c, &lv_conthrax, st7789_rgb565(color));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static mutex_t core1_io_lock;
|
||||
static void core1_loop()
|
||||
{
|
||||
while (1) {
|
||||
if (mutex_try_enter(&core1_io_lock, NULL)) {
|
||||
if (aic_runtime.touch) {
|
||||
/* touch screen related things */
|
||||
st7789_dimmer(aic_cfg->lcd.backlight);
|
||||
disp_loop();
|
||||
st7789_render(true);
|
||||
}
|
||||
light_update();
|
||||
mutex_exit(&core1_io_lock);
|
||||
@ -377,7 +419,12 @@ void init()
|
||||
bana_init(cdc_reader_putc);
|
||||
|
||||
if (aic_runtime.touch) {
|
||||
/* touch screen related things */
|
||||
cst816t_init_i2c(i2c1, 3, 2);
|
||||
cst816t_init(i2c1, 5, 4);
|
||||
cst816t_crop(10, 230, 35, 250, 240, 280);
|
||||
st7789_init_spi(spi1, 10, 11, 9);
|
||||
st7789_init(spi1, 8, 7, 0);
|
||||
st7789_crop(0, 20, 240, 280, true);
|
||||
}
|
||||
|
||||
cli_init("aic_pico>", "\n << AIC Pico >>\n"
|
||||
|
Loading…
Reference in New Issue
Block a user