Define a new RAW ADC type for hidden ADC channels for customize driver use
This commit is contained in:
committed by
Malte Langermann
parent
a8b3525cd6
commit
6db25b324b
@@ -3,6 +3,7 @@ from pot_config import pot_cfg_by_target
|
||||
MAX_POTS = 4
|
||||
MAX_SLIDERS = 4
|
||||
MAX_EXTS = 4
|
||||
MAX_RAWS = 4
|
||||
|
||||
|
||||
def eprint(*args, **kwargs):
|
||||
@@ -14,6 +15,7 @@ class ADCInput:
|
||||
TYPE_STICK = 'STICK'
|
||||
TYPE_FLEX = 'FLEX'
|
||||
TYPE_SWITCH = 'SWITCH'
|
||||
TYPE_RAW = 'RAW'
|
||||
# TYPE_BATT = 'BATT'
|
||||
|
||||
def __init__(self, name, adc_input_type, adc, gpio, pin, channel):
|
||||
@@ -76,6 +78,12 @@ class ADCInputParser:
|
||||
'suffix': 'EXT{}',
|
||||
'name': 'EXT{}',
|
||||
},
|
||||
{
|
||||
'range': range(1, MAX_RAWS + 1),
|
||||
'type': ADCInput.TYPE_RAW,
|
||||
'suffix': 'RAW{}',
|
||||
'name': 'RAW{}',
|
||||
},
|
||||
{
|
||||
'range': range(1, 2 + 1),
|
||||
'type': ADCInput.TYPE_FLEX,
|
||||
|
||||
@@ -21,7 +21,16 @@ static const etx_hal_adc_input_t _flex_inputs[] = {
|
||||
{% endfor %}
|
||||
};
|
||||
|
||||
{% set vbat_offset = flex_offset + n_flex %}
|
||||
{% set raw_offset = flex_offset + n_flex %}
|
||||
{% set raw_inputs = adc_inputs.inputs | selectattr('type', '==', 'RAW') | list %}
|
||||
{% set n_raw = raw_inputs | count %}
|
||||
static const etx_hal_adc_input_t _raw_inputs[] = {
|
||||
{% for input in raw_inputs %}
|
||||
{ "{{ input.name }}", "{{ input.label }}", "{{ input.short_label }}" },
|
||||
{% endfor %}
|
||||
};
|
||||
|
||||
{% set vbat_offset = raw_offset + n_raw %}
|
||||
{% set vbat_inputs = adc_inputs.inputs | selectattr('type', '==', 'VBAT') | list %}
|
||||
{% set n_vbat = vbat_inputs | count %}
|
||||
static const etx_hal_adc_input_t _vbat_inputs[] = {
|
||||
|
||||
Reference in New Issue
Block a user