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