LED setup via devicetree

- New charlieplexing-leds binding
- board.dts files updated
- Pin and LED setup removed from pinmux.c and board.h files
This commit is contained in:
Martin Jäger
2020-07-23 17:34:41 +02:00
parent a584904470
commit 27cdcb3bf6
24 changed files with 345 additions and 374 deletions
-25
View File
@@ -30,31 +30,6 @@
// Values that are otherwise defined by Kconfig
#define CONFIG_CONTROL_FREQUENCY 10 // Hz
enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT };
// assignment LED numbers on PCB to their meaning
#define NUM_LEDS 5
#define LED_SOC_1 0 // LED1
#define LED_SOC_2 1 // LED2
#define LED_SOC_3 2 // LED3
#define LED_LOAD 3 // LED4
#define LED_RXTX 4 // LED5, used to indicate when sending data
// LED pins and pin state configuration to switch above LEDs on
#define NUM_LED_PINS 3
static const int led_pins[NUM_LED_PINS] = {
// A B C
0, 0, 0
};
static const enum pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = {
{ PIN_HIGH, PIN_LOW, PIN_FLOAT }, // LED1
{ PIN_LOW, PIN_HIGH, PIN_FLOAT }, // LED2
{ PIN_HIGH, PIN_FLOAT, PIN_LOW }, // LED3
{ PIN_FLOAT, PIN_HIGH, PIN_LOW }, // LED4
{ PIN_FLOAT, PIN_LOW, PIN_HIGH } // LED5
};
// pin definition only needed in adc_dma.cpp to detect if they are present on the PCB
#define PIN_ADC_TEMP_BAT
+18
View File
@@ -32,6 +32,9 @@
#define DT_N_S_outputs_S_usb_pwr_EXISTS 1
/*
* ADC
*/
#define DT_N_S_adc_inputs_S_temp_bat_EXISTS 1
#define DT_N_S_adc_inputs_S_v_high_P_multiplier 105600
@@ -60,3 +63,18 @@
fn(DT_N_S_adc_inputs_S_temp_bat) \
fn(DT_N_S_adc_inputs_S_vref_mcu) \
fn(DT_N_S_adc_inputs_S_temp_mcu)
/*
* LEDs
*/
#define DT_N_S_leds_FOREACH_CHILD(fn) \
fn(DT_N_S_leds_S_pwr)
#define DT_N_S_leds_P_gpios_IDX_0_PH DT_N_S_soc_S_pin_controller_48000000_S_gpio_48000800
#define DT_N_S_leds_P_gpios_IDX_0_VAL_pin 15
#define DT_N_S_leds_P_gpios_LEN 1
#define DT_N_S_soc_S_pin_controller_48000000_S_gpio_48000800_P_label "GPIOC"
#define DT_N_S_leds_S_pwr_EXISTS 1
#define DT_N_S_leds_S_pwr_P_states {1 /* 0x1 */}