mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-09-06 08:46:31 +00:00
apps/examples/uavcan: Call boardctl to configure CAN GPIOs
This commit is contained in:
parent
98bca9d69c
commit
f24828337f
1 changed files with 11 additions and 1 deletions
|
|
@ -39,6 +39,8 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/boardctl.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
|
|
@ -65,9 +67,17 @@ int main(int argc, FAR char *argv[])
|
|||
extern "C" int uavcan_main(int argc, FAR char *argv[])
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = boardctl(BOARDIOC_INIT, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::fprintf(stderr, "ERROR: boardctl failed: %d\n", ret);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
uavcan::Node<CONFIG_EXAMPLES_UAVCAN_NODE_MEM_POOL_SIZE>
|
||||
node(getCanDriver(), getSystemClock());
|
||||
int ret;
|
||||
|
||||
node.setNodeID(CONFIG_EXAMPLES_UAVCAN_NODE_ID);
|
||||
node.setName(CONFIG_EXAMPLES_UAVCAN_NODE_NAME);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue