游戏王对战板,目前code还是空的

Committer:
WFKnight
Date:
Thu Jun 21 13:51:43 2018 +0000
Revision:
0:9b3d4731edbb
UART, RTOS, LED

Who changed what in which revision?

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