Implemented Low Level Compunications
This commit is contained in:
26
can-interface/a
Normal file
26
can-interface/a
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
|
||||
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);
|
||||
Reference in New Issue
Block a user