source: azure_iot_hub/trunk/asp3_dcre/mbed/hal/can_api.h@ 388

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

Azure IoT Hub Device C SDK を使ったサンプルの追加

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