this hurts

Dependencies:   FFT

Committer:
shyamgatech
Date:
Thu Dec 03 18:15:35 2020 +0000
Revision:
7:0d62545e6d73
Parent:
0:d6c9b09b4042
addded gui mbed code;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
annieluo2 0:d6c9b09b4042 1
annieluo2 0:d6c9b09b4042 2 /** \addtogroup hal */
annieluo2 0:d6c9b09b4042 3 /** @{*/
annieluo2 0:d6c9b09b4042 4 /* mbed Microcontroller Library
annieluo2 0:d6c9b09b4042 5 * Copyright (c) 2006-2016 ARM Limited
annieluo2 0:d6c9b09b4042 6 *
annieluo2 0:d6c9b09b4042 7 * Licensed under the Apache License, Version 2.0 (the "License");
annieluo2 0:d6c9b09b4042 8 * you may not use this file except in compliance with the License.
annieluo2 0:d6c9b09b4042 9 * You may obtain a copy of the License at
annieluo2 0:d6c9b09b4042 10 *
annieluo2 0:d6c9b09b4042 11 * http://www.apache.org/licenses/LICENSE-2.0
annieluo2 0:d6c9b09b4042 12 *
annieluo2 0:d6c9b09b4042 13 * Unless required by applicable law or agreed to in writing, software
annieluo2 0:d6c9b09b4042 14 * distributed under the License is distributed on an "AS IS" BASIS,
annieluo2 0:d6c9b09b4042 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
annieluo2 0:d6c9b09b4042 16 * See the License for the specific language governing permissions and
annieluo2 0:d6c9b09b4042 17 * limitations under the License.
annieluo2 0:d6c9b09b4042 18 */
annieluo2 0:d6c9b09b4042 19 #ifndef MBED_CAN_API_H
annieluo2 0:d6c9b09b4042 20 #define MBED_CAN_API_H
annieluo2 0:d6c9b09b4042 21
annieluo2 0:d6c9b09b4042 22 #include "device.h"
annieluo2 0:d6c9b09b4042 23
annieluo2 0:d6c9b09b4042 24 #if DEVICE_CAN
annieluo2 0:d6c9b09b4042 25
annieluo2 0:d6c9b09b4042 26 #include "PinNames.h"
annieluo2 0:d6c9b09b4042 27 #include "PeripheralNames.h"
annieluo2 0:d6c9b09b4042 28 #include "hal/can_helper.h"
annieluo2 0:d6c9b09b4042 29
annieluo2 0:d6c9b09b4042 30 #ifdef __cplusplus
annieluo2 0:d6c9b09b4042 31 extern "C" {
annieluo2 0:d6c9b09b4042 32 #endif
annieluo2 0:d6c9b09b4042 33
annieluo2 0:d6c9b09b4042 34 typedef enum {
annieluo2 0:d6c9b09b4042 35 IRQ_RX,
annieluo2 0:d6c9b09b4042 36 IRQ_TX,
annieluo2 0:d6c9b09b4042 37 IRQ_ERROR,
annieluo2 0:d6c9b09b4042 38 IRQ_OVERRUN,
annieluo2 0:d6c9b09b4042 39 IRQ_WAKEUP,
annieluo2 0:d6c9b09b4042 40 IRQ_PASSIVE,
annieluo2 0:d6c9b09b4042 41 IRQ_ARB,
annieluo2 0:d6c9b09b4042 42 IRQ_BUS,
annieluo2 0:d6c9b09b4042 43 IRQ_READY
annieluo2 0:d6c9b09b4042 44 } CanIrqType;
annieluo2 0:d6c9b09b4042 45
annieluo2 0:d6c9b09b4042 46
annieluo2 0:d6c9b09b4042 47 typedef enum {
annieluo2 0:d6c9b09b4042 48 MODE_RESET,
annieluo2 0:d6c9b09b4042 49 MODE_NORMAL,
annieluo2 0:d6c9b09b4042 50 MODE_SILENT,
annieluo2 0:d6c9b09b4042 51 MODE_TEST_LOCAL,
annieluo2 0:d6c9b09b4042 52 MODE_TEST_GLOBAL,
annieluo2 0:d6c9b09b4042 53 MODE_TEST_SILENT
annieluo2 0:d6c9b09b4042 54 } CanMode;
annieluo2 0:d6c9b09b4042 55
annieluo2 0:d6c9b09b4042 56 typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
annieluo2 0:d6c9b09b4042 57
annieluo2 0:d6c9b09b4042 58 typedef struct can_s can_t;
annieluo2 0:d6c9b09b4042 59
annieluo2 0:d6c9b09b4042 60 void can_init (can_t *obj, PinName rd, PinName td);
annieluo2 0:d6c9b09b4042 61 void can_free (can_t *obj);
annieluo2 0:d6c9b09b4042 62 int can_frequency(can_t *obj, int hz);
annieluo2 0:d6c9b09b4042 63
annieluo2 0:d6c9b09b4042 64 void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
annieluo2 0:d6c9b09b4042 65 void can_irq_free (can_t *obj);
annieluo2 0:d6c9b09b4042 66 void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
annieluo2 0:d6c9b09b4042 67
annieluo2 0:d6c9b09b4042 68 int can_write (can_t *obj, CAN_Message, int cc);
annieluo2 0:d6c9b09b4042 69 int can_read (can_t *obj, CAN_Message *msg, int handle);
annieluo2 0:d6c9b09b4042 70 int can_mode (can_t *obj, CanMode mode);
annieluo2 0:d6c9b09b4042 71 int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
annieluo2 0:d6c9b09b4042 72 void can_reset (can_t *obj);
annieluo2 0:d6c9b09b4042 73 unsigned char can_rderror (can_t *obj);
annieluo2 0:d6c9b09b4042 74 unsigned char can_tderror (can_t *obj);
annieluo2 0:d6c9b09b4042 75 void can_monitor (can_t *obj, int silent);
annieluo2 0:d6c9b09b4042 76
annieluo2 0:d6c9b09b4042 77 #ifdef __cplusplus
annieluo2 0:d6c9b09b4042 78 };
annieluo2 0:d6c9b09b4042 79 #endif
annieluo2 0:d6c9b09b4042 80
annieluo2 0:d6c9b09b4042 81 #endif // MBED_CAN_API_H
annieluo2 0:d6c9b09b4042 82
annieluo2 0:d6c9b09b4042 83 #endif
annieluo2 0:d6c9b09b4042 84
annieluo2 0:d6c9b09b4042 85 /** @}*/