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