From a037fd052142edb79ff0e805f3b00283047acc4f Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Mon, 21 Nov 2022 17:20:08 +0100 Subject: [PATCH] usbd_gs_can: use C99 initializers for USBD_GS_CAN_dconf and USBD_GS_CAN_btconst --- src/usbd_gs_can.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/usbd_gs_can.c b/src/usbd_gs_can.c index 91686db8..72de2d5e 100644 --- a/src/usbd_gs_can.c +++ b/src/usbd_gs_can.c @@ -206,37 +206,34 @@ static const uint8_t USBD_MS_EXT_PROP_FEATURE_DESC[] = { 0x00, 0x00, 0x00, 0x00 }; - // device info static const struct gs_device_config USBD_GS_CAN_dconf = { - 0, // reserved 1 - 0, // reserved 2 - 0, // reserved 3 - 0, // interface count (0=1, 1=2..) - 2, // software version - 1 // hardware version + .icount = 0, + .sw_version = 2, + .hw_version = 1, }; // bit timing constraints static const struct gs_device_bt_const USBD_GS_CAN_btconst = { - GS_CAN_FEATURE_LISTEN_ONLY // supported features - | GS_CAN_FEATURE_LOOP_BACK - | GS_CAN_FEATURE_HW_TIMESTAMP - | GS_CAN_FEATURE_IDENTIFY - | GS_CAN_FEATURE_PAD_PKTS_TO_MAX_PKT_SIZE + .feature = + GS_CAN_FEATURE_LISTEN_ONLY | + GS_CAN_FEATURE_LOOP_BACK | + GS_CAN_FEATURE_HW_TIMESTAMP | + GS_CAN_FEATURE_IDENTIFY | + GS_CAN_FEATURE_PAD_PKTS_TO_MAX_PKT_SIZE #ifdef TERM_Pin - | GS_CAN_FEATURE_TERMINATION + | GS_CAN_FEATURE_TERMINATION #endif , - CAN_CLOCK_SPEED, // can timing base clock - 1, // tseg1 min - 16, // tseg1 max - 1, // tseg2 min - 8, // tseg2 max - 4, // sjw max - 1, // brp min - 1024, //brp_max - 1, // brp increment; + .fclk_can = CAN_CLOCK_SPEED, + .tseg1_min = 1, + .tseg1_max = 16, + .tseg2_min = 1, + .tseg2_max = 8, + .sjw_max = 4, + .brp_min = 1, + .brp_max = 1024, + .brp_inc = 1, }; /* It's unclear from the documentation, but it appears that the USB library is