Home Alert System

Dependencies:   PWM_Tone_Library DHT

Committer:
aziz111
Date:
Fri Mar 08 17:15:02 2019 +0000
Revision:
5:569a4894abc1
Parent:
3:78f223d34f36
Final

Who changed what in which revision?

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