update cyphal for APA102_CONTROL.

This commit is contained in:
Benjamin Perseghetti
2022-06-07 20:10:06 -04:00
parent 9b8e81f2e7
commit c9ba7f8148
6 changed files with 50 additions and 18 deletions
+5 -2
View File
@@ -1,5 +1,8 @@
CONFIG_DRIVERS_GPS=n
CONFIG_CYPHAL_CANFD_SUPPORT=y
CONFIG_CYPHAL_UORB_PCA_PWM_SUBSCRIBER=y
CONFIG_DRIVERS_PCA9685_UCAN=y
CONFIG_EXAMPLES_PCA_PWM_TEST=y
CONFIG_CYPHAL_UORB_PCA_PWM_SUBSCRIBER=y
CONFIG_DRIVERS_LIGHTS_APA102=y
CONFIG_CYPHAL_UORB_APA102_CONTROL_SUBSCRIBER=y
CONFIG_SYSTEMCMDS_UORB=y
+3
View File
@@ -95,6 +95,9 @@ if DRIVERS_CYPHAL
bool "uORB pca_pwm Subscriber"
default n
config CYPHAL_UORB_APA102_CONTROL_SUBSCRIBER
bool "uORB apa102_control Subscriber"
default n
endmenu
menu "Advertised Services"
+16 -15
View File
@@ -116,21 +116,22 @@ public:
private:
const UavcanParamBinder _uavcan_params[14] {
{"uavcan.pub.esc.0.id", "UCAN1_ESC_PUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.pub.servo.0.id", "UCAN1_SERVO_PUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.pub.gps.0.id", "UCAN1_GPS_PUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.pub.actuator_outputs.0.id", "UCAN1_ACTR_PUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.esc.0.id", "UCAN1_ESC0_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.gps.0.id", "UCAN1_GPS0_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.gps.1.id", "UCAN1_GPS1_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.energy_source.0.id", "UCAN1_BMS_ES_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.battery_status.0.id", "UCAN1_BMS_BS_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.battery_parameters.0.id", "UCAN1_BMS_BP_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.legacy_bms.0.id", "UCAN1_LG_BMS_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.uorb.sensor_gps.0.id", "UCAN1_UORB_GPS", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.pub.uorb.sensor_gps.0.id", "UCAN1_UORB_GPS_P", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.uorb.pca_pwm.0.id", "UCAN1_PCA_PWM_S", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
const UavcanParamBinder _uavcan_params[15] {
{"uavcan.pub.esc.0.id", "UCAN1_ESC_PUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.pub.servo.0.id", "UCAN1_SERVO_PUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.pub.gps.0.id", "UCAN1_GPS_PUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.pub.actuator_outputs.0.id", "UCAN1_ACTR_PUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.esc.0.id", "UCAN1_ESC0_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.gps.0.id", "UCAN1_GPS0_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.gps.1.id", "UCAN1_GPS1_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.energy_source.0.id", "UCAN1_BMS_ES_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.battery_status.0.id", "UCAN1_BMS_BS_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.battery_parameters.0.id", "UCAN1_BMS_BP_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.legacy_bms.0.id", "UCAN1_LG_BMS_SUB", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.uorb.sensor_gps.0.id", "UCAN1_UORB_GPS", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.pub.uorb.sensor_gps.0.id", "UCAN1_UORB_GPS_P", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.uorb.pca_pwm.0.id", "UCAN1_PCA_PWM_S", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
{"uavcan.sub.uorb.apa102_control.0.id", "UCAN1_APA102_CONTROL_S", px4_param_to_uavcan_port_id, uavcan_port_id_to_px4_param},
//{"uavcan.sub.bms.0.id", "UCAN1_BMS0_SUB"}, //FIXME instancing
//{"uavcan.sub.bms.1.id", "UCAN1_BMS1_SUB"},
};
@@ -48,6 +48,7 @@
#include <uORB/topics/sensor_gps.h>
#include <uORB/topics/pca_pwm.h>
#include <uORB/topics/apa102_control.h>
template <class T>
class uORB_over_UAVCAN_Subscriber : public UavcanDynamicPortSubscriber
+16 -1
View File
@@ -65,6 +65,10 @@
#define CONFIG_CYPHAL_UORB_PCA_PWM_SUBSCRIBER 0
#endif
#ifndef CONFIG_CYPHAL_UORB_AP102_CONTROL_SUBSCRIBER
#define CONFIG_CYPHAL_UORB_AP102_CONTROL_SUBSCRIBER 0
#endif
/* Preprocessor calculation of Subscribers count */
#define UAVCAN_SUB_COUNT CONFIG_CYPHAL_ESC_SUBSCRIBER + \
@@ -72,7 +76,8 @@
CONFIG_CYPHAL_GNSS_SUBSCRIBER_1 + \
CONFIG_CYPHAL_BMS_SUBSCRIBER + \
CONFIG_CYPHAL_UORB_SENSOR_GPS_SUBSCRIBER + \
CONFIG_CYPHAL_UORB_PCA_PWM_SUBSCRIBER
CONFIG_CYPHAL_UORB_PCA_PWM_SUBSCRIBER + \
CONFIG_CYPHAL_UORB_AP102_CONTROL_SUBSCRIBER
#include <px4_platform_common/defines.h>
#include <drivers/drv_hrt.h>
@@ -194,6 +199,16 @@ private:
"uorb.pca_pwm",
0
},
#endif
#if CONFIG_CYPHAL_UORB_APA102_CONTROL_SUBSCRIBER
{
[](CanardHandle & handle, UavcanParamManager & pmgr) -> UavcanDynamicPortSubscriber *
{
return new uORB_over_UAVCAN_Subscriber<apa102_control_s>(handle, pmgr, ORB_ID(apa102_control));
},
"uorb.apa102_control",
0
},
#endif
};
};
+9
View File
@@ -160,6 +160,15 @@ PARAM_DEFINE_INT32(UCAN1_UORB_GPS_P, -1);
*/
PARAM_DEFINE_INT32(UCAN1_PCA_PWM_S, -1);
/**
* apa102_control uORB over Cyphal subscription port ID.
*
* @min -1
* @max 6143
* @group Cyphal
*/
PARAM_DEFINE_INT32(UCAN1_APA102_CONTROL_S, -1);
// Publication Port IDs
/**