#include <stdio.h>
#include "pico/stdlib.h"
#include "bsp_xl2515.h"

int main()
{
    uint32_t id = 0x123;
    uint8_t data[8] = {0x12, 0x34, 0x56, 0x78, 0x87, 0x65, 0x43, 0x21};
    uint8_t recv_data[8];
    uint8_t recv_len = 0;
    stdio_init_all(); 
    xl2515_init(KBPS125);
    while (true) {
        printf("Hello, world!\n");
        xl2515_send(id, data, 8);
        if (xl2515_recv(id, recv_data, &recv_len))
        {
            printf("recv: ");
            for (uint8_t i = 0; i < recv_len; i++)
            {
                printf("%02x ", recv_data[i]);
            }
            printf("\r\n");
        }
        sleep_ms(1000);
    }
}
