Merge remote-tracking branch 'upstream/develop' into xap

This commit is contained in:
Nick Brassel 2022-05-16 09:51:49 +10:00
commit 484ec12397
9 changed files with 49 additions and 18 deletions

View File

@ -49,6 +49,6 @@ led_config_t g_led_config = { {
{ 113, 64 }, { 132, 64 }, { 150, 64 }, { 169, 64 }, { 187, 64 }, { 206, 64 }, { 224, 64 },
}, {
// LED Index to Flag
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
} };
#endif

View File

@ -53,7 +53,14 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
led_config_t g_led_config = {
// Key Matrix to LED Index
{
{},
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
}, {
// LED Index to Physical Position. The unit is roughly milimiters in the real world
// | Left || Right |

View File

@ -21,7 +21,12 @@
#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
{ }
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
}, {
{152, 0}, {165, 0}, {190, 0}, {205, 0},
{224, 21}, {224, 43}, {224, 54},

View File

@ -25,7 +25,7 @@ led_config_t g_led_config = { {
{ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, NO_LED,72, 73},
{ 83, 82, 81, NO_LED, NO_LED, 80, NO_LED, NO_LED, 79, 78, 77, 76, NO_LED,75 ,74}
}, {
{0, 0}, {14.9, 0}, {14.9*2, 0},{14.9*3, 0}, {14.9*4, 0}, {14.9*5, 0}, {14.9*6, 0}, {14.9*7, 0}, {14.9*8, 0}, {14.9*9, 0}, {14.9*10, 0}, {14.9*11, 0}, {14.9*12, 0}, {14.9*13, 0}, {14.9*14, 0}, {224, 0},
{0, 0}, {15, 0}, {30, 0},{45, 0}, {60, 0}, {75, 0}, {90, 0}, {105, 0}, {120, 0}, {135, 0}, {150, 0}, {165, 0}, {180, 0}, {195, 0}, {210, 0}, {224, 0},
{224, 12.8}, {218, 12.8},{192, 12.8},{176, 12.8},{160, 12.8},{144, 12.8},{128, 12.8},{112, 12.8},{96, 12.8},{80, 12.8},{64, 12.8},{48, 12.8},{32, 12.8},{16, 12.8},{0, 12.8},
{0, 25.6},{16, 25.6}, {32, 25.6}, {48, 25.6}, {64, 25.6}, {80, 25.6}, {96, 25.6}, {112, 25.6}, {128, 25.6}, {144, 25.6}, {160, 25.6},{176, 25.6}, {192, 25.6}, {218, 25.6}, {224, 25.6},
{224, 38.4},{200, 38.4},{176, 38.4},{160, 38.4},{144, 38.4},{128, 38.4},{112, 38.4},{96, 38.4},{80, 38.4},{64, 38.4},{48, 38.4},{32, 38.4},{16, 38.4},{0, 38.4},

View File

@ -18,7 +18,12 @@
#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
{ 0, 1, 2 }
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
}, {
//Key matrix (0 -> 2)
{224, 0}, {0 , 0}, {6 , 38},

View File

@ -17,9 +17,12 @@
#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 16, 17, 18, 19, 20 }
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
}, {
{ 105, 60 }, { 70, 60 }, { 35, 60 }, { 0, 60 }, { 0, 40 }, { 0, 20 }, { 0, 0 }, { 42, 0 }, { 84, 0 }, { 126, 0 }, { 168, 0 }, { 210, 0 }, { 210, 20 }, { 210, 40 }, { 40, 20 }, { 120, 20 }, { 40, 40 }, { 120, 40 }, { 210, 60 }, { 175, 60 },{ 140, 60 }
}, {

View File

@ -82,15 +82,15 @@ led_config_t g_led_config = { {
{ 14, 15, 16, 17, 18, 19, 20 },
{ 27, 26, 25, 24, 23, 22, 21 },
{ 28, 29, 30, 31, 32, 33, 34 },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ 49, 50, 51, 52, 53, 54, 55 },
{ 62, 61, 60, 59, 58, 57, 56 },
{ 63, 64, 65, 66, 67, 68, 69 },
{ 76, 75, 74, 73, 72, 71, 70 },
{ 77, 78, 79, 80, 81, 82, 83 },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
}, {
{ 16, 16},{ 34, 16},{ 49, 16},{ 64, 16},{ 79, 16},{ 94, 16},{ 109, 16},
{ 109, 31},{ 94, 31},{ 79, 31},{ 64, 31},{ 49, 31},{ 34, 31},{ 16, 31},

View File

@ -197,6 +197,8 @@ def _coerce_led_token(_type, value):
}
if _type is Token.Literal.Number.Integer:
return int(value)
if _type is Token.Literal.Number.Float:
return float(value)
if _type is Token.Literal.Number.Hex:
return int(value, 0)
if _type is Token.Name and value in value_map.keys():
@ -233,7 +235,7 @@ def _parse_led_config(file, matrix_cols, matrix_rows):
bracket_count -= 1
else:
# Assume any non whitespace value here is important enough to stash
if _type in [Token.Literal.Number.Integer, Token.Literal.Number.Hex, Token.Name]:
if _type in [Token.Literal.Number.Integer, Token.Literal.Number.Float, Token.Literal.Number.Hex, Token.Name]:
if section == 1 and bracket_count == 3:
matrix_raw.append(_coerce_led_token(_type, value))
if section == 2 and bracket_count == 3:

View File

@ -15,20 +15,21 @@ def _gen_led_config(info_data):
cols = info_data['matrix_size']['cols']
rows = info_data['matrix_size']['rows']
led_config = None
config_type = None
if 'layout' in info_data.get('rgb_matrix', {}):
led_config = info_data['rgb_matrix']['layout']
config_type = 'rgb_matrix'
elif 'layout' in info_data.get('led_matrix', {}):
led_config = info_data['led_matrix']['layout']
config_type = 'led_matrix'
lines = []
if not led_config:
if not config_type:
return lines
matrix = [['NO_PIN'] * cols for i in range(rows)]
matrix = [['NO_LED'] * cols for i in range(rows)]
pos = []
flags = []
led_config = info_data[config_type]['layout']
for index, item in enumerate(led_config, start=0):
if 'matrix' in item:
(x, y) = item['matrix']
@ -36,6 +37,13 @@ def _gen_led_config(info_data):
pos.append(f'{{ {item.get("x", 0)},{item.get("y", 0)} }}')
flags.append(str(item.get('flags', 0)))
if config_type == 'rgb_matrix':
lines.append('#ifdef RGB_MATRIX_ENABLE')
lines.append('#include "rgb_matrix.h"')
elif config_type == 'led_matrix':
lines.append('#ifdef LED_MATRIX_ENABLE')
lines.append('#include "led_matrix.h"')
lines.append('__attribute__ ((weak)) led_config_t g_led_config = {')
lines.append(' {')
for line in matrix:
@ -44,6 +52,7 @@ def _gen_led_config(info_data):
lines.append(f' {{ {",".join(pos)} }},')
lines.append(f' {{ {",".join(flags)} }},')
lines.append('};')
lines.append('#endif')
return lines