mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-21 15:34:33 +08:00
Merge branch 'devel' into sam_user_adc
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "interface_usb.h"
|
||||
#include "interface_uart.h"
|
||||
#include "interface_i2c.h"
|
||||
|
||||
#include "odrive_main.h"
|
||||
#include "protocol.hpp"
|
||||
@@ -111,7 +112,7 @@ static inline auto make_obj_tree() {
|
||||
make_protocol_ro_property("fw_version_revision", &fw_version_revision),
|
||||
make_protocol_ro_property("fw_version_unreleased", &fw_version_unreleased),
|
||||
make_protocol_ro_property("user_config_loaded", const_cast<const bool *>(&user_config_loaded_)),
|
||||
make_protocol_ro_property("brake_resistor_armed", &brake_resistor_armed_),
|
||||
make_protocol_ro_property("brake_resistor_armed", &brake_resistor_armed),
|
||||
make_protocol_object("system_stats",
|
||||
make_protocol_ro_property("uptime", &system_stats_.uptime),
|
||||
make_protocol_ro_property("min_heap_space", &system_stats_.min_heap_space),
|
||||
@@ -126,12 +127,20 @@ static inline auto make_obj_tree() {
|
||||
make_protocol_ro_property("rx_cnt", &usb_stats_.rx_cnt),
|
||||
make_protocol_ro_property("tx_cnt", &usb_stats_.tx_cnt),
|
||||
make_protocol_ro_property("tx_overrun_cnt", &usb_stats_.tx_overrun_cnt)
|
||||
),
|
||||
make_protocol_object("i2c",
|
||||
make_protocol_ro_property("addr", &i2c_stats_.addr),
|
||||
make_protocol_ro_property("addr_match_cnt", &i2c_stats_.addr_match_cnt),
|
||||
make_protocol_ro_property("rx_cnt", &i2c_stats_.rx_cnt),
|
||||
make_protocol_ro_property("error_cnt", &i2c_stats_.error_cnt)
|
||||
)
|
||||
),
|
||||
make_protocol_object("config",
|
||||
make_protocol_property("brake_resistance", &board_config.brake_resistance),
|
||||
// TODO: changing this currently requires a reboot - fix this
|
||||
make_protocol_property("enable_uart", &board_config.enable_uart),
|
||||
make_protocol_property("enable_i2c_instead_of_can" , &board_config.enable_i2c_instead_of_can), // requires a reboot
|
||||
make_protocol_property("enable_ascii_protocol_on_usb", &board_config.enable_ascii_protocol_on_usb),
|
||||
make_protocol_property("dc_bus_undervoltage_trip_level", &board_config.dc_bus_undervoltage_trip_level),
|
||||
make_protocol_property("dc_bus_overvoltage_trip_level", &board_config.dc_bus_overvoltage_trip_level)
|
||||
),
|
||||
@@ -169,8 +178,11 @@ void communication_task(void * ctx) {
|
||||
auto endpoint_provider = EndpointProvider_from_MemberList<tree_type>(*tree_ptr);
|
||||
set_application_endpoints(&endpoint_provider);
|
||||
|
||||
serve_on_uart();
|
||||
serve_on_usb();
|
||||
start_uart_server();
|
||||
start_usb_server();
|
||||
if (board_config.enable_i2c_instead_of_can) {
|
||||
start_i2c_server();
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
osDelay(1000); // nothing to do
|
||||
|
||||
Reference in New Issue
Block a user