lib

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Parent:
144:ef7eb2e8f9f7
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1
<> 149:156823d33999 2 /** \addtogroup hal */
<> 149:156823d33999 3 /** @{*/
<> 144:ef7eb2e8f9f7 4 /* mbed Microcontroller Library
<> 144:ef7eb2e8f9f7 5 * Copyright (c) 2006-2016 ARM Limited
<> 144:ef7eb2e8f9f7 6 *
<> 144:ef7eb2e8f9f7 7 * Licensed under the Apache License, Version 2.0 (the "License");
<> 144:ef7eb2e8f9f7 8 * you may not use this file except in compliance with the License.
<> 144:ef7eb2e8f9f7 9 * You may obtain a copy of the License at
<> 144:ef7eb2e8f9f7 10 *
<> 144:ef7eb2e8f9f7 11 * http://www.apache.org/licenses/LICENSE-2.0
<> 144:ef7eb2e8f9f7 12 *
<> 144:ef7eb2e8f9f7 13 * Unless required by applicable law or agreed to in writing, software
<> 144:ef7eb2e8f9f7 14 * distributed under the License is distributed on an "AS IS" BASIS,
<> 144:ef7eb2e8f9f7 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 144:ef7eb2e8f9f7 16 * See the License for the specific language governing permissions and
<> 144:ef7eb2e8f9f7 17 * limitations under the License.
<> 144:ef7eb2e8f9f7 18 */
<> 144:ef7eb2e8f9f7 19 #ifndef MBED_CAN_API_H
<> 144:ef7eb2e8f9f7 20 #define MBED_CAN_API_H
<> 144:ef7eb2e8f9f7 21
<> 144:ef7eb2e8f9f7 22 #include "device.h"
<> 144:ef7eb2e8f9f7 23
<> 144:ef7eb2e8f9f7 24 #if DEVICE_CAN
<> 144:ef7eb2e8f9f7 25
<> 144:ef7eb2e8f9f7 26 #include "PinNames.h"
<> 144:ef7eb2e8f9f7 27 #include "PeripheralNames.h"
<> 149:156823d33999 28 #include "hal/can_helper.h"
<> 144:ef7eb2e8f9f7 29
<> 144:ef7eb2e8f9f7 30 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 31 extern "C" {
<> 144:ef7eb2e8f9f7 32 #endif
<> 144:ef7eb2e8f9f7 33
<> 144:ef7eb2e8f9f7 34 typedef enum {
<> 144:ef7eb2e8f9f7 35 IRQ_RX,
<> 144:ef7eb2e8f9f7 36 IRQ_TX,
<> 144:ef7eb2e8f9f7 37 IRQ_ERROR,
<> 144:ef7eb2e8f9f7 38 IRQ_OVERRUN,
<> 144:ef7eb2e8f9f7 39 IRQ_WAKEUP,
<> 144:ef7eb2e8f9f7 40 IRQ_PASSIVE,
<> 144:ef7eb2e8f9f7 41 IRQ_ARB,
<> 144:ef7eb2e8f9f7 42 IRQ_BUS,
<> 144:ef7eb2e8f9f7 43 IRQ_READY
<> 144:ef7eb2e8f9f7 44 } CanIrqType;
<> 144:ef7eb2e8f9f7 45
<> 144:ef7eb2e8f9f7 46
<> 144:ef7eb2e8f9f7 47 typedef enum {
<> 144:ef7eb2e8f9f7 48 MODE_RESET,
<> 144:ef7eb2e8f9f7 49 MODE_NORMAL,
<> 144:ef7eb2e8f9f7 50 MODE_SILENT,
<> 144:ef7eb2e8f9f7 51 MODE_TEST_LOCAL,
<> 144:ef7eb2e8f9f7 52 MODE_TEST_GLOBAL,
<> 144:ef7eb2e8f9f7 53 MODE_TEST_SILENT
<> 144:ef7eb2e8f9f7 54 } CanMode;
<> 144:ef7eb2e8f9f7 55
<> 144:ef7eb2e8f9f7 56 typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
<> 144:ef7eb2e8f9f7 57
<> 144:ef7eb2e8f9f7 58 typedef struct can_s can_t;
<> 144:ef7eb2e8f9f7 59
<> 144:ef7eb2e8f9f7 60 void can_init (can_t *obj, PinName rd, PinName td);
<> 144:ef7eb2e8f9f7 61 void can_free (can_t *obj);
<> 144:ef7eb2e8f9f7 62 int can_frequency(can_t *obj, int hz);
<> 144:ef7eb2e8f9f7 63
<> 144:ef7eb2e8f9f7 64 void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
<> 144:ef7eb2e8f9f7 65 void can_irq_free (can_t *obj);
<> 144:ef7eb2e8f9f7 66 void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
<> 144:ef7eb2e8f9f7 67
<> 144:ef7eb2e8f9f7 68 int can_write (can_t *obj, CAN_Message, int cc);
<> 144:ef7eb2e8f9f7 69 int can_read (can_t *obj, CAN_Message *msg, int handle);
<> 144:ef7eb2e8f9f7 70 int can_mode (can_t *obj, CanMode mode);
<> 144:ef7eb2e8f9f7 71 int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
<> 144:ef7eb2e8f9f7 72 void can_reset (can_t *obj);
<> 144:ef7eb2e8f9f7 73 unsigned char can_rderror (can_t *obj);
<> 144:ef7eb2e8f9f7 74 unsigned char can_tderror (can_t *obj);
<> 144:ef7eb2e8f9f7 75 void can_monitor (can_t *obj, int silent);
<> 144:ef7eb2e8f9f7 76
<> 144:ef7eb2e8f9f7 77 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 78 };
<> 144:ef7eb2e8f9f7 79 #endif
<> 144:ef7eb2e8f9f7 80
<> 144:ef7eb2e8f9f7 81 #endif // MBED_CAN_API_H
<> 144:ef7eb2e8f9f7 82
<> 144:ef7eb2e8f9f7 83 #endif
<> 149:156823d33999 84
<> 149:156823d33999 85 /** @}*/