File syn_can.c¶
FileList > drivers > syn_can.c
Go to the source code of this file
CAN bus driver implementation.
#include "../util/syn_assert.h"#include "syn_can.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_can_init (SYN_CAN * can, uint8_t port, uint32_t bitrate) Initialize CAN driver. |
| void | syn_can_on_receive (SYN_CAN * can, SYN_CAN_Callback cb, void * ctx) Register receive callback. |
| void | syn_can_poll (SYN_CAN * can) Poll for received frames and dispatch callback. |
| bool | syn_can_send (SYN_CAN * can, const SYN_CAN_Frame * frame) Send a CAN frame. |
| void | syn_can_set_filter (const SYN_CAN * can, uint32_t id, uint32_t mask) Set hardware acceptance filter. |
Public Functions Documentation¶
function syn_can_init¶
Initialize CAN driver.
Parameters:
canCAN instance.portCAN peripheral port number.bitrateBitrate in bps (e.g. 500000).
Returns:
SYN_OK on success.
function syn_can_on_receive¶
Register receive callback.
Parameters:
canCAN instance.cbCallback function.ctxUser context.
function syn_can_poll¶
Poll for received frames and dispatch callback.
Call from your main loop.
Parameters:
canCAN instance.
function syn_can_send¶
Send a CAN frame.
Parameters:
canCAN instance.frameFrame to send.
Returns:
true if frame was queued successfully.
function syn_can_set_filter¶
Set hardware acceptance filter.
Parameters:
canCAN instance.idFilter ID.maskFilter mask.
The documentation for this class was generated from the following file src/syntropic/drivers/syn_can.c