16#define CAN_BAUD 1000000
40 void attach (Callback<
void()>
func, CAN::IrqType type = CAN::IrqType::RxIrq){
61 if (
can.read(rxMsg)) {
62 int err =
can.rderror();
64 printf(
"[%d CAN Read Errors] on CANBus_%d\n", err, canbus + 1);
69 for(
int i = 0;
i < 8;
i ++){
79 bool rawRead(
int *
id, uint8_t bytes[],
int length){
83 if (
can.read(rxMsg)) {
84 int err =
can.rderror();
86 printf(
"[%d CAN Read Errors]\n", err);
91 for(
int i = 0;
i < length;
i ++){
108 printf(
" ID = 0x%.3x\t", msg.id);
109 for (
int i = 0;
i < msg.len;
i++)
110 printf(
" 0x%.2X", msg.data[
i]);
122 static int errorCount = 0;
126 for(
int i = 0;
i < 8;
i++){
127 txMsg << int8_t(bytes[
i]);
132 bool isWrite =
can.write(txMsg);
142 if (errorCount > 1000){
int i
Definition BiCGSTAB_step_by_step.cpp:9
#define CAN_BAUD
__/ _ / // (_-</ -_)\ \/ _ \/ _/ _ ‘/ _ \/ -_) __/ __/ / /__/ _ \/ ’ \/ -_|_-</ /_/ / _ \/ __/ -_)/ /...
Definition CANHandler.h:16
Definition CANHandler.h:18
CAN can
Definition CANHandler.h:25
bool rawSend(int id, int8_t bytes[])
Raw sending of CAN Messages.
Definition CANHandler.h:121
CANBus
Definition CANHandler.h:27
@ CANBUS_2
Definition CANHandler.h:27
@ CANBUS_1
Definition CANHandler.h:27
@ NOBUS
Definition CANHandler.h:27
void attach(Callback< void()> func, CAN::IrqType type=CAN::IrqType::RxIrq)
Definition CANHandler.h:40
void updateCANs(PinName canRx, PinName canTx)
Definition CANHandler.h:44
static void printMsg(CANMessage &msg)
Prints a CANMessage nicely.
Definition CANHandler.h:106
CANHandler(PinName canRx, PinName canTx)
Definition CANHandler.h:36
CANHandler()
Definition CANHandler.h:32
bool rawRead(int *id, uint8_t bytes[], int length)
Definition CANHandler.h:79
bool getFeedback(int *id, uint8_t bytes[], int canbus)
Get feedback back from the motor.
Definition CANHandler.h:57
CAN * getCAN()
Definition CANHandler.h:49
bool exists
Definition CANHandler.h:29
void clear(void)
Definition CANMsg.h:35
Definition benchGeometry.cpp:23