diff --git a/boards/nxp/ucans32k146/pca9685.px4board b/boards/nxp/ucans32k146/pca9685.px4board index 8b60dc8160..4983214820 100644 --- a/boards/nxp/ucans32k146/pca9685.px4board +++ b/boards/nxp/ucans32k146/pca9685.px4board @@ -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 + diff --git a/src/drivers/cyphal/Kconfig b/src/drivers/cyphal/Kconfig index 0e3fd07695..73e99cf0dc 100644 --- a/src/drivers/cyphal/Kconfig +++ b/src/drivers/cyphal/Kconfig @@ -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" diff --git a/src/drivers/cyphal/ParamManager.hpp b/src/drivers/cyphal/ParamManager.hpp index 823acae183..13d46f97fb 100644 --- a/src/drivers/cyphal/ParamManager.hpp +++ b/src/drivers/cyphal/ParamManager.hpp @@ -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"}, }; diff --git a/src/drivers/cyphal/Subscribers/uORB/uorb_subscriber.hpp b/src/drivers/cyphal/Subscribers/uORB/uorb_subscriber.hpp index adfe026d59..d49281728e 100644 --- a/src/drivers/cyphal/Subscribers/uORB/uorb_subscriber.hpp +++ b/src/drivers/cyphal/Subscribers/uORB/uorb_subscriber.hpp @@ -48,6 +48,7 @@ #include #include +#include template class uORB_over_UAVCAN_Subscriber : public UavcanDynamicPortSubscriber diff --git a/src/drivers/cyphal/SubscriptionManager.hpp b/src/drivers/cyphal/SubscriptionManager.hpp index 57ce24bd46..a46a95f61c 100644 --- a/src/drivers/cyphal/SubscriptionManager.hpp +++ b/src/drivers/cyphal/SubscriptionManager.hpp @@ -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 #include @@ -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(handle, pmgr, ORB_ID(apa102_control)); + }, + "uorb.apa102_control", + 0 + }, #endif }; }; diff --git a/src/drivers/cyphal/parameters.c b/src/drivers/cyphal/parameters.c index aaa0d93df1..18007e258d 100644 --- a/src/drivers/cyphal/parameters.c +++ b/src/drivers/cyphal/parameters.c @@ -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 /**