Files
gobot/can-interface/a
2024-10-14 09:19:00 +02:00

26 lines
646 B
Plaintext

txBuffer[0] = 0b00000011; // Read Instruction
txBuffer[1] = 0x0f; // CANCTRL Register Address
spi_transaction_t transaction0 = { // RESET
.cmd = 0b11000000,
.length = 3 * 8,
.rxlength = 3 * 8,
.tx_buffer = txBuffer,
.rx_buffer = rxBuffer
};
spi_transaction_t transaction1 = { // READ STAT/S
.cmd = 0b10110000,
.length = 2 * 8,
.rxlength = 2 * 8,
.tx_buffer = txBuffer,
.rx_buffer = rxBuffer
};
vTaskDelay(100 / portTICK_PERIOD_MS);
gpio_set_level(EXTERNAL_TRIGGER, false);
spi_device_transmit(mp2125_handle, &transaction0);