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