Hi !
As part of using px4 on a classic can bus machine. I would like to use the can bus to communicate with the rest of my components.
By taking the NuttX example on the can bus, I get a compilation error.
Here is my code, they are in src / module :
can_pilot.cpp :
#include "can_pilot.hpp"
#include <fcntl.h>
#include <poll.h>
#include <nuttx/can/can.h>
#include <arch/board/board.h>
#include "stm32_can.h"
#include <px4_platform_common/log.h>
/********************************************************************************
* Variables globales
********************************************************************************/
/********************************************************************************
* Fonction INIT
********************************************************************************/
int init_can(){
struct can_dev_s *can = stm32_caninitialize(1);
if (can == nullptr) {
PX4_ERR("Failed to get CAN interface");
} else {
/* Register the CAN driver at "/dev/can0" */
int ret = can_register("/dev/can0", can);
if (ret < 0) {
PX4_ERR("can_register failed: %d", ret);
} else {
_fd = ::open("/dev/can0", O_RDWR | O_NONBLOCK);
}
}
return 0;
}
can_pilot.hpp :
#include <nuttx/config.h>
#include <px4_platform_common/px4_config.h>
/********************************************************************************
* Fonctions proto
********************************************************************************/
int init_can();
void can_send();
void can_read();
Here is my error message:
I really hope you have an idea to help me out.
Best regards.