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