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