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 CANnucleo 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 * Modified by Zoltan Hudak <hudakz@inbox.com> 00017 * 00018 */ 00019 #ifndef MBED_CAN_API_H 00020 #define MBED_CAN_API_H 00021 00022 #include "device.h" 00023 #include "PinNames.h" 00024 #include "PeripheralNames.h" 00025 #include "can_helper.h" 00026 00027 //#define DEBUG 1 00028 00029 #undef CAN 00030 00031 #if defined(TARGET_NUCLEO_F072RB) || \ 00032 defined(TARGET_NUCLEO_F091RC) 00033 #include "stm32f0xx_hal_msp.h" 00034 #elif defined(TARGET_NUCLEO_F103RB) 00035 #include "stm32f1xx_hal_msp.h" 00036 #elif defined(TARGET_NUCLEO_F302R8) || \ 00037 defined(TARGET_NUCLEO_F303RE) || \ 00038 defined(TARGET_NUCLEO_F303K8) || \ 00039 defined(TARGET_NUCLEO_F334R8) || \ 00040 defined(TARGET_DISCO_F334C8) 00041 #include "stm32f3xx_hal_msp.h" 00042 #elif defined(TARGET_NUCLEO_F446RE) 00043 #include "stm32f4xx_hal_msp.h" 00044 #endif 00045 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00050 typedef enum { 00051 IRQ_RX, 00052 IRQ_TX, 00053 IRQ_ERROR, 00054 IRQ_OVERRUN, 00055 IRQ_WAKEUP, 00056 IRQ_PASSIVE, 00057 IRQ_ARB, 00058 IRQ_BUS, 00059 IRQ_READY 00060 } CanIrqType; 00061 00062 00063 typedef enum { 00064 MODE_RESET, 00065 MODE_NORMAL, 00066 MODE_SILENT, 00067 MODE_TEST_GLOBAL, 00068 MODE_TEST_LOCAL, 00069 MODE_TEST_SILENT 00070 } CanMode; 00071 00072 typedef void (*can_irq_handler)(uint32_t id, CanIrqType type); 00073 00074 void can_init (PinName rd, PinName td, FunctionalState abom); 00075 void can_free (void); 00076 int can_frequency(int hz); 00077 void can_irq_init (uint32_t id, can_irq_handler handler); 00078 void can_irq_free (void); 00079 int can_write (CAN_Message, int cc); 00080 int can_read (CAN_Message *msg, int handle); 00081 int can_mode (CanMode mode); 00082 int can_filter (uint32_t id, uint32_t mask, CANFormat format, int32_t handle); 00083 void can_reset (void); 00084 unsigned char can_rderror (void); 00085 unsigned char can_tderror (void); 00086 void can_monitor (int silent); 00087 void can_callback (void); 00088 00089 #ifdef __cplusplus 00090 }; 00091 #endif 00092 00093 #endif // MBED_CAN_API_H 00094 00095
Generated on Sat Jul 16 2022 06:49:00 by
1.7.2
