Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ function(AddHWGenTarget input template output)
COMMAND ${GEN_JSON} > ${output}
DEPENDS ${INPUT_JSON} ${TEMPLATE} ${GEN_PY_DEPS} ${CMAKE_BINARY_DIR}/CMakeCache.txt
)

add_custom_target(${template} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${output})
endfunction()

macro(AddHeadersSources)
Expand Down
41 changes: 24 additions & 17 deletions companion/src/firmwares/boardjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1226,32 +1226,39 @@ bool BoardJson::loadFile(Board::Type board, QString hwdefn, InputsTable * inputs
if (obj.value("display").isObject()) {
const QJsonObject &o = obj.value("display").toObject();

display.w = o.value("w").toInt();
display.h = o.value("h").toInt();
display.phys_w = o.value("phys_w").toInt();
display.phys_h = o.value("phys_h").toInt();
display.depth = o.value("depth").toInt();
display.color = o.value("color").toInt();
display.oled = o.value("oled").toInt();
display.backlight_color = o.value("backlight_color").toInt();
display.w = o.value("lcd_w").toInt();
display.h = o.value("lcd_h").toInt();
display.phys_w = o.value("lcd_phys_w").toInt();
display.phys_h = o.value("lcd_phys_h").toInt();
display.depth = o.value("lcd_depth").toInt();
display.color = display.depth == 16 ? 1 : 0;
display.oled = o.value("oled_screen").toBool();
Comment thread
pfeerick marked this conversation as resolved.
}

if (obj.value("custom_switches").isObject()) {
const QJsonObject &o = obj.value("custom_switches").toObject();
if (obj.value("backlight").isObject()) {
const QJsonObject &o = obj.value("backlight").toObject();

cfs.rgb_led = o.value("rgb_led").toInt();
cfs.groups = o.value("groups").toInt();
display.backlight_color = o.value("has_backlight_color").toBool();
}

if (obj.value("leds").isObject()) {
const QJsonObject &o = obj.value("leds").toObject();

int cfs_led_strip_length = o.value("cfs_led_strip_length").toInt();
int cfs_leds_per_switch = o.value("cfs_leds_per_switch").toInt();
cfs.groups = cfs_leds_per_switch ? cfs_led_strip_length / (2 * cfs_leds_per_switch) : 0;
cfs.rgb_led = cfs.groups > 0;
hardware.has_bling_leds = o.value("bling_led_strip_length").toInt();
}

if (obj.value("hardware").isObject()) {
const QJsonObject &o = obj.value("hardware").toObject();

hardware.has_audio_mute = o.value("has_audio_mute").toInt();
hardware.has_bling_leds = o.value("has_bling_leds").toInt();
hardware.has_ext_module_support = o.value("has_ext_module_support").toInt();
hardware.has_int_module_support = o.value("has_int_module_support").toInt();
hardware.has_audio_mute = o.value("has_audio_mute").toBool();
hardware.has_ext_module_support = o.value("has_ext_module_support").toBool();
hardware.has_int_module_support = o.value("has_int_module_support").toBool();
hardware.sport_max_baudrate = o.value("sport_max_baudrate").toInt();
hardware.surface = o.value("surface").toInt();
hardware.surface = o.value("surface").toBool();
hardware.cpu = o.value("cpu").toString().toStdString();
hardware.cpu_type = o.value("cpu_type").toString().toStdString();
}
Expand Down
23 changes: 23 additions & 0 deletions radio/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,29 @@ add_definitions(

set(HW_DESC_JSON ${FLAVOUR}.json)

# Generate files from radio JSON
AddHWGenTarget(${HW_DESC_JSON} hal_settings hal_settings.h)

AddHWGenTarget(${HW_DESC_JSON} hal_keys hal_keys.inc)
AddHWGenTarget(${HW_DESC_JSON} hal_adc_inputs hal_adc_inputs.inc)

AddHWGenTarget(${HW_DESC_JSON} yaml_inputs yaml_inputs.inc)

AddHWGenTarget(${HW_DESC_JSON} lua_inputs lua_inputs.inc)
AddHWGenTarget(${HW_DESC_JSON} lua_mixsrc lua_mixsrc.inc)
AddHWGenTarget(${HW_DESC_JSON} lua_keys lua_keys.inc)

AddHWGenTarget(${HW_DESC_JSON} stm32_keys stm32_keys.inc)
AddHWGenTarget(${HW_DESC_JSON} stm32_switches stm32_switches.inc)
AddHWGenTarget(${HW_DESC_JSON} stm32_adc_inputs stm32_adc_inputs.inc)
AddHWGenTarget(${HW_DESC_JSON} stm32_pwm_inputs stm32_pwm_inputs.inc)

AddHWGenTarget(${HW_DESC_JSON} simu_keys simu_keys.inc)
AddHWGenTarget(${HW_DESC_JSON} simu_switches simu_switches.inc)

add_dependencies(board hal_settings hal_keys hal_adc_inputs stm32_keys stm32_switches stm32_adc_inputs stm32_pwm_inputs yaml_inputs lua_inputs lua_mixsrc lua_keys)
add_dependencies(board_bl hal_settings hal_keys stm32_keys)

include(hal/CMakeLists.txt)

add_subdirectory(bitmaps)
Expand Down
16 changes: 1 addition & 15 deletions radio/src/boards/generic_stm32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@

# Generate hardware struct defs
AddHWGenTarget(${HW_DESC_JSON} stm32_keys stm32_keys.inc)
AddHWGenTarget(${HW_DESC_JSON} stm32_switches stm32_switches.inc)
AddHWGenTarget(${HW_DESC_JSON} stm32_adc_inputs stm32_adc_inputs.inc)
AddHWGenTarget(${HW_DESC_JSON} stm32_pwm_inputs stm32_pwm_inputs.inc)
AddHWGenTarget(${HW_DESC_JSON} hal_adc_inputs hal_adc_inputs.inc)

# Dependencies common to bootloader and firmware
set(MINIMAL_BOARD_LIB_SRC
${RADIO_SRC_DIR}/boards/hw_defs/${HW_DESC_JSON}
${CMAKE_CURRENT_BINARY_DIR}/stm32_keys.inc

boards/generic_stm32/inputs.cpp
boards/generic_stm32/i2c_bus.cpp
boards/generic_stm32/bl_keys.cpp
Expand All @@ -19,11 +9,6 @@ set(MINIMAL_BOARD_LIB_SRC

# Dependencies only used in firmware
set(BOARD_LIB_SRC
${CMAKE_CURRENT_BINARY_DIR}/stm32_switches.inc
${CMAKE_CURRENT_BINARY_DIR}/stm32_adc_inputs.inc
${CMAKE_CURRENT_BINARY_DIR}/stm32_pwm_inputs.inc
${CMAKE_CURRENT_BINARY_DIR}/hal_adc_inputs.inc

boards/generic_stm32/module_ports.cpp
boards/generic_stm32/trainer_ports.cpp
boards/generic_stm32/sport_update.cpp
Expand All @@ -38,6 +23,7 @@ set(BOARD_LIB_SRC
)

add_library(minimal_board_lib OBJECT EXCLUDE_FROM_ALL ${MINIMAL_BOARD_LIB_SRC})
add_dependencies(minimal_board_lib stm32_keys)

add_library(board_lib OBJECT EXCLUDE_FROM_ALL ${BOARD_LIB_SRC})
add_dependencies(board_lib minimal_board_lib)
Expand Down
57 changes: 41 additions & 16 deletions radio/src/boards/hw_defs/boxer.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,27 +307,52 @@
}
],
"display": {
"w": 128,
"h": 64,
"phys_w": 128,
"phys_h": 64,
"depth": 1,
"color": 0,
"oled": 0,
"backlight_color": 0
"lcd_w": 128,
"lcd_h": 64,
"lcd_phys_w": 128,
"lcd_phys_h": 64,
"lcd_depth": 1,
"lcd_vertical_invert": true
},
"custom_switches": {
"rgb_led": 0,
"groups": 0
"backlight": {
"backlight_bdtr": "TIM_BDTR_MOE"
},
"leds": {
"status_leds": true,
"led_red_gpio": "GPIO_PIN(GPIOE, 13)",
"led_green_gpio": "GPIO_PIN(GPIOA, 7)",
"led_blue_gpio": "GPIO_PIN(GPIOE, 2)"
},
"hardware": {
"has_audio_mute": 1,
"has_bling_leds": 0,
"has_ext_module_support": 1,
"has_int_module_support": 1,
"has_audio_mute": true,
"has_ext_module_support": true,
"has_int_module_support": true,
"sport_max_baudrate": 400000,
"surface": 0,
"cpu": "STM32F407xG",
"cpu_type": "STM32F4"
},
"timers": {
"cpu_freq": 168000000,
"peri1_frequency": 42000000,
"peri2_frequency": 84000000,
"timer_mult_apb1": 2,
"timer_mult_apb2": 2,
"ms_timer": "TIM14",
"ms_timer_irqn": "TIM8_TRG_COM_TIM14_IRQn",
"ms_timer_irqhandler": "TIM8_TRG_COM_TIM14_IRQHandler",
"mixer_scheduler_timer": "TIM12",
"mixer_scheduler_timer_freq": "(PERI1_FREQUENCY * TIMER_MULT_APB1)",
"mixer_scheduler_timer_irqn": "TIM8_BRK_TIM12_IRQn",
"mixer_scheduler_timer_irqhandler": "TIM8_BRK_TIM12_IRQHandler"
},
"haptic": {
"haptic_pwm": true,
"haptic_gpio": "GPIO_PIN(GPIOB, 3)",
"haptic_gpio_af": "GPIO_AF1",
"haptic_timer": "TIM2",
"haptic_timer_freq": "(PERI1_FREQUENCY * TIMER_MULT_APB1)",
"haptic_counter_register": "HAPTIC_TIMER->CCR2",
"haptic_ccmr1": "TIM_CCMR1_OC2M_1 | TIM_CCMR1_OC2M_2",
"haptic_ccer": "TIM_CCER_CC2E"
}
}
59 changes: 43 additions & 16 deletions radio/src/boards/hw_defs/bumblebee.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,27 +376,54 @@
}
],
"display": {
"w": 128,
"h": 64,
"phys_w": 128,
"phys_h": 64,
"depth": 1,
"color": 0,
"oled": 1,
"backlight_color": 0
"lcd_w": 128,
"lcd_h": 64,
"lcd_phys_w": 128,
"lcd_phys_h": 64,
"lcd_depth": 1,
"oled_screen": true,
"lcd_horizontal_invert": true,
"lcd_vertical_invert": true
},
"custom_switches": {
"rgb_led": 0,
"groups": 3
"backlight": {
"backlight_bdtr": "TIM_BDTR_MOE"
},
"leds": {
"status_leds": true,
"led_red_gpio": "GPIO_PIN(GPIOC, 5)",
"led_green_gpio": "GPIO_PIN(GPIOG, 1)",
"led_blue_gpio": "GPIO_PIN(GPIOC, 4)"
},
"hardware": {
"has_audio_mute": 1,
"has_bling_leds": 0,
"has_ext_module_support": 1,
"has_int_module_support": 1,
"has_audio_mute": true,
"has_ext_module_support": true,
"has_int_module_support": true,
"sport_max_baudrate": 400000,
"surface": 0,
"cpu": "STM32F407xG",
"cpu_type": "STM32F4"
},
"timers": {
"cpu_freq": 168000000,
"peri1_frequency": 42000000,
"peri2_frequency": 84000000,
"timer_mult_apb1": 2,
"timer_mult_apb2": 2,
"ms_timer": "TIM14",
"ms_timer_irqn": "TIM8_TRG_COM_TIM14_IRQn",
"ms_timer_irqhandler": "TIM8_TRG_COM_TIM14_IRQHandler",
"mixer_scheduler_timer": "TIM12",
"mixer_scheduler_timer_freq": "(PERI1_FREQUENCY * TIMER_MULT_APB1)",
"mixer_scheduler_timer_irqn": "TIM8_BRK_TIM12_IRQn",
"mixer_scheduler_timer_irqhandler": "TIM8_BRK_TIM12_IRQHandler"
},
"haptic": {
"haptic_pwm": true,
"haptic_gpio": "GPIO_PIN(GPIOB, 3)",
"haptic_gpio_af": "GPIO_AF1",
"haptic_timer": "TIM2",
"haptic_timer_freq": "(PERI1_FREQUENCY * TIMER_MULT_APB1)",
"haptic_counter_register": "HAPTIC_TIMER->CCR2",
"haptic_ccmr1": "TIM_CCMR1_OC2M_1 | TIM_CCMR1_OC2M_2",
"haptic_ccer": "TIM_CCER_CC2E"
}
}
54 changes: 38 additions & 16 deletions radio/src/boards/hw_defs/commando8.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,27 +256,49 @@
}
],
"display": {
"w": 128,
"h": 64,
"phys_w": 128,
"phys_h": 64,
"depth": 1,
"color": 0,
"oled": 0,
"backlight_color": 0
"lcd_w": 128,
"lcd_h": 64,
"lcd_phys_w": 128,
"lcd_phys_h": 64,
"lcd_depth": 1,
"lcd_vertical_invert": true
},
"custom_switches": {
"rgb_led": 0,
"groups": 0
"leds": {
"status_leds": true,
"led_red_gpio": "GPIO_PIN(GPIOC, 2)",
"led_green_gpio": "GPIO_PIN(GPIOC, 0)",
"led_blue_gpio": "GPIO_PIN(GPIOC, 1)"
},
"hardware": {
"has_audio_mute": 1,
"has_bling_leds": 0,
"has_ext_module_support": 1,
"has_int_module_support": 1,
"has_audio_mute": true,
"has_ext_module_support": true,
"has_int_module_support": true,
"sport_max_baudrate": 400000,
"surface": 0,
"cpu": "STM32F407xE",
"cpu_type": "STM32F4"
},
"timers": {
"cpu_freq": 168000000,
"peri1_frequency": 42000000,
"peri2_frequency": 84000000,
"timer_mult_apb1": 2,
"timer_mult_apb2": 2,
"ms_timer": "TIM14",
"ms_timer_irqn": "TIM8_TRG_COM_TIM14_IRQn",
"ms_timer_irqhandler": "TIM8_TRG_COM_TIM14_IRQHandler",
"mixer_scheduler_timer": "TIM12",
"mixer_scheduler_timer_freq": "(PERI1_FREQUENCY * TIMER_MULT_APB1)",
"mixer_scheduler_timer_irqn": "TIM8_BRK_TIM12_IRQn",
"mixer_scheduler_timer_irqhandler": "TIM8_BRK_TIM12_IRQHandler"
},
"haptic": {
"haptic_pwm": true,
"haptic_gpio": "GPIO_PIN(GPIOB, 8)",
"haptic_gpio_af": "GPIO_AF3",
"haptic_timer": "TIM10",
"haptic_timer_freq": "(PERI2_FREQUENCY * TIMER_MULT_APB2)",
"haptic_counter_register": "HAPTIC_TIMER->CCR1",
"haptic_ccmr1": "TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2",
"haptic_ccer": "TIM_CCER_CC1E"
}
}
Loading