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