initial

Dependencies:   mbed

Committer:
yihui
Date:
Mon Jan 11 02:32:24 2016 +0000
Revision:
0:638edba3adf6
initial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 0:638edba3adf6 1 /* mbed Microcontroller Library
yihui 0:638edba3adf6 2 * Copyright (c) 2006-2013 ARM Limited
yihui 0:638edba3adf6 3 *
yihui 0:638edba3adf6 4 * Licensed under the Apache License, Version 2.0 (the "License");
yihui 0:638edba3adf6 5 * you may not use this file except in compliance with the License.
yihui 0:638edba3adf6 6 * You may obtain a copy of the License at
yihui 0:638edba3adf6 7 *
yihui 0:638edba3adf6 8 * http://www.apache.org/licenses/LICENSE-2.0
yihui 0:638edba3adf6 9 *
yihui 0:638edba3adf6 10 * Unless required by applicable law or agreed to in writing, software
yihui 0:638edba3adf6 11 * distributed under the License is distributed on an "AS IS" BASIS,
yihui 0:638edba3adf6 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
yihui 0:638edba3adf6 13 * See the License for the specific language governing permissions and
yihui 0:638edba3adf6 14 * limitations under the License.
yihui 0:638edba3adf6 15 */
yihui 0:638edba3adf6 16 #ifndef MBED_CAN_HELPER_H
yihui 0:638edba3adf6 17 #define MBED_CAN_HELPER_H
yihui 0:638edba3adf6 18
yihui 0:638edba3adf6 19 #if DEVICE_CAN
yihui 0:638edba3adf6 20
yihui 0:638edba3adf6 21 #ifdef __cplusplus
yihui 0:638edba3adf6 22 extern "C" {
yihui 0:638edba3adf6 23 #endif
yihui 0:638edba3adf6 24
yihui 0:638edba3adf6 25 enum CANFormat {
yihui 0:638edba3adf6 26 CANStandard = 0,
yihui 0:638edba3adf6 27 CANExtended = 1,
yihui 0:638edba3adf6 28 CANAny = 2
yihui 0:638edba3adf6 29 };
yihui 0:638edba3adf6 30 typedef enum CANFormat CANFormat;
yihui 0:638edba3adf6 31
yihui 0:638edba3adf6 32 enum CANType {
yihui 0:638edba3adf6 33 CANData = 0,
yihui 0:638edba3adf6 34 CANRemote = 1
yihui 0:638edba3adf6 35 };
yihui 0:638edba3adf6 36 typedef enum CANType CANType;
yihui 0:638edba3adf6 37
yihui 0:638edba3adf6 38 struct CAN_Message {
yihui 0:638edba3adf6 39 unsigned int id; // 29 bit identifier
yihui 0:638edba3adf6 40 unsigned char data[8]; // Data field
yihui 0:638edba3adf6 41 unsigned char len; // Length of data field in bytes
yihui 0:638edba3adf6 42 CANFormat format; // 0 - STANDARD, 1- EXTENDED IDENTIFIER
yihui 0:638edba3adf6 43 CANType type; // 0 - DATA FRAME, 1 - REMOTE FRAME
yihui 0:638edba3adf6 44 };
yihui 0:638edba3adf6 45 typedef struct CAN_Message CAN_Message;
yihui 0:638edba3adf6 46
yihui 0:638edba3adf6 47 #ifdef __cplusplus
yihui 0:638edba3adf6 48 };
yihui 0:638edba3adf6 49 #endif
yihui 0:638edba3adf6 50
yihui 0:638edba3adf6 51 #endif
yihui 0:638edba3adf6 52
yihui 0:638edba3adf6 53 #endif // MBED_CAN_HELPER_H