#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();
    printf("START SEND:\n");
    //Listen loop
    while(true) {
        if(can0.readMessage(&rx) == MCP2515::ERROR_OK) {
            printf("New frame from ID: %10x\n", rx.can_id);
        }else{
          printf("SLEEP:\n");
        }
    }

    return 0;
}
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT