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