test

Dependencies:   mbed Watchdog

Dependents:   STM32-MC_node

Committer:
ommpy
Date:
Mon Jul 06 17:18:59 2020 +0530
Revision:
0:d383e2dee0f7
first commit

Who changed what in which revision?

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