mirror of https://github.com/ArduPilot/ardupilot
HAL_ChibiOS: auto-enable CAN when pins are defined
This commit is contained in:
parent
fed1579187
commit
ebbd15ea17
|
@ -450,9 +450,6 @@ define AP_FEATURE_RTSCTS 1
|
|||
# enable SBUS_OUT on IOMCU (if you have an IOMCU)
|
||||
define AP_FEATURE_SBUS_OUT 1
|
||||
|
||||
# enable UAVCAN support if you have setup some CAN devices above
|
||||
define HAL_WITH_UAVCAN 1
|
||||
|
||||
# now setup the default battery pins driver analog pins and default
|
||||
# scaling for the power brick
|
||||
define HAL_BATT_VOLT_PIN 2
|
||||
|
|
|
@ -277,6 +277,10 @@ def get_config(name, column=0, required=True, default=None, type=None):
|
|||
error("Badly formed config value %s (got %s)" % (name, ret))
|
||||
return ret
|
||||
|
||||
def enable_can(f):
|
||||
'''setup for a CAN enabled board'''
|
||||
f.write('#define HAL_WITH_UAVCAN 1\n')
|
||||
env_vars['HAL_WITH_UAVCAN'] = '1'
|
||||
|
||||
def write_mcu_config(f):
|
||||
'''write MCU config defines'''
|
||||
|
@ -303,6 +307,8 @@ def write_mcu_config(f):
|
|||
f.write('#define HAL_USE_SERIAL_USB TRUE\n')
|
||||
if 'OTG2' in bytype:
|
||||
f.write('#define STM32_USB_USE_OTG2 TRUE\n')
|
||||
if 'CAN1' in bytype or 'CAN2' in bytype or 'CAN3' in bytype:
|
||||
enable_can(f)
|
||||
# write any custom STM32 defines
|
||||
for d in alllines:
|
||||
if d.startswith('STM32_'):
|
||||
|
|
|
@ -12,8 +12,11 @@ undef USART3
|
|||
undef USART3_TX
|
||||
undef USART3_RX
|
||||
undef CAN1
|
||||
undef CAN1_RX
|
||||
undef CAN1_TX
|
||||
undef CAN2
|
||||
undef HAL_WITH_UAVCAN
|
||||
undef CAN2_RX
|
||||
undef CAN2_TX
|
||||
undef IOMCU_UART
|
||||
undef AP_FEATURE_SBUS_OUT
|
||||
undef HAL_OS_FATFS_IO
|
||||
|
|
Loading…
Reference in New Issue