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.
Fork of mbed-src by
can_api.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_CAN_API_H 00017 #define MBED_CAN_API_H 00018 00019 #include "device.h" 00020 00021 #if DEVICE_CAN 00022 00023 #include "PinNames.h" 00024 #include "PeripheralNames.h" 00025 #include "can_helper.h" 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 typedef enum { 00032 IRQ_RX, 00033 IRQ_TX, 00034 IRQ_ERROR, 00035 IRQ_OVERRUN, 00036 IRQ_WAKEUP, 00037 IRQ_PASSIVE, 00038 IRQ_ARB, 00039 IRQ_BUS, 00040 IRQ_READY 00041 } CanIrqType; 00042 00043 00044 typedef enum { 00045 MODE_RESET, 00046 MODE_NORMAL, 00047 MODE_SILENT, 00048 MODE_TEST_GLOBAL, 00049 MODE_TEST_LOCAL, 00050 MODE_TEST_SILENT 00051 } CanMode; 00052 00053 typedef void (*can_irq_handler)(uint32_t id, CanIrqType type); 00054 00055 typedef struct can_s can_t; 00056 00057 void can_init (can_t *obj, PinName rd, PinName td); 00058 void can_free (can_t *obj); 00059 int can_frequency(can_t *obj, int hz); 00060 00061 void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id); 00062 void can_irq_free (can_t *obj); 00063 void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable); 00064 00065 int can_write (can_t *obj, CAN_Message, int cc); 00066 int can_read (can_t *obj, CAN_Message *msg, int handle); 00067 int can_mode (can_t *obj, CanMode mode); 00068 int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle); 00069 void can_reset (can_t *obj); 00070 unsigned char can_rderror (can_t *obj); 00071 unsigned char can_tderror (can_t *obj); 00072 void can_monitor (can_t *obj, int silent); 00073 00074 #ifdef __cplusplus 00075 }; 00076 #endif 00077 00078 #endif // MBED_CAN_API_H 00079 00080 #endif
Generated on Tue Jul 12 2022 21:21:33 by
