diff options
author | Karel Kočí <cynerd@email.cz> | 2016-03-08 16:10:33 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2016-03-08 16:10:33 +0100 |
commit | 5d29fe79d30f430ae326d9dc57ccfaed6fe61328 (patch) | |
tree | 8341804d561c0060176cbebc3f9a57c7c07f7816 /src/can | |
parent | 4e773191d447ac434536262a6f204dd991d4ad77 (diff) | |
download | avr-ioe-5d29fe79d30f430ae326d9dc57ccfaed6fe61328.tar.gz avr-ioe-5d29fe79d30f430ae326d9dc57ccfaed6fe61328.tar.bz2 avr-ioe-5d29fe79d30f430ae326d9dc57ccfaed6fe61328.zip |
Another full update of current work
Diffstat (limited to 'src/can')
-rw-r--r-- | src/can/mcp2515.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/can/mcp2515.c b/src/can/mcp2515.c new file mode 100644 index 0000000..8c9915c --- /dev/null +++ b/src/can/mcp2515.c @@ -0,0 +1,52 @@ +#include <can/mcp2515.h> + +#ifdef CONFIG_IOE_CAN_MCP2515 +// TODO check +#define CAN_MCP2515_RESET 0xC0 +#define CAN_MCP2515_READ 0x03 +#define CAN_MCP2515_READRX 0x90 +#define CAN_MCP2515_WRITE 0x02 +#define CAN_MCP2515_LOADTX 0x40 +#define CAN_MCP2515_RTS 0x80 +#define CAN_MCP2515_RDSTAT 0xA0 +#define CAN_MCP2515_RXSTAT 0xB0 +#define CAN_MCP2515_BITMOD 0x05 + +inline void can_mcp2515_init(canMcp2515 * can, uint8_t group, uint8_t mask) { + can->group = group; + can->mask = mask; + can_mcp2515_reset(can); + // TODO + return 0; +}; + +inline void can_mcp2515_reset(canMcp2515 * can) { + take_mutex(spi_mutex); + spi_join(); + + release_mutex(spi_mutex); +}; + +inline uint8_t can_mcp2515_read(canMcp2515 * can, uint8_t address) { +}; + +inline uint8_t can_mcp2515_readrx(canMcp2515 * can, uint8_t buffer) { +}; + +inline void can_mcp2515_write(canMcp2515 * can, uint8_t address, uint8_t data) { +}; + +inline void can_mcp2515_loadrx(canMcp2515 * can, uint8_t buffer, uint8_t data) { +}; + +inline uint8_t can_mcp2515_rdstat(canMcp2515 * can) { +}; + +inline uint8_t can_mcp2515_rxstat(canMcp2515 * can) { +}; + +inline void can_mcp2515_bitmod(canMcp2515 * can, uint8_t address, uint8_t mask, + uint8_t data) { +}; + +#endif /* CONFIG_IOE_CAN_MCP2515 */ |