![]() |
![]() |
CAN driver implementation for a MSP432E4 CAN controller.
============================================================================
The CAN header file should be included in an application as follows:
The CANMSP432E4 driver is a (ring) buffered driver that stores data it may
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <ti/devices/msp432e4/inc/msp432.h>
#include <ti/devices/msp432e4/driverlib/gpio.h>
#include <ti/devices/msp432e4/driverlib/pin_map.h>
#include <ti/drivers/dpl/ClockP.h>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/dpl/SemaphoreP.h>
#include <ti/drivers/gpio/GPIOMSP432E4.h>
#include <ti/drivers/CAN.h>
#include <ti/drivers/utils/List.h>
#include <ti/drivers/utils/StructRingBuf.h>
Go to the source code of this file.
Data Structures | |
struct | CANMSP432E4_HWAttrs |
CANMSP432E4 Hardware attributes. More... | |
struct | CANMSP432E4_Object |
CANMSP432E4 Object. More... | |
Macros | |
#define | CANMSP432E4_PA0_CAN0RX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 0, GPIO_PA0_CAN0RX) |
PA0 is used for CAN0 RX. More... | |
#define | CANMSP432E4_PA1_CAN0TX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 1, GPIO_PA1_CAN0TX) |
PA1 is used for CAN0 RX. More... | |
#define | CANMSP432E4_PB0_CAN1RX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 0, GPIO_PB0_CAN1RX) |
PB0 is used for CAN1 RX. More... | |
#define | CANMSP432E4_PB1_CAN1TX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 1, GPIO_PB1_CAN1TX) |
PB1 is used for CAN1 RX. More... | |
Typedefs | |
typedef void(* | CANMSP432E4_ErrorCallback) (CAN_Handle handle, uint32_t error) |
The definition of an optional callback function used by the CAN driver to notify the application when a receive error (FIFO overrun, parity error, etc) occurs. More... | |
typedef struct CANMSP432E4_HWAttrs | CANMSP432E4_HWAttrs |
CANMSP432E4 Hardware attributes. More... | |
typedef struct CANMSP432E4_Object | CANMSP432E4_Object |
CANMSP432E4 Object. More... | |
typedef struct CANMSP432E4_Object * | CANMSP432E4_Handle |
Variables | |
const CAN_FxnTable | CANMSP432E4_fxnTable |
#define CANMSP432E4_PA0_CAN0RX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 0, GPIO_PA0_CAN0RX) |
PA0 is used for CAN0 RX.
#define CANMSP432E4_PA1_CAN0TX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 1, GPIO_PA1_CAN0TX) |
PA1 is used for CAN0 RX.
#define CANMSP432E4_PB0_CAN1RX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 0, GPIO_PB0_CAN1RX) |
PB0 is used for CAN1 RX.
#define CANMSP432E4_PB1_CAN1TX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 1, GPIO_PB1_CAN1TX) |
PB1 is used for CAN1 RX.
typedef void(* CANMSP432E4_ErrorCallback) (CAN_Handle handle, uint32_t error) |
The definition of an optional callback function used by the CAN driver to notify the application when a receive error (FIFO overrun, parity error, etc) occurs.
CAN_Handle | CAN_Handle |
error | The current value of the receive status register. Please refer to the device data sheet to interpret this value. |
typedef struct CANMSP432E4_HWAttrs CANMSP432E4_HWAttrs |
CANMSP432E4 Hardware attributes.
The baseAddr, intNum, and flowControl fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For MSP432E4 driverlib these definitions are found in:
intPriority is the CAN peripheral's interrupt priority, as defined by the underlying OS. It is passed unmodified to the underlying OS's interrupt handler creation code, so you need to refer to the OS documentation for usage. For example, for SYS/BIOS applications, refer to the ti.sysbios.family.arm.m3.Hwi documentation for SYS/BIOS usage of interrupt priorities. If the driver uses the ti.dpl interface instead of making OS calls directly, then the HwiP port handles the interrupt priority in an OS specific way. In the case of the SYS/BIOS port, intPriority is passed unmodified to Hwi_create().
A sample structure is shown below:
typedef struct CANMSP432E4_Object CANMSP432E4_Object |
CANMSP432E4 Object.
The application must not access any member variables of this structure!
typedef struct CANMSP432E4_Object * CANMSP432E4_Handle |
const CAN_FxnTable CANMSP432E4_fxnTable |