From Ben Katz mbed-dev library. Removed unnecessary target files to reduce the overall size by a factor of 10 to make it easier to import into the online IDE.
Dependents: motor_driver motor_driver_screaming_fix
hal/can_helper.h@0:083111ae2a11, 2020-11-26 (annotated)
- Committer:
- saloutos
- Date:
- Thu Nov 26 04:08:56 2020 +0000
- Revision:
- 0:083111ae2a11
first commit of leaned mbed dev lib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
saloutos | 0:083111ae2a11 | 1 | |
saloutos | 0:083111ae2a11 | 2 | /** \addtogroup hal */ |
saloutos | 0:083111ae2a11 | 3 | /** @{*/ |
saloutos | 0:083111ae2a11 | 4 | /* mbed Microcontroller Library |
saloutos | 0:083111ae2a11 | 5 | * Copyright (c) 2006-2013 ARM Limited |
saloutos | 0:083111ae2a11 | 6 | * |
saloutos | 0:083111ae2a11 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
saloutos | 0:083111ae2a11 | 8 | * you may not use this file except in compliance with the License. |
saloutos | 0:083111ae2a11 | 9 | * You may obtain a copy of the License at |
saloutos | 0:083111ae2a11 | 10 | * |
saloutos | 0:083111ae2a11 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
saloutos | 0:083111ae2a11 | 12 | * |
saloutos | 0:083111ae2a11 | 13 | * Unless required by applicable law or agreed to in writing, software |
saloutos | 0:083111ae2a11 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
saloutos | 0:083111ae2a11 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
saloutos | 0:083111ae2a11 | 16 | * See the License for the specific language governing permissions and |
saloutos | 0:083111ae2a11 | 17 | * limitations under the License. |
saloutos | 0:083111ae2a11 | 18 | */ |
saloutos | 0:083111ae2a11 | 19 | #ifndef MBED_CAN_HELPER_H |
saloutos | 0:083111ae2a11 | 20 | #define MBED_CAN_HELPER_H |
saloutos | 0:083111ae2a11 | 21 | |
saloutos | 0:083111ae2a11 | 22 | #if DEVICE_CAN |
saloutos | 0:083111ae2a11 | 23 | |
saloutos | 0:083111ae2a11 | 24 | #ifdef __cplusplus |
saloutos | 0:083111ae2a11 | 25 | extern "C" { |
saloutos | 0:083111ae2a11 | 26 | #endif |
saloutos | 0:083111ae2a11 | 27 | |
saloutos | 0:083111ae2a11 | 28 | /** |
saloutos | 0:083111ae2a11 | 29 | * |
saloutos | 0:083111ae2a11 | 30 | * \enum CANFormat |
saloutos | 0:083111ae2a11 | 31 | * |
saloutos | 0:083111ae2a11 | 32 | * \brief Values that represent CAN Format |
saloutos | 0:083111ae2a11 | 33 | **/ |
saloutos | 0:083111ae2a11 | 34 | enum CANFormat { |
saloutos | 0:083111ae2a11 | 35 | CANStandard = 0, |
saloutos | 0:083111ae2a11 | 36 | CANExtended = 1, |
saloutos | 0:083111ae2a11 | 37 | CANAny = 2 |
saloutos | 0:083111ae2a11 | 38 | }; |
saloutos | 0:083111ae2a11 | 39 | typedef enum CANFormat CANFormat; |
saloutos | 0:083111ae2a11 | 40 | |
saloutos | 0:083111ae2a11 | 41 | /** |
saloutos | 0:083111ae2a11 | 42 | * |
saloutos | 0:083111ae2a11 | 43 | * \enum CANType |
saloutos | 0:083111ae2a11 | 44 | * |
saloutos | 0:083111ae2a11 | 45 | * \brief Values that represent CAN Type |
saloutos | 0:083111ae2a11 | 46 | **/ |
saloutos | 0:083111ae2a11 | 47 | enum CANType { |
saloutos | 0:083111ae2a11 | 48 | CANData = 0, |
saloutos | 0:083111ae2a11 | 49 | CANRemote = 1 |
saloutos | 0:083111ae2a11 | 50 | }; |
saloutos | 0:083111ae2a11 | 51 | typedef enum CANType CANType; |
saloutos | 0:083111ae2a11 | 52 | |
saloutos | 0:083111ae2a11 | 53 | /** |
saloutos | 0:083111ae2a11 | 54 | * |
saloutos | 0:083111ae2a11 | 55 | * \struct CAN_Message |
saloutos | 0:083111ae2a11 | 56 | * |
saloutos | 0:083111ae2a11 | 57 | * \brief Holder for single CAN message. |
saloutos | 0:083111ae2a11 | 58 | * |
saloutos | 0:083111ae2a11 | 59 | **/ |
saloutos | 0:083111ae2a11 | 60 | struct CAN_Message { |
saloutos | 0:083111ae2a11 | 61 | unsigned int id; // 29 bit identifier |
saloutos | 0:083111ae2a11 | 62 | unsigned char data[8]; // Data field |
saloutos | 0:083111ae2a11 | 63 | unsigned char len; // Length of data field in bytes |
saloutos | 0:083111ae2a11 | 64 | CANFormat format; // Format ::CANFormat |
saloutos | 0:083111ae2a11 | 65 | CANType type; // Type ::CANType |
saloutos | 0:083111ae2a11 | 66 | }; |
saloutos | 0:083111ae2a11 | 67 | typedef struct CAN_Message CAN_Message; |
saloutos | 0:083111ae2a11 | 68 | |
saloutos | 0:083111ae2a11 | 69 | #ifdef __cplusplus |
saloutos | 0:083111ae2a11 | 70 | }; |
saloutos | 0:083111ae2a11 | 71 | #endif |
saloutos | 0:083111ae2a11 | 72 | |
saloutos | 0:083111ae2a11 | 73 | #endif |
saloutos | 0:083111ae2a11 | 74 | |
saloutos | 0:083111ae2a11 | 75 | #endif // MBED_CAN_HELPER_H |
saloutos | 0:083111ae2a11 | 76 | |
saloutos | 0:083111ae2a11 | 77 | /** @}*/ |