#include <stdio.h>
#include "pico/stdlib.h"
#include "mcp2515.h"
//MCP2515(spi_inst_t* CHANNEL, uint8_t CS_PIN, uint8_t TX_PIN, uint8_t RX_PIN, uint8_t SCK_PIN, uint32_t SPI_CLOCK)
MCP2515 can0(0, 17, 19, 16,18);
//MCP2515 can0;
struct can_frame rx;
int main() {
stdio_init_all();
//Initialize interface
can0.reset();
can0.setBitrate(CAN_125KBPS, MCP_8MHZ);
can0.setNormalMode();
//Listen loop
while(true) {
if(can0.readMessage(&rx) == MCP2515::ERROR_OK) {
printf("New frame from ID: %10x\n", rx.can_id);
}
}
return 0;
}