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