uavcannode: Add CANNODE_TERM parameter (configure CAN termination on ARK cannodes)

- adds functionality to enable the built in can termination on the ARK cannodes
This commit is contained in:
Alex Klimaj
2021-10-15 09:29:56 -04:00
committed by GitHub
parent 55910caec5
commit b482986e8e
5 changed files with 25 additions and 0 deletions
+13
View File
@@ -513,6 +513,19 @@ extern "C" int uavcannode_start(int argc, char *argv[])
// Sarted byt the bootloader, we must pet it
watchdog_pet();
#if defined(GPIO_CAN_TERM)
int32_t can_term = 0;
param_get(param_find("CANNODE_TERM"), &can_term);
if (can_term != 0) {
px4_arch_gpiowrite(GPIO_CAN_TERM, true);
} else {
px4_arch_gpiowrite(GPIO_CAN_TERM, false);
}
#endif
// CAN bitrate
int32_t bitrate = 0;
@@ -50,3 +50,12 @@ PARAM_DEFINE_INT32(CANNODE_NODE_ID, 120);
* @group UAVCAN
*/
PARAM_DEFINE_INT32(CANNODE_BITRATE, 1000000);
/**
* CAN built-in bus termination
*
* @boolean
* @max 1
* @group UAVCAN
*/
PARAM_DEFINE_INT32(CANNODE_TERM, 0);