📄 lpc_can.h
字号:
#ifndef __LPC_SPI_H
#define __LPC_CAN_H
/***********************************************************************
* BU MMS China, Philips Semiconductor Software Support
* Embest info&Tech Co. Software Support
*---------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. Everybody can use it as
* it is opened and without copyright. We will not take any law responsibility
* for any problem produced by using this software.
*---------------------------------------------------------------------------
* File name: LPC_CAN.h
* Description: Define CAN structure and relative micro
*
* History:
* 1. Date: Nov 20, 2004
* Author: Shawn Zhang
* Description: Create
*
* $Revision: 1.0 $
**********************************************************************/
#include "LPC_Base.h"
#include "LPC_Type.h"
#include "LPC_SysControl.h"
#define CAN_MAXDEVNUM 4 // Max device number
#define CAN_MAXSPEED 1000000 // CAN max speed: 1M bits/s
#define CAN_ADDR_OFFSET 0x4000
// Default value of TSEG1/2
#define TSEG1_VALUE 0xC
#define TSEG2_VALUE 0x1
/* CAN mode descriptions */
#define MOD_RM 0x1 // Reset Mode
#define MOD_LOM 0x2 // Listen Only Mode
#define MOD_STM 0x4 // Self Test Mode
#define MOD_TPM 0x8 // Tx Priority Fields
#define MOD_SM 0x10 // Sleep Mode
#define MOD_RPM 0x20 // Reverse Polarity Mode
#define MOD_TM 0x80 // Test Mode
/* Bus Timing bit descriptions */
#define BTR_BRP_BIT 0
#define BTR_SJW_BIT 14
#define BTR_TSEG1_BIT 16
#define BTR_TSEG2_BIT 19
#define BTR_SAM_BIT 23
/* Device number */
typedef enum {
CAN1 = 1,
CAN2,
CAN3,
CAN4
} LPC_CAN_Channel_t;
// Type definition to hold a CAN message
typedef struct
{
unsigned int Frame; // Bits 16..19: DLC - Data Length Counter
// Bit 30: Set if this is a RTR message
// Bit 31: Set if this is a 29-bit ID message
unsigned int MsgID; // CAN Message ID (11-bit or 29-bit)
unsigned int DatA; // CAN Message Data Bytes 0-3
unsigned int DatB; // CAN Message Data Bytes 4-7
} LPC_CAN_MSG_t;
#endif // __LPC_CAN_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -