FRDM-K64F, Avnet M14A2A, Grove Shield, to create smart home system. In use with AT&Ts M2x & Flow.

Dependencies:   mbed FXOS8700CQ MODSERIAL

Committer:
jwhammel
Date:
Mon Apr 29 04:24:38 2019 +0000
Revision:
85:0cf65ceb4492
Parent:
84:fc8c9b39723a
We have added an alarm trigger that gets sent to AT&T Flow.

Who changed what in which revision?

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