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