source: EcnlProtoTool/trunk/asp3_dcre/mbed/hal/can_api.h@ 321

Last change on this file since 321 was 321, checked in by coas-nagasima, 7 years ago

文字コードを設定

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.1 KB
Line 
1/* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16#ifndef MBED_CAN_API_H
17#define MBED_CAN_API_H
18
19#include "device.h"
20
21#if DEVICE_CAN
22
23#include "PinNames.h"
24#include "PeripheralNames.h"
25#include "can_helper.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31typedef enum {
32 IRQ_RX,
33 IRQ_TX,
34 IRQ_ERROR,
35 IRQ_OVERRUN,
36 IRQ_WAKEUP,
37 IRQ_PASSIVE,
38 IRQ_ARB,
39 IRQ_BUS,
40 IRQ_READY
41} CanIrqType;
42
43
44typedef enum {
45 MODE_RESET,
46 MODE_NORMAL,
47 MODE_SILENT,
48 MODE_TEST_LOCAL,
49 MODE_TEST_GLOBAL,
50 MODE_TEST_SILENT
51} CanMode;
52
53typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
54
55typedef struct can_s can_t;
56
57void can_init (can_t *obj, PinName rd, PinName td);
58void can_free (can_t *obj);
59int can_frequency(can_t *obj, int hz);
60
61void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
62void can_irq_free (can_t *obj);
63void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
64
65int can_write (can_t *obj, CAN_Message, int cc);
66int can_read (can_t *obj, CAN_Message *msg, int handle);
67int can_mode (can_t *obj, CanMode mode);
68int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
69void can_reset (can_t *obj);
70unsigned char can_rderror (can_t *obj);
71unsigned char can_tderror (can_t *obj);
72void can_monitor (can_t *obj, int silent);
73
74#ifdef __cplusplus
75};
76#endif
77
78#endif // MBED_CAN_API_H
79
80#endif
Note: See TracBrowser for help on using the repository browser.