KenshiroProgram Ver1.0

Dependencies:   mbed QEI ros_lib_kinetic USBDevice

Committer:
ksingyuunyuu
Date:
Sat May 25 14:09:18 2019 +0000
Revision:
2:e59b809f9e0a
Parent:
1:979cc2a56e7e
F446_rosserial_V7_EncoderVersion Ver1.0

Who changed what in which revision?

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