1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef MBED_CAN_API_H
17 #define MBED_CAN_API_H
24 #include "PeripheralNames.h"
25 #include "can_helper.h"
53 typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
55 typedef struct can_s can_t;
57 void can_init (can_t *obj, PinName rd, PinName td);
58 void can_free (can_t *obj);
59 int can_frequency(can_t *obj, int hz);
61 void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
62 void can_irq_free (can_t *obj);
63 void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
65 int can_write (can_t *obj, CAN_Message, int cc);
66 int can_read (can_t *obj, CAN_Message *msg, int handle);
67 int can_mode (can_t *obj, CanMode mode);
68 int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
69 void can_reset (can_t *obj);
70 unsigned char can_rderror (can_t *obj);
71 unsigned char can_tderror (can_t *obj);
72 void can_monitor (can_t *obj, int silent);
78 #endif // MBED_CAN_API_H