mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-02-02 14:31:13 +00:00
Make LED animation on mist 1.3+ optional
This commit is contained in:
@@ -34,7 +34,8 @@ mist_cfg_t mist_cfg = {
|
||||
.keyrah_mode = 0,
|
||||
.reset_combo = 0,
|
||||
.ypbpr = 0,
|
||||
.keep_video_mode = 0
|
||||
.keep_video_mode = 0,
|
||||
.led_animation = 0
|
||||
};
|
||||
|
||||
// mist ini sections
|
||||
@@ -44,6 +45,7 @@ const ini_section_t mist_ini_sections[] = {
|
||||
|
||||
// mist ini vars
|
||||
const ini_var_t mist_ini_vars[] = {
|
||||
{"LED_ANIMATION", (void*)(&(mist_cfg.led_animation)), UINT8, 0, 1, 1},
|
||||
{"YPBPR", (void*)(&(mist_cfg.ypbpr)), UINT8, 0, 1, 1},
|
||||
{"KEEP_VIDEO_MODE", (void*)(&(mist_cfg.keep_video_mode)), UINT8, 0, 1, 1},
|
||||
{"KEYRAH_MODE", (void*)(&(mist_cfg.keyrah_mode)), UINT32, 0, 0xFFFFFFFF, 1},
|
||||
|
||||
@@ -23,6 +23,7 @@ typedef struct {
|
||||
uint8_t reset_combo;
|
||||
uint8_t ypbpr;
|
||||
uint8_t keep_video_mode;
|
||||
uint8_t led_animation;
|
||||
} mist_cfg_t;
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "max3421e.h"
|
||||
#include "timer.h"
|
||||
#include "spi.h"
|
||||
#include "mist_cfg.h"
|
||||
|
||||
void max3421e_write_u08(uint8_t reg, uint8_t data) {
|
||||
// iprintf("write %x %x\n", reg, data);
|
||||
@@ -150,26 +151,30 @@ void max3421e_init() {
|
||||
uint8_t max3421e_poll() {
|
||||
uint8_t hirq = max3421e_read_u08( MAX3421E_HIRQ );
|
||||
|
||||
static msec_t next = 0;
|
||||
if(timer_get_msec() > next) {
|
||||
static uint8_t led_pattern = 0x01;
|
||||
|
||||
// iprintf("irq src=%x, bus state %x\n", hirq, vbusState);
|
||||
// iprintf("host result %x\n", max3421e_read_u08( MAX3421E_HRSL));
|
||||
// do LED animation on V1.3+ boards if enabled via cfg file
|
||||
if(mist_cfg.led_animation) {
|
||||
static msec_t next = 0;
|
||||
|
||||
max3421e_write_u08(MAX3421E_IOPINS2, ~(led_pattern & 0x0f));
|
||||
if(timer_get_msec() > next) {
|
||||
static uint8_t led_pattern = 0x01;
|
||||
|
||||
if(!(led_pattern & 0x10)) {
|
||||
// knight rider left
|
||||
led_pattern <<= 1;
|
||||
if(!(led_pattern & 0x0f)) led_pattern = 0x18;
|
||||
} else {
|
||||
// knight rider right
|
||||
led_pattern = ((led_pattern & 0x0f) >> 1) | 0x10;
|
||||
if(!(led_pattern & 0x0f)) led_pattern = 0x01;
|
||||
}
|
||||
// iprintf("irq src=%x, bus state %x\n", hirq, vbusState);
|
||||
// iprintf("host result %x\n", max3421e_read_u08( MAX3421E_HRSL));
|
||||
|
||||
max3421e_write_u08(MAX3421E_IOPINS2, ~(led_pattern & 0x0f));
|
||||
|
||||
if(!(led_pattern & 0x10)) {
|
||||
// knight rider left
|
||||
led_pattern <<= 1;
|
||||
if(!(led_pattern & 0x0f)) led_pattern = 0x18;
|
||||
} else {
|
||||
// knight rider right
|
||||
led_pattern = ((led_pattern & 0x0f) >> 1) | 0x10;
|
||||
if(!(led_pattern & 0x0f)) led_pattern = 0x01;
|
||||
}
|
||||
|
||||
next = timer_get_msec() + 100;
|
||||
next = timer_get_msec() + 100;
|
||||
}
|
||||
}
|
||||
|
||||
if( hirq & MAX3421E_CONDETIRQ ) {
|
||||
|
||||
Reference in New Issue
Block a user