diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvoptx b/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvoptx index 29beeed454..d2aa430c5f 100644 --- a/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvoptx +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvoptx @@ -536,7 +536,7 @@ main - 1 + 0 0 0 0 @@ -599,7 +599,7 @@ - embot::app::bldc + theMBD 1 0 0 @@ -611,14 +611,34 @@ 0 0 0 + ..\src\app-board-amc2c\embot_app_board_amc2c_theMBD.cpp + embot_app_board_amc2c_theMBD.cpp + 0 + 0 + + + + + embot::app::bldc + 0 + 0 + 0 + 0 + + 4 + 6 + 8 + 0 + 0 + 0 ..\..\..\..\embot\app\bldc\embot_app_bldc_theApplication.cpp embot_app_bldc_theApplication.cpp 0 0 - 3 - 6 + 4 + 7 8 0 0 @@ -629,8 +649,8 @@ 0 - 3 - 7 + 4 + 8 8 0 0 @@ -641,8 +661,8 @@ 0 - 3 - 8 + 4 + 9 8 0 0 @@ -661,8 +681,8 @@ 0 0 - 4 - 9 + 5 + 10 8 0 0 @@ -673,8 +693,8 @@ 0 - 4 - 10 + 5 + 11 8 0 0 @@ -685,8 +705,8 @@ 0 - 4 - 11 + 5 + 12 8 0 0 @@ -697,8 +717,8 @@ 0 - 4 - 12 + 5 + 13 8 0 0 @@ -717,8 +737,8 @@ 0 0 - 5 - 13 + 6 + 14 4 0 0 @@ -729,8 +749,8 @@ 0 - 5 - 14 + 6 + 15 2 0 0 @@ -749,8 +769,8 @@ 0 0 - 6 - 15 + 7 + 16 4 0 0 @@ -761,8 +781,8 @@ 0 - 6 - 16 + 7 + 17 1 0 0 @@ -781,8 +801,8 @@ 0 0 - 7 - 17 + 8 + 18 8 0 0 @@ -793,8 +813,8 @@ 0 - 7 - 18 + 8 + 19 8 0 0 @@ -813,8 +833,8 @@ 0 0 - 8 - 19 + 9 + 20 8 0 0 @@ -828,13 +848,13 @@ embot::hw - 1 + 0 0 0 0 - 9 - 20 + 10 + 21 8 0 0 @@ -845,8 +865,8 @@ 0 - 9 - 21 + 10 + 22 8 0 0 @@ -857,8 +877,8 @@ 0 - 9 - 22 + 10 + 23 8 0 0 @@ -869,8 +889,8 @@ 0 - 9 - 23 + 10 + 24 8 0 0 @@ -881,8 +901,8 @@ 0 - 9 - 24 + 10 + 25 8 0 0 @@ -893,8 +913,8 @@ 0 - 9 - 25 + 10 + 26 8 0 0 @@ -905,8 +925,8 @@ 0 - 9 - 26 + 10 + 27 8 0 0 @@ -917,8 +937,8 @@ 0 - 9 - 27 + 10 + 28 8 0 0 @@ -929,38 +949,38 @@ 0 - 9 - 28 + 10 + 29 8 0 0 0 - ..\..\..\..\embot\hw\embot_hw_spi.cpp - embot_hw_spi.cpp + ..\..\..\..\embot\hw\embot_hw_timer.cpp + embot_hw_timer.cpp 0 0 - 9 - 29 + 10 + 30 8 0 0 0 - ..\..\..\..\embot\hw\embot_hw_timer.cpp - embot_hw_timer.cpp + ..\..\..\..\embot\hw\embot_hw_types.cpp + embot_hw_types.cpp 0 0 - 9 - 30 + 10 + 31 8 0 0 0 - ..\..\..\..\embot\hw\embot_hw_types.cpp - embot_hw_types.cpp + ..\..\..\..\embot\hw\embot_hw_motor.cpp + embot_hw_motor.cpp 0 0 @@ -973,8 +993,8 @@ 0 0 - 10 - 31 + 11 + 32 8 0 0 @@ -993,8 +1013,8 @@ 0 0 - 11 - 32 + 12 + 33 8 0 0 @@ -1013,8 +1033,8 @@ 0 0 - 12 - 33 + 13 + 34 8 0 0 @@ -1025,8 +1045,8 @@ 0 - 12 - 34 + 13 + 35 8 0 0 @@ -1037,8 +1057,8 @@ 0 - 12 - 35 + 13 + 36 8 0 0 @@ -1049,8 +1069,8 @@ 0 - 12 - 36 + 13 + 37 8 0 0 @@ -1061,8 +1081,8 @@ 0 - 12 - 37 + 13 + 38 8 0 0 @@ -1073,8 +1093,8 @@ 0 - 12 - 38 + 13 + 39 8 0 0 @@ -1085,8 +1105,8 @@ 0 - 12 - 39 + 13 + 40 8 0 0 @@ -1097,8 +1117,8 @@ 0 - 12 - 40 + 13 + 41 8 0 0 @@ -1117,8 +1137,8 @@ 0 0 - 13 - 41 + 14 + 42 8 0 0 @@ -1129,8 +1149,8 @@ 0 - 13 - 42 + 14 + 43 8 0 0 @@ -1141,8 +1161,8 @@ 0 - 13 - 43 + 14 + 44 8 0 0 @@ -1153,8 +1173,8 @@ 0 - 13 - 44 + 14 + 45 8 0 0 @@ -1165,8 +1185,8 @@ 0 - 13 - 45 + 14 + 46 8 0 0 @@ -1177,8 +1197,8 @@ 0 - 13 - 46 + 14 + 47 8 0 0 @@ -1189,8 +1209,8 @@ 0 - 13 - 47 + 14 + 48 8 0 0 @@ -1201,8 +1221,8 @@ 0 - 13 - 48 + 14 + 49 8 0 0 @@ -1215,11 +1235,363 @@ - mbd:: to be added - 1 + others-cmsis-math + 0 + 0 + 0 + 0 + + 15 + 50 + 4 + 0 + 0 + 0 + ..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Lib\ARM\arm_cortexM4lf_math.lib + arm_cortexM4lf_math.lib + 0 + 0 + + + + + others::motorhal2 TO BE FILLED + 0 0 0 0 + + mbd + 0 + 0 + 0 + 0 + + 17 + 51 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\const_params.cpp + const_params.cpp + 0 + 0 + + + 17 + 52 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_hypotf_snf.cpp + rt_hypotf_snf.cpp + 0 + 0 + + + 17 + 53 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_nonfinite.cpp + rt_nonfinite.cpp + 0 + 0 + + + 17 + 54 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_roundd_snf.cpp + rt_roundd_snf.cpp + 0 + 0 + + + 17 + 55 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtGetInf.cpp + rtGetInf.cpp + 0 + 0 + + + 17 + 56 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtGetNaN.cpp + rtGetNaN.cpp + 0 + 0 + + + 17 + 57 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\uMultiWord2Double.cpp + uMultiWord2Double.cpp + 0 + 0 + + + 17 + 58 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\uMultiWordShl.cpp + uMultiWordShl.cpp + 0 + 0 + + + 17 + 59 + 1 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtw_enable_disable_motors.c + rtw_enable_disable_motors.c + 0 + 0 + + + 17 + 60 + 1 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtw_motor_config.c + rtw_motor_config.c + 0 + 0 + + + + + mbd::can-encoder + 0 + 0 + 0 + 0 + + 18 + 61 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\can-encoder\can_encoder.cpp + can_encoder.cpp + 0 + 0 + + + + + mbd::can-decoder + 0 + 0 + 0 + 0 + + 19 + 62 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\can-decoder\can_decoder.cpp + can_decoder.cpp + 0 + 0 + + + + + mbd::supervisor-rx + 0 + 0 + 0 + 0 + + 20 + 63 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\supervisor-rx\SupervisorFSM_RX.cpp + SupervisorFSM_RX.cpp + 0 + 0 + + + + + mbd::supervisor-tx + 0 + 0 + 0 + 0 + + 21 + 64 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\supervisor-tx\SupervisorFSM_TX.cpp + SupervisorFSM_TX.cpp + 0 + 0 + + + + + mbd::control-outer + 0 + 0 + 0 + 0 + + 22 + 65 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\control-outer\control_outer.cpp + control_outer.cpp + 0 + 0 + + + + + mbd::control-foc + 0 + 0 + 0 + 0 + + 23 + 66 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\control_foc.cpp + control_foc.cpp + 0 + 0 + + + 23 + 67 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\control_foc_data.cpp + control_foc_data.cpp + 0 + 0 + + + 23 + 68 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\FOCInnerLoop.cpp + FOCInnerLoop.cpp + 0 + 0 + + + + + mdb::estimator + 0 + 0 + 0 + 0 + + 24 + 69 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\estimator\estimation_velocity.cpp + estimation_velocity.cpp + 0 + 0 + + + + + mbd::filter-current + 0 + 0 + 0 + 0 + + 25 + 70 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\filter-current\filter_current.cpp + filter_current.cpp + 0 + 0 + + + + + mbd::amc-bldc + 0 + 0 + 0 + 0 + + 26 + 71 + 8 + 0 + 0 + 0 + ..\..\..\amcbldc\application\src\model-based-design\amc-bldc\AMC_BLDC.cpp + AMC_BLDC.cpp + 0 + 0 + + + diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvprojx b/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvprojx index adbb49f530..91920d5f86 100644 --- a/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvprojx +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvprojx @@ -411,6 +411,16 @@ + + theMBD + + + embot_app_board_amc2c_theMBD.cpp + 8 + ..\src\app-board-amc2c\embot_app_board_amc2c_theMBD.cpp + + + embot::app::bldc @@ -559,11 +569,6 @@ 8 ..\..\..\..\embot\hw\embot_hw_flash.cpp - - embot_hw_spi.cpp - 8 - ..\..\..\..\embot\hw\embot_hw_spi.cpp - embot_hw_timer.cpp 8 @@ -574,6 +579,11 @@ 8 ..\..\..\..\embot\hw\embot_hw_types.cpp + + embot_hw_motor.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_motor.cpp + @@ -807,7 +817,172 @@ - mbd:: to be added + others-cmsis-math + + + arm_cortexM4lf_math.lib + 4 + ..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Lib\ARM\arm_cortexM4lf_math.lib + + + + + others::motorhal2 TO BE FILLED + + + mbd + + + const_params.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\const_params.cpp + + + rt_hypotf_snf.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_hypotf_snf.cpp + + + rt_nonfinite.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_nonfinite.cpp + + + rt_roundd_snf.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_roundd_snf.cpp + + + rtGetInf.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtGetInf.cpp + + + rtGetNaN.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtGetNaN.cpp + + + uMultiWord2Double.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\uMultiWord2Double.cpp + + + uMultiWordShl.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\uMultiWordShl.cpp + + + rtw_enable_disable_motors.c + 1 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtw_enable_disable_motors.c + + + rtw_motor_config.c + 1 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtw_motor_config.c + + + + + mbd::can-encoder + + + can_encoder.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\can-encoder\can_encoder.cpp + + + + + mbd::can-decoder + + + can_decoder.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\can-decoder\can_decoder.cpp + + + + + mbd::supervisor-rx + + + SupervisorFSM_RX.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\supervisor-rx\SupervisorFSM_RX.cpp + + + + + mbd::supervisor-tx + + + SupervisorFSM_TX.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\supervisor-tx\SupervisorFSM_TX.cpp + + + + + mbd::control-outer + + + control_outer.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\control-outer\control_outer.cpp + + + + + mbd::control-foc + + + control_foc.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\control_foc.cpp + + + control_foc_data.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\control_foc_data.cpp + + + FOCInnerLoop.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\FOCInnerLoop.cpp + + + + + mdb::estimator + + + estimation_velocity.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\estimator\estimation_velocity.cpp + + + + + mbd::filter-current + + + filter_current.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\filter-current\filter_current.cpp + + + + + mbd::amc-bldc + + + AMC_BLDC.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\amc-bldc\AMC_BLDC.cpp + + @@ -1145,7 +1320,7 @@ -Wno-pragma-pack -Wno-deprecated-register -DEMBOT_USE_rtos_osal USE_STM32HAL STM32HAL_BOARD_AMC2C STM32HAL_DRIVER_V1A0 - ..\..\..\..\libs\lowlevel\stm32hal\api;..\..\..\..\libs\highlevel\abslayer\osal\api;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core;..\..\..\..\embot\hw;..\..\..\..\embot\os;..\..\..\..\embot\app;..\..\..\..\embot\app;..\..\..\..\libs\midware\eventviewer\api;..\..\..\..\libs\highlevel\services\embenv\api;..\..\..\..\embot\prot\can;..\..\..\..\..\..\..\..\icub-firmware-shared\can\canProtocolLib;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools;..\..\bsp;..\..\..\..\embot\app\eth;..\..\..\..\embot\app\bldc;..\src\app-board-amc2c + ..\..\..\..\libs\lowlevel\stm32hal\api;..\..\..\..\libs\highlevel\abslayer\osal\api;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core;..\..\..\..\embot\hw;..\..\..\..\embot\os;..\..\..\..\embot\app;..\..\..\..\embot\app;..\..\..\..\libs\midware\eventviewer\api;..\..\..\..\libs\highlevel\services\embenv\api;..\..\..\..\embot\prot\can;..\..\..\..\..\..\..\..\icub-firmware-shared\can\canProtocolLib;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools;..\..\bsp;..\..\..\..\embot\app\eth;..\..\..\..\embot\app\bldc;..\src\app-board-amc2c;..\..\..\amcbldc\application\src\model-based-design\sharedutils;..\..\..\amcbldc\application\src\model-based-design\can-decoder;..\..\..\amcbldc\application\src\model-based-design\can-encoder;..\..\..\amcbldc\application\src\model-based-design\supervisor-rx;..\..\..\amcbldc\application\src\model-based-design\supervisor-tx;..\..\..\amcbldc\application\src\model-based-design\control-outer;..\..\..\amcbldc\application\src\model-based-design\control-foc;..\..\..\amcbldc\application\src\model-based-design\estimator;..\..\..\amcbldc\application\src\model-based-design\amc-bldc;..\..\..\amcbldc\application\src\model-based-design\filter-current;..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Include @@ -1216,6 +1391,16 @@ + + theMBD + + + embot_app_board_amc2c_theMBD.cpp + 8 + ..\src\app-board-amc2c\embot_app_board_amc2c_theMBD.cpp + + + embot::app::bldc @@ -1358,68 +1543,12 @@ embot_hw_can.cpp 8 ..\..\..\..\embot\hw\embot_hw_can.cpp - - - 2 - 0 - 0 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - 11 - - - 1 - - - - 2 - 1 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - - - - - - - embot_hw_flash.cpp 8 ..\..\..\..\embot\hw\embot_hw_flash.cpp - - embot_hw_spi.cpp - 8 - ..\..\..\..\embot\hw\embot_hw_spi.cpp - embot_hw_timer.cpp 8 @@ -1430,6 +1559,11 @@ 8 ..\..\..\..\embot\hw\embot_hw_types.cpp + + embot_hw_motor.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_motor.cpp + @@ -1569,57 +1703,6 @@ embot_hw_bsp_amc2c.cpp 8 ..\..\bsp\embot_hw_bsp_amc2c.cpp - - - 2 - 0 - 0 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - 11 - - - 1 - - - - 2 - 1 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - - - - - - - @@ -1714,7 +1797,172 @@ - mbd:: to be added + others-cmsis-math + + + arm_cortexM4lf_math.lib + 4 + ..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Lib\ARM\arm_cortexM4lf_math.lib + + + + + others::motorhal2 TO BE FILLED + + + mbd + + + const_params.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\const_params.cpp + + + rt_hypotf_snf.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_hypotf_snf.cpp + + + rt_nonfinite.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_nonfinite.cpp + + + rt_roundd_snf.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rt_roundd_snf.cpp + + + rtGetInf.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtGetInf.cpp + + + rtGetNaN.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtGetNaN.cpp + + + uMultiWord2Double.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\uMultiWord2Double.cpp + + + uMultiWordShl.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\uMultiWordShl.cpp + + + rtw_enable_disable_motors.c + 1 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtw_enable_disable_motors.c + + + rtw_motor_config.c + 1 + ..\..\..\amcbldc\application\src\model-based-design\sharedutils\rtw_motor_config.c + + + + + mbd::can-encoder + + + can_encoder.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\can-encoder\can_encoder.cpp + + + + + mbd::can-decoder + + + can_decoder.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\can-decoder\can_decoder.cpp + + + + + mbd::supervisor-rx + + + SupervisorFSM_RX.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\supervisor-rx\SupervisorFSM_RX.cpp + + + + + mbd::supervisor-tx + + + SupervisorFSM_TX.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\supervisor-tx\SupervisorFSM_TX.cpp + + + + + mbd::control-outer + + + control_outer.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\control-outer\control_outer.cpp + + + + + mbd::control-foc + + + control_foc.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\control_foc.cpp + + + control_foc_data.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\control_foc_data.cpp + + + FOCInnerLoop.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\control-foc\FOCInnerLoop.cpp + + + + + mdb::estimator + + + estimation_velocity.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\estimator\estimation_velocity.cpp + + + + + mbd::filter-current + + + filter_current.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\filter-current\filter_current.cpp + + + + + mbd::amc-bldc + + + AMC_BLDC.cpp + 8 + ..\..\..\amcbldc\application\src\model-based-design\amc-bldc\AMC_BLDC.cpp + + diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.demo.cpp b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.demo.cpp index ba9cfaea32..d2f24143b9 100644 --- a/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.demo.cpp +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.demo.cpp @@ -11,6 +11,7 @@ // -------------------------------------------------------------------------------------------------------------------- #include "embot_app_board_amc2c_mbd.h" +#include "embot_app_board_amc2c_theMBD.h" // -------------------------------------------------------------------------------------------------------------------- @@ -23,31 +24,33 @@ namespace embot::app::board::amc2c::mbd { void Startup(embot::prot::can::Address adr) { embot::core::print("MBD is starting up on an amc2c"); + embot::app::board::amc2c::theMBD::getInstance().initialise({adr}); } void OnTick(const std::vector &input, std::vector &output) { - static uint32_t cnt {0}; - if(0 == (cnt++ % 1)) - { -// embot::core::print("MBD is ticking on an amc2c"); - - uint8_t b0 = cnt&0xff; - uint8_t b1 = (cnt>>8)&0xff; - uint8_t b2 = (cnt>>16)&0xff; - uint8_t b3 = (cnt>>24)&0xff; - embot::prot::can::Frame fr1 {0x202, 4, {b0, b1, b2, b3, 0, 0, 0, 0}}; - output.push_back(fr1); - } - - size_t numRXframes = input.size(); - - if(numRXframes > 0) - { - // just for test: i get the first only and i send it back - embot::prot::can::Frame f = input[0]; - output.push_back(f); - } + embot::app::board::amc2c::theMBD::getInstance().tick(input, output); +// static uint32_t cnt {0}; +// if(0 == (cnt++ % 1)) +// { +//// embot::core::print("MBD is ticking on an amc2c"); +// +// uint8_t b0 = cnt&0xff; +// uint8_t b1 = (cnt>>8)&0xff; +// uint8_t b2 = (cnt>>16)&0xff; +// uint8_t b3 = (cnt>>24)&0xff; +// embot::prot::can::Frame fr1 {0x202, 4, {b0, b1, b2, b3, 0, 0, 0, 0}}; +// output.push_back(fr1); +// } +// +// size_t numRXframes = input.size(); +// +// if(numRXframes > 0) +// { +// // just for test: i get the first only and i send it back +// embot::prot::can::Frame f = input[0]; +// output.push_back(f); +// } } } // end of namespace diff --git a/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.cpp b/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.cpp index 8cb0bd7573..61c12e51f7 100644 --- a/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.cpp +++ b/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.cpp @@ -203,7 +203,7 @@ namespace embot { namespace hw { namespace button { #else -#error support for hw_button in embot::hw::bsp is yet to be done +#warning support for hw_button in embot::hw::bsp is yet to be done namespace embot { namespace hw { namespace button { @@ -216,7 +216,7 @@ namespace embot { namespace hw { namespace button { constexpr BSP thebsp { // maskofsupported - mask::pos2mask(BTN::one), + 0, //mask::pos2mask(BTN::one), // properties {{ &btn1p, nullptr, nullptr @@ -228,34 +228,34 @@ namespace embot { namespace hw { namespace button { void BSP::onEXTI(const embot::hw::gpio::PROP &p) const { - const embot::hw::GPIO gpio = embot::hw::gpio::getBSP().getGPIO(p); - switch(gpio.pin) - { - case embot::hw::GPIO::PIN::thirteen: - { - embot::hw::button::onexti(BTN::one); - } break; - +// const embot::hw::GPIO gpio = embot::hw::gpio::getBSP().getGPIO(p); +// switch(gpio.pin) +// { +// case embot::hw::GPIO::PIN::thirteen: +// { +// embot::hw::button::onexti(BTN::one); +// } break; +// - default: - { - } break; - } +// default: +// { +// } break; +// } } // we put in here the IRQHandlers + the exti callback extern "C" { - void EXTI15_10_IRQHandler(void) - { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13); - } - - void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) - { - embot::hw::button::getBSP().onEXTI({nullptr, GPIO_Pin, nullptr}); - } +// void EXTI15_10_IRQHandler(void) +// { +// HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13); +// } +// +// void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) +// { +// embot::hw::button::getBSP().onEXTI({nullptr, GPIO_Pin, nullptr}); +// } } #else @@ -754,42 +754,8 @@ namespace embot { namespace hw { namespace eeprom { namespace embot { namespace hw { namespace eeprom { - #if defined(STM32HAL_BOARD_AMC) - - constexpr PROP ee1p = { embot::hw::eeprom::Type::chipM95512DF, - { - embot::hw::SPI::six, - { - embot::hw::spi::Prescaler::eight, - embot::hw::spi::DataSize::eight, - embot::hw::spi::Mode::zero, - { {embot::hw::gpio::Pull::nopull, embot::hw::gpio::Pull::nopull, embot::hw::gpio::Pull::nopull, embot::hw::gpio::Pull::none} } - }, - { - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::eight}, // nS - {embot::hw::GPIO::PORT::F, embot::hw::GPIO::PIN::twelve}, // nW - {embot::hw::GPIO::PORT::F, embot::hw::GPIO::PIN::thirteen}, // nHOLD - { - embot::hw::gpio::Mode::OUTPUTpushpull, - embot::hw::gpio::Pull::nopull, - embot::hw::gpio::Speed::veryhigh - } - } - } - }; - - constexpr BSP thebsp { - // maskofsupported - mask::pos2mask(EEPROM::one), - // properties - {{ - &ee1p, nullptr - }} - }; - - - void BSP::init(embot::hw::EEPROM h) const {} - void BSP::deinit(embot::hw::EEPROM h) const {} + #if defined(STM32HAL_BOARD_AMC2C) + #else #error embot::hw::bsp::eeprom::thebsp must be defined @@ -830,27 +796,7 @@ namespace embot { namespace hw { namespace encoder { namespace embot { namespace hw { namespace encoder { - #if defined(STM32HAL_BOARD_AMC) - - // encoder one --> SPI1 - constexpr PROP e1p = { embot::hw::SPI::one }; - - // encoder one --> SPI2 - constexpr PROP e2p = { embot::hw::SPI::two }; - - // encoder one --> SPI3 - constexpr PROP e3p = { embot::hw::SPI::three }; - - constexpr BSP thebsp { - // maskofsupported - mask::pos2mask(ENCODER::one) | mask::pos2mask(ENCODER::two) | mask::pos2mask(ENCODER::three), - // properties - {{ &e1p, &e2p, &e3p }} - }; - - - void BSP::init(embot::hw::ENCODER h) const {} - void BSP::deinit(embot::hw::ENCODER h) const {} + #if defined(STM32HAL_BOARD_AMC2C) #else #error embot::hw::bsp::encoder::thebsp must be defined @@ -890,233 +836,8 @@ namespace embot { namespace hw { namespace spi { namespace bsp { namespace embot { namespace hw { namespace spi { namespace bsp { - #if defined(STM32HAL_BOARD_AMC) - - SPI_Device* getDEVICE(embot::hw::SPI h) - { - static SPI_Device * spiDEVICE[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6}; - return embot::hw::spi::supported(h) ? spiDEVICE[embot::core::tointegral(h)] : nullptr; - } - - - SPI_HandleTypeDef hspi1; - constexpr std::array pinoutspi1 = { { - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::nine}, // miso - {embot::hw::GPIO::PORT::D, embot::hw::GPIO::PIN::seven}, // mosi - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::eleven}, // sckl - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::ten} // ssel - } }; - constexpr PROP spi1p = { &hspi1, 50*1000*1000, pinoutspi1 }; - - - SPI_HandleTypeDef hspi2; - constexpr std::array pinoutspi2 = { { - {embot::hw::GPIO::PORT::B, embot::hw::GPIO::PIN::fourteen}, // miso - {embot::hw::GPIO::PORT::B, embot::hw::GPIO::PIN::fifteen}, // mosi - {embot::hw::GPIO::PORT::D, embot::hw::GPIO::PIN::three}, // sckl - {embot::hw::GPIO::PORT::B, embot::hw::GPIO::PIN::nine} // ssel - } }; - constexpr PROP spi2p = { &hspi2, 50*1000*1000, pinoutspi2 }; - - SPI_HandleTypeDef hspi3; - constexpr std::array pinoutspi3 = { { - {embot::hw::GPIO::PORT::C, embot::hw::GPIO::PIN::eleven}, // miso - {embot::hw::GPIO::PORT::D, embot::hw::GPIO::PIN::six}, // mosi - {embot::hw::GPIO::PORT::C, embot::hw::GPIO::PIN::ten}, // sckl - {embot::hw::GPIO::PORT::A, embot::hw::GPIO::PIN::four} // ssel - } }; - constexpr PROP spi3p = { &hspi3, 50*1000*1000, pinoutspi3 }; - - - constexpr std::array pinoutspi5 = { { - {embot::hw::GPIO::PORT::F, embot::hw::GPIO::PIN::eight}, // miso - {embot::hw::GPIO::PORT::F, embot::hw::GPIO::PIN::eleven}, // mosi - {embot::hw::GPIO::PORT::H, embot::hw::GPIO::PIN::six}, // sckl - {embot::hw::GPIO::PORT::none, embot::hw::GPIO::PIN::none} // ssel - } }; - constexpr PROP spi5p = { &hspi5, 100*1000*1000, pinoutspi5 }; - - constexpr std::array pinoutspi6 = { { - {embot::hw::GPIO::PORT::B, embot::hw::GPIO::PIN::four}, // miso - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::fourteen}, // mosi - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::thirteen}, // sckl - {embot::hw::GPIO::PORT::none, embot::hw::GPIO::PIN::none} // ssel - } }; - constexpr PROP spi6p = { &hspi6, 100*1000*1000, pinoutspi6 }; - - static_assert(spi6p.clockrate == 100*1000*1000, "SPI::six is now 12.5Mhz and must be changed inside MX_SPI6_Init()"); - // SPI::six is used @ 12.Mhz by a M95512-DFMC6 EEPROM and must be < 16MHz - - constexpr BSP thebsp { - // maskofsupported - mask::pos2mask(SPI::one) | mask::pos2mask(SPI::two) | mask::pos2mask(SPI::three) | - mask::pos2mask(SPI::five) | mask::pos2mask(SPI::six), - // properties - {{ - &spi1p, &spi2p, &spi3p, nullptr, &spi5p, &spi6p - }} - }; - - - void s_J5_SPIpinout(embot::hw::SPI h, bool enable) - { - static constexpr embot::hw::gpio::Config out { embot::hw::gpio::Mode::OUTPUTpushpull, embot::hw::gpio::Pull::nopull, embot::hw::gpio::Speed::medium }; - static constexpr embot::hw::gpio::State stateSPI[2] = {embot::hw::gpio::State::SET, embot::hw::gpio::State::RESET}; - static constexpr embot::hw::gpio::State stateNONE[2] = {embot::hw::gpio::State::RESET, embot::hw::gpio::State::RESET}; - - static constexpr size_t spinum {embot::core::tointegral(embot::hw::SPI::three)+1}; - static constexpr embot::hw::GPIO X1ENspi[spinum][2] = - { - { // spi1 - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::zero}, - {embot::hw::GPIO::PORT::D, embot::hw::GPIO::PIN::eight} - }, - { // spi2 - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::one}, - {embot::hw::GPIO::PORT::D, embot::hw::GPIO::PIN::nine} - }, - { // spi3 - {embot::hw::GPIO::PORT::G, embot::hw::GPIO::PIN::two}, - {embot::hw::GPIO::PORT::D, embot::hw::GPIO::PIN::ten} - } - }; - - uint8_t x = embot::core::tointegral(h); - if(x <= spinum) - { - // spix - for(uint8_t i=0; i<2; i++) - { - embot::hw::gpio::init(X1ENspi[x][i], out); - embot::hw::gpio::set(X1ENspi[x][i], enable ? stateSPI[i] : stateNONE[i]); - } - } - } - - // we need this extconfig because we wamt to pass information to HAL_SPI_MspInit() and HAL_SPI_MspDeInit() - utils::ExtendedConfig extconfig {}; - - void s_SPIinit(embot::hw::SPI h, const Config &config) - { - embot::hw::spi::bsp::SPI_Handle * hspi = embot::hw::spi::bsp::getBSP().getPROP(h)->handle; - - // prepare and then call HAL_SPI_Init() - hspi->Instance = getDEVICE(h); - hspi->Init.Mode = SPI_MODE_MASTER; - hspi->Init.Direction = SPI_DIRECTION_2LINES; - hspi->Init.DataSize = embot::hw::spi::bsp::utils::stm32::todatasize(config.datasize);; - hspi->Init.CLKPolarity = embot::hw::spi::bsp::utils::stm32::toCLKpolarity(config.mode); - hspi->Init.CLKPhase = embot::hw::spi::bsp::utils::stm32::toCLKphase(config.mode); - hspi->Init.NSS = SPI_NSS_SOFT; - hspi->Init.BaudRatePrescaler = embot::hw::spi::bsp::utils::stm32::tobaudrateprescaler(config.prescaler); - hspi->Init.FirstBit = SPI_FIRSTBIT_MSB; - hspi->Init.TIMode = SPI_TIMODE_DISABLE; - hspi->Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; - hspi->Init.CRCPolynomial = 0x0; - hspi->Init.NSSPMode = SPI_NSS_PULSE_ENABLE; - hspi->Init.NSSPolarity = SPI_NSS_POLARITY_LOW; - hspi->Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA; - hspi->Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN; - hspi->Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN; - hspi->Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE; - hspi->Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE; - hspi->Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE; - hspi->Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_DISABLE; - hspi->Init.IOSwap = SPI_IO_SWAP_DISABLE; - - // load config and pinout into extconfig so that whatever HAL_SPI_Init() calls can use it - extconfig.load(h, config); - HAL_SPI_Init(hspi); - // clear extconfig - extconfig.clear(); - } - - - void s_SPIdeinit(embot::hw::SPI h) - { - embot::hw::spi::bsp::SPI_Handle * hspi = embot::hw::spi::bsp::getBSP().getPROP(h)->handle; - - // load pinout into extconfig so that whatever HAL_SPI_DeInit() calls can use it - extconfig.load(h, {}); - HAL_SPI_DeInit(hspi); - // clear extconfig - extconfig.clear(); - } - + #if defined(STM32HAL_BOARD_AMC2C) - bool BSP::init(embot::hw::SPI h, const Config &config) const - { - switch(h) - { - case SPI::one: - case SPI::two: - case SPI::three: - { - // we are on J5: enable the port x1 - s_J5_SPIpinout(h, true); - // and call SPI init - s_SPIinit(h, config); - } break; - - case SPI::four: - { - // nothing to do - } break; - - case SPI::five: - { - // ETH ... use what cube-mx has chosen - MX_SPI5_Init(); - } break; - - case SPI::six: - { - // eeprom: just call SPI init - s_SPIinit(h, config); - } break; - - default: {} break; - } - - return true; - } - - bool BSP::deinit(embot::hw::SPI h) const - { - switch(h) - { - case SPI::one: - case SPI::two: - case SPI::three: - { - // call SPI deinit - s_SPIdeinit(h); - // we are on J5: disable port x1 - s_J5_SPIpinout(h, false); - } break; - - case SPI::four: - { - // nothing to do - } break; - - case SPI::five: - { - // ETH ... use what cube-mx has chosen - HAL_SPI_DeInit(&hspi5); - } break; - - case SPI::six: - { - // eeprom: just call SPI deinit - s_SPIdeinit(h); - } break; - - default: {} break; - } - - return true; - } #else #error embot::hw::bsp::spi::thebsp must be defined @@ -1129,376 +850,7 @@ namespace embot { namespace hw { namespace spi { namespace bsp { }}}} -extern "C" -{ - void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle) - { - embot::hw::spi::bsp::utils::ExtendedConfig * extcfg = nullptr; - extcfg = &embot::hw::spi::bsp::extconfig; - - GPIO_InitTypeDef GPIO_InitStruct = {0}; - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - - if(spiHandle->Instance == SPI1) - { - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI1; - PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_CLKP; - if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) - { - Error_Handler(); - } - - /* SPI1 clock enable */ - __HAL_RCC_SPI1_CLK_ENABLE(); - // must prepare the clocks of the sckl, mosi, miso, (ssel ?): D and G in our case - __HAL_RCC_GPIOD_CLK_ENABLE(); - __HAL_RCC_GPIOG_CLK_ENABLE(); - - /**SPI6 GPIO Configuration - PG9 ------> SPI1_MISO - PG11 ------> SPI1_SCK - PD7 ------> SPI1_MOSI - */ - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::MISO, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::MISO, GPIO_PULLUP); - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::MISO, nullptr), &GPIO_InitStruct); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::MOSI, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::MOSI, GPIO_PULLUP); - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::MOSI, nullptr), &GPIO_InitStruct); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::SCLK, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::SCLK, GPIO_PULLUP);; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::SCLK, nullptr), &GPIO_InitStruct); - - /* SPI1 interrupt Init */ - HAL_NVIC_SetPriority(SPI1_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(SPI1_IRQn); - } - else if(spiHandle->Instance == SPI2) - { - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI2; - PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_CLKP; - if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) - { - Error_Handler(); - } - - /* SPI2 clock enable */ - __HAL_RCC_SPI2_CLK_ENABLE(); - - // must prepare the clocks of the sckl, mosi, miso, (ssel ?): B and D in our case - __HAL_RCC_GPIOB_CLK_ENABLE(); - __HAL_RCC_GPIOD_CLK_ENABLE(); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::MISO, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::MISO, GPIO_NOPULL); - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI2; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::MISO, nullptr), &GPIO_InitStruct); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::MOSI, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::MOSI, GPIO_NOPULL); - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI2; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::MOSI, nullptr), &GPIO_InitStruct); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::SCLK, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::SCLK, GPIO_NOPULL);; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI2; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::SCLK, nullptr), &GPIO_InitStruct); - - /* SPI2 interrupt Init */ - HAL_NVIC_SetPriority(SPI2_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(SPI2_IRQn); - } - else if(spiHandle->Instance == SPI3) - { - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI3; - PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_CLKP; - if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) - { - Error_Handler(); - } - - /* SPI3 clock enable */ - __HAL_RCC_SPI3_CLK_ENABLE(); - - // must prepare the clocks of the sckl, mosi, miso, (ssel ?): C and D in our case - __HAL_RCC_GPIOC_CLK_ENABLE(); - __HAL_RCC_GPIOD_CLK_ENABLE(); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::MISO, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::MISO, GPIO_NOPULL); - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF6_SPI3; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::MISO, nullptr), &GPIO_InitStruct); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::MOSI, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::MOSI, GPIO_NOPULL); - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI3; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::MOSI, nullptr), &GPIO_InitStruct); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::SCLK, 0); - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::SCLK, GPIO_NOPULL);; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF6_SPI3; - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::SCLK, nullptr), &GPIO_InitStruct); - - /* SPI3 interrupt Init */ - HAL_NVIC_SetPriority(SPI3_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(SPI3_IRQn); - } - else if(spiHandle->Instance==SPI5) - { - /* USER CODE BEGIN SPI5_MspInit 0 */ - - /* USER CODE END SPI5_MspInit 0 */ - /** Initializes the peripherals clock - */ - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI5; - PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_D2PCLK1; - if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) - { - Error_Handler(); - } - - /* SPI5 clock enable */ - __HAL_RCC_SPI5_CLK_ENABLE(); - - __HAL_RCC_GPIOF_CLK_ENABLE(); - __HAL_RCC_GPIOH_CLK_ENABLE(); - /**SPI5 GPIO Configuration - PF8 ------> SPI5_MISO - PF11 ------> SPI5_MOSI - PH6 ------> SPI5_SCK - */ - GPIO_InitStruct.Pin = ETH_MISO_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_PULLDOWN; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI5; - HAL_GPIO_Init(ETH_MISO_GPIO_Port, &GPIO_InitStruct); - - GPIO_InitStruct.Pin = ETH_MOSI_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI5; - HAL_GPIO_Init(ETH_MOSI_GPIO_Port, &GPIO_InitStruct); - - GPIO_InitStruct.Pin = ETH_SCLK_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI5; - HAL_GPIO_Init(ETH_SCLK_GPIO_Port, &GPIO_InitStruct); - - /* SPI5 interrupt Init */ - HAL_NVIC_SetPriority(SPI5_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(SPI5_IRQn); - /* USER CODE BEGIN SPI5_MspInit 1 */ - - /* USER CODE END SPI5_MspInit 1 */ - } - else if(spiHandle->Instance==SPI6) - { - /* USER CODE BEGIN SPI6_MspInit 0 */ - - /* USER CODE END SPI6_MspInit 0 */ - - /** Initializes the peripherals clock - */ - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI6; - PeriphClkInitStruct.Spi6ClockSelection = RCC_SPI6CLKSOURCE_D3PCLK1; - if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) - { - Error_Handler(); - } - - /* SPI6 clock enable */ - __HAL_RCC_SPI6_CLK_ENABLE(); - - __HAL_RCC_GPIOB_CLK_ENABLE(); - __HAL_RCC_GPIOG_CLK_ENABLE(); - /**SPI6 GPIO Configuration - PB4 (NJTRST) ------> SPI6_MISO - PG13 ------> SPI6_SCK - PG14 ------> SPI6_MOSI - */ - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::MISO, EE_MISO_Pin); //EE_MISO_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::MISO, GPIO_NOPULL); - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF8_SPI6; - //HAL_GPIO_Init(EE_MISO_GPIO_Port, &GPIO_InitStruct); - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::MISO, EE_MISO_GPIO_Port), &GPIO_InitStruct); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::MOSI, EE_MOSI_Pin);//EE_MOSI_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::MOSI, GPIO_NOPULL); - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI6; - //HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::MOSI, GPIOG), &GPIO_InitStruct); - - GPIO_InitStruct.Pin = extcfg->pin(embot::hw::spi::Signal::SCLK, EE_SCLK_Pin); //EE_SCLK_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = extcfg->pull(embot::hw::spi::Signal::SCLK, GPIO_NOPULL);; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI6; - //HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); - HAL_GPIO_Init(extcfg->port(embot::hw::spi::Signal::SCLK, GPIOG), &GPIO_InitStruct); - - /* SPI6 interrupt Init */ - HAL_NVIC_SetPriority(SPI6_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(SPI6_IRQn); - /* USER CODE BEGIN SPI6_MspInit 1 */ - - /* USER CODE END SPI6_MspInit 1 */ - } - } - - - void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle) - { - embot::hw::spi::bsp::utils::ExtendedConfig * extcfg = nullptr; - extcfg = &embot::hw::spi::bsp::extconfig; - - if(spiHandle->Instance == SPI1) - { - __HAL_RCC_SPI1_CLK_DISABLE(); - - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::MISO)); - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::MOSI)); - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::SCLK)); - - HAL_NVIC_DisableIRQ(SPI1_IRQn); - } - else if(spiHandle->Instance == SPI2) - { - __HAL_RCC_SPI2_CLK_DISABLE(); - - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::MISO)); - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::MOSI)); - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::SCLK)); - - HAL_NVIC_DisableIRQ(SPI2_IRQn); - } - else if(spiHandle->Instance == SPI3) - { - __HAL_RCC_SPI3_CLK_DISABLE(); - - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::MISO)); - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::MOSI)); - embot::hw::gpio::deinit(extcfg->gpio(embot::hw::spi::Signal::SCLK)); - - HAL_NVIC_DisableIRQ(SPI3_IRQn); - } - else if(spiHandle->Instance==SPI5) - { - /* USER CODE BEGIN SPI5_MspDeInit 0 */ - - /* USER CODE END SPI5_MspDeInit 0 */ - /* Peripheral clock disable */ - __HAL_RCC_SPI5_CLK_DISABLE(); - - /**SPI5 GPIO Configuration - PF8 ------> SPI5_MISO - PF11 ------> SPI5_MOSI - PH6 ------> SPI5_SCK - */ - HAL_GPIO_DeInit(GPIOF, ETH_MISO_Pin|ETH_MOSI_Pin); - - HAL_GPIO_DeInit(ETH_SCLK_GPIO_Port, ETH_SCLK_Pin); - - /* SPI5 interrupt Deinit */ - HAL_NVIC_DisableIRQ(SPI5_IRQn); - /* USER CODE BEGIN SPI5_MspDeInit 1 */ - - /* USER CODE END SPI5_MspDeInit 1 */ - } - else if(spiHandle->Instance==SPI6) - { - /* USER CODE BEGIN SPI6_MspDeInit 0 */ - - /* USER CODE END SPI6_MspDeInit 0 */ - /* Peripheral clock disable */ - __HAL_RCC_SPI6_CLK_DISABLE(); - - /**SPI6 GPIO Configuration - PB4 (NJTRST) ------> SPI6_MISO - PG13 ------> SPI6_SCK - PG14 ------> SPI6_MOSI - */ - //HAL_GPIO_DeInit(EE_MISO_GPIO_Port, EE_MISO_Pin); - //HAL_GPIO_DeInit(GPIOG, EE_MOSI_Pin); - //HAL_GPIO_DeInit(GPIOG, EE_SCLK_Pin); - - HAL_GPIO_DeInit( extcfg->port(embot::hw::spi::Signal::MISO, EE_MISO_GPIO_Port), - extcfg->pin(embot::hw::spi::Signal::MISO, EE_MISO_Pin)); - HAL_GPIO_DeInit( extcfg->port(embot::hw::spi::Signal::MOSI, GPIOG), - extcfg->pin(embot::hw::spi::Signal::MOSI, EE_MOSI_Pin)); - HAL_GPIO_DeInit( extcfg->port(embot::hw::spi::Signal::SCLK, GPIOG), - extcfg->pin(embot::hw::spi::Signal::SCLK, EE_SCLK_Pin)); ///EE_SCLK_Pin); - - //HAL_GPIO_DeInit(GPIOG, EE_SCLK_Pin|EE_MOSI_Pin); - - /* SPI6 interrupt Deinit */ - HAL_NVIC_DisableIRQ(SPI6_IRQn); - /* USER CODE BEGIN SPI6_MspDeInit 1 */ - - /* USER CODE END SPI6_MspDeInit 1 */ - } - } - -} - -extern "C" -{ - void SPI1_IRQHandler(void) - { - HAL_SPI_IRQHandler(&embot::hw::spi::bsp::hspi1); - } - - void SPI2_IRQHandler(void) - { - HAL_SPI_IRQHandler(&embot::hw::spi::bsp::hspi2); - } - - void SPI3_IRQHandler(void) - { - HAL_SPI_IRQHandler(&embot::hw::spi::bsp::hspi3); - } - - void SPI5_IRQHandler(void) - { - HAL_SPI_IRQHandler(&hspi5); - } - - void SPI6_IRQHandler(void) - { - HAL_SPI_IRQHandler(&hspi6); - } -} #endif // spi @@ -1527,7 +879,9 @@ namespace embot { namespace hw { namespace timer { namespace embot { namespace hw { namespace timer { - #if defined(STM32HAL_BOARD_AMC) + #if defined(STM32HAL_BOARD_AMC2C) + +#error DO it constexpr PROP tim01p = { }; constexpr PROP tim02p = { }; @@ -1737,6 +1091,85 @@ extern "C" // - support map: end of embot::hw::timer +// - support map: begin of embot::hw::motor + +#include "embot_hw_motor_bsp.h" + +#if !defined(EMBOT_ENABLE_hw_motor) + +namespace embot { namespace hw { namespace motor { + + constexpr BSP thebsp { }; + void BSP::init(embot::hw::MOTOR h) const {} + const BSP& getBSP() + { + return thebsp; + } + +}}} + +#else + +namespace embot { namespace hw { namespace motor { + +#if defined(STM32HAL_BOARD_AMC2C) + + + constexpr PROP propM1 { 0 }; + + constexpr BSP thebsp { + + // maskofsupported + mask::pos2mask(MOTOR::one), + // properties + {{ + &propM1 + }} + + }; + + void BSP::init(embot::hw::MOTOR h) const { + +#if 1 + #warning fill the BSP of motor +#else + // step 1: what cube mx does + MX_ADC1_Init(); + MX_ADC2_Init(); + + MX_TIM1_Init(); + MX_TIM3_Init(); + MX_TIM2_Init(); + MX_CORDIC_Init(); + MX_FMAC_Init(); + MX_CRC_Init(); +#if defined(STM32HAL_DRIVER_V120) +#else + MX_TIM15_Init(); +#endif + + + HAL_GPIO_WritePin(VAUXEN_GPIO_Port, VAUXEN_Pin, GPIO_PIN_SET); + HAL_Delay(10); +#endif + + } + + #else + #error embot::hw::motor::thebsp must be defined + #endif + + const BSP& getBSP() + { + return thebsp; + } + +}}} // namespace embot { namespace hw { namespace motor { + +#endif // motor + +// - support map: end of embot::hw::motor + // -------------------------------------------------------------------------------------------------------------------- // - board specific methods @@ -1746,6 +1179,12 @@ extern "C" namespace embot { namespace hw { namespace bsp { namespace amc2c { + embot::hw::BTN EXTFAULTbutton() + { + #warning amc2c is to be refined + return embot::hw::BTN::none; + } + }}}} diff --git a/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.h b/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.h index d22386436b..e8c8eb0ad6 100644 --- a/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.h +++ b/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.h @@ -1,19 +1,19 @@ /* - * Copyright (C) 2022 iCub Tech - Istituto Italiano di Tecnologia + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia * Author: Marco Accame * email: marco.accame@iit.it */ // - include guard ---------------------------------------------------------------------------------------------------- -#ifndef _EMBOT_HW_BSP_AMC_H_ -#define _EMBOT_HW_BSP_AMC_H_ +#ifndef __EMBOT_HW_BSP_AMC2C_H_ +#define __EMBOT_HW_BSP_AMC2C_H_ #include "embot_core.h" #include "embot_hw_types.h" -namespace embot { namespace hw { namespace bsp { namespace amc { +namespace embot { namespace hw { namespace bsp { namespace amc2c { // adds in here constants or functions specific to the board // orange led @@ -23,6 +23,8 @@ namespace embot { namespace hw { namespace bsp { namespace amc { // led constexpr embot::hw::LED redLED {embot::hw::LED::two}; + embot::hw::BTN EXTFAULTbutton(); + }}}} #endif // include-guard diff --git a/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c_config.h b/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c_config.h index 49c8081ce9..a6c2502a0c 100644 --- a/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c_config.h +++ b/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c_config.h @@ -23,7 +23,9 @@ #define EMBOT_ENABLE_hw_bsp_specialize #define EMBOT_ENABLE_hw_gpio #define EMBOT_ENABLE_hw_led - + #define EMBOT_ENABLE_hw_button + + #define EMBOT_ENABLE_hw_motor #define EMBOT_ENABLE_hw_flash //#define EMBOT_ENABLE_hw_timer #define EMBOT_ENABLE_hw_can diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvoptx b/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvoptx index 1c840cd9fa..39dfd61fe3 100644 --- a/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvoptx +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvoptx @@ -460,7 +460,7 @@ main - 1 + 0 0 0 0 @@ -536,7 +536,7 @@ embot::app::bldc - 1 + 0 0 0 0 @@ -592,7 +592,7 @@ embot::app::application - 1 + 0 0 0 0 @@ -788,7 +788,7 @@ embot::hw - 1 + 0 0 0 0 @@ -968,7 +968,7 @@ embot<flash stored info> - 1 + 0 0 0 0 @@ -1000,7 +1000,7 @@ embot::os - 1 + 0 0 0 0 @@ -1620,7 +1620,7 @@ mbd::filter-current - 0 + 1 0 0 0 diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.cpp b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.cpp index d7ab32e9fd..e09f0329e3 100644 --- a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.cpp +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.cpp @@ -17,17 +17,20 @@ // - external dependencies // -------------------------------------------------------------------------------------------------------------------- - +#include "embot_app_board_amcbldc_info.h" +#include "embot_app_board_amcbldc_theMBD.h" namespace embot::app::board::amcbldc::mbd { void Startup(embot::prot::can::Address adr) { embot::core::print("MBD is starting up"); + embot::app::board::amcbldc::theMBD::getInstance().initialise({adr}); } void OnTick(const std::vector &input, std::vector &output) { + embot::app::board::amcbldc::theMBD::getInstance().tick(input, output); // static uint32_t cnt {0}; // if(0 == (cnt++ % 3000)) // { diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.cpp b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.cpp index 0d2b540bca..fbbc345f7a 100644 --- a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.cpp +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.cpp @@ -17,8 +17,14 @@ // - external dependencies // -------------------------------------------------------------------------------------------------------------------- +#if defined(STM32HAL_BOARD_AMC2C) +#include "embot_hw_bsp_amc2c.h" +using namespace embot::hw::bsp::amc2c; +#warning READ CAREFULLY: we may use the same object for both amcbldc and amc2c +#else #include "embot_hw_bsp_amcbldc.h" - +using namespace embot::hw::bsp::amcbldc; +#endif #include "embot_hw_button.h" #include "embot_hw_motor.h" @@ -32,9 +38,6 @@ #include "embot_prot_can_motor_polling.h" #include "embot_prot_can_motor_periodic.h" -// hal components -#include "motorhal_config.h" - // mdb components #include "AMC_BLDC.h" @@ -297,7 +300,7 @@ bool embot::app::board::amcbldc::theMBD::Impl::initialise(const Config &config) prevEXTFAULTisPRESSED = EXTFAULTisPRESSED = embot::hw::button::pressed(buttonEXTfault); #elif defined(EXTFAULT_enabled_polling) - buttonEXTfault = embot::hw::bsp::amcbldc::EXTFAULTbutton(); + buttonEXTfault = EXTFAULTbutton(); faultvalues.reserve(faultcapacity); faultvalues.clear(); diff --git a/emBODY/eBcode/arch-arm/embot/hw/embot_hw_motor.cpp b/emBODY/eBcode/arch-arm/embot/hw/embot_hw_motor.cpp index 7c3bbdfb95..5de98c0195 100644 --- a/emBODY/eBcode/arch-arm/embot/hw/embot_hw_motor.cpp +++ b/emBODY/eBcode/arch-arm/embot/hw/embot_hw_motor.cpp @@ -76,8 +76,26 @@ namespace embot { namespace hw { namespace motor { bool supported(MOTOR h) { return false; } bool initialised(MOTOR h) { return false; } - result_t init(MOTOR h, const Config &config) { return resNOK; } - + bool enabled(MOTOR h) { return false; } + bool faulted(MOTOR h) { return false; } + result_t fault(MOTOR h, bool on) { return resNOK; } + result_t config( + MOTOR h, + uint8_t has_quad_enc, + int16_t enc_resolution, + uint8_t pwm_num_polar_couples, + uint8_t pwm_has_hall_sens, + uint8_t pwm_swapBC, + uint16_t pwm_hall_offset) { return resNOK; } + result_t enable(MOTOR h, bool on) { return resNOK; } + result_t getencoder(MOTOR h, Position &position) { return resNOK; } + result_t gethallcounter(MOTOR h, Position &position) { return resNOK; } + result_t gethallstatus(MOTOR h, HallStatus &hs) { return resNOK; } + result_t setpwm(MOTOR h, Pwm v) { return resNOK; } + result_t setpwm(MOTOR h, Pwm u, Pwm v, Pwm w) { return resNOK; } + result_t setCallbackOnCurrents(MOTOR h, fpOnCurrents callback, void *owner) { return resNOK; } + result_t init(MOTOR h, const Config &config) { return resNOK; } + }}} // namespace embot { namespace hw { namespace MOTOR { @@ -377,10 +395,45 @@ namespace embot { namespace hw { namespace motor { // in here is the part for low level hw of the amcbldc #if !defined(STM32HAL_BOARD_AMCBLDC) + + #if defined(STM32HAL_BOARD_AMC2C) + + #warning TODO: fill in embot::hw::motor the calls to motorhal2 ... maybe move into the bsp. + // and also clean up a lot of this styff in here + + #endif + result_t s_hw_init(MOTOR h) { return resNOK; } + + result_t s_hw_motorEnable(MOTOR h) + { + return resNOK; + } + + result_t s_hw_motorDisable(MOTOR h) + { + return resNOK; + } + + result_t s_hw_configure( + MOTOR h, + uint8_t has_quad_enc, + int16_t enc_resolution, + uint8_t pwm_num_polar_couples, + uint8_t pwm_has_hall_sens, + uint8_t pwm_swapBC, + uint16_t pwm_hall_offset) + { + return resNOK; + } + + result_t s_hw_setCallbackOnCurrents(MOTOR h, fpOnCurrents callback, void *owner) + { + return resNOK; + } #else