Got MCP2521 to work
This commit is contained in:
@@ -3,10 +3,34 @@
|
||||
#include "mcp2521.hpp"
|
||||
#include "mcp2521_addresses.hpp"
|
||||
|
||||
void runIntHandler(void *arg) {
|
||||
MCP2521_Command_Interface *command_interface = (MCP2521_Command_Interface *)arg;
|
||||
command_interface->handleInterrupt();
|
||||
}
|
||||
|
||||
MCP2521_Command_Interface::MCP2521_Command_Interface(
|
||||
MCP2521_Hardware_Handle * hardware_handle
|
||||
) {
|
||||
this->hardware_handle = hardware_handle;
|
||||
this->hardware_handle->registerIntHandler(runIntHandler, (void *)this);
|
||||
|
||||
rx0_handler = NULL;
|
||||
rx1_handler = NULL;
|
||||
tx0_handler = NULL;
|
||||
tx1_handler = NULL;
|
||||
tx2_handler = NULL;
|
||||
error_handler = NULL;
|
||||
wakeup_handler = NULL;
|
||||
message_error_handler = NULL;
|
||||
|
||||
rx0_handler_arg = NULL;
|
||||
rx1_handler_arg = NULL;
|
||||
tx0_handler_arg = NULL;
|
||||
tx1_handler_arg = NULL;
|
||||
tx2_handler_arg = NULL;
|
||||
error_handler_arg = NULL;
|
||||
wakeup_handler_arg = NULL;
|
||||
message_error_handler_arg = NULL;
|
||||
}
|
||||
|
||||
void MCP2521_Command_Interface::reset() {
|
||||
@@ -35,7 +59,7 @@ void MCP2521_Command_Interface::write_reg(uint8_t address, uint8_t data) {
|
||||
}
|
||||
|
||||
void MCP2521_Command_Interface::write_tx_buf(MCP2521_TX_BUFFER buffer, MCP2521_BUFFER_TYPE type, uint8_t *data, size_t length) {
|
||||
uint8_t address = buffer | (type << 2);
|
||||
uint8_t address = (buffer << 1) | (type);
|
||||
hardware_handle->write(MCP2521_OP_LOAD_TX_BUFFER | address, data, length);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user