Mbed SDK for XRange SX1272 LoRa module
Dependents: XRangePingPong XRange-LoRaWAN-lmic-app lora-transceiver
SX1272 LoRa RF module
https://www.netblocks.eu/xrange-sx1272-lora-datasheet/
hal/can_api.h@15:4892fe388435, 2013-08-07 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Aug 07 16:43:59 2013 +0300
- Revision:
- 15:4892fe388435
- Parent:
- 13:0645d8841f51
- Child:
- 41:e8b66477f5bf
Added LPC4088 target and interrupt chaining code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 13:0645d8841f51 | 1 | /* mbed Microcontroller Library |
bogdanm | 13:0645d8841f51 | 2 | * Copyright (c) 2006-2013 ARM Limited |
bogdanm | 13:0645d8841f51 | 3 | * |
bogdanm | 13:0645d8841f51 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
bogdanm | 13:0645d8841f51 | 5 | * you may not use this file except in compliance with the License. |
bogdanm | 13:0645d8841f51 | 6 | * You may obtain a copy of the License at |
bogdanm | 13:0645d8841f51 | 7 | * |
bogdanm | 13:0645d8841f51 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
bogdanm | 13:0645d8841f51 | 9 | * |
bogdanm | 13:0645d8841f51 | 10 | * Unless required by applicable law or agreed to in writing, software |
bogdanm | 13:0645d8841f51 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
bogdanm | 13:0645d8841f51 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
bogdanm | 13:0645d8841f51 | 13 | * See the License for the specific language governing permissions and |
bogdanm | 13:0645d8841f51 | 14 | * limitations under the License. |
bogdanm | 13:0645d8841f51 | 15 | */ |
bogdanm | 13:0645d8841f51 | 16 | #ifndef MBED_CAN_API_H |
bogdanm | 13:0645d8841f51 | 17 | #define MBED_CAN_API_H |
bogdanm | 13:0645d8841f51 | 18 | |
bogdanm | 13:0645d8841f51 | 19 | #include "device.h" |
bogdanm | 13:0645d8841f51 | 20 | |
bogdanm | 13:0645d8841f51 | 21 | #if DEVICE_CAN |
bogdanm | 13:0645d8841f51 | 22 | |
bogdanm | 13:0645d8841f51 | 23 | #include "PinNames.h" |
bogdanm | 13:0645d8841f51 | 24 | #include "PeripheralNames.h" |
bogdanm | 13:0645d8841f51 | 25 | #include "can_helper.h" |
bogdanm | 13:0645d8841f51 | 26 | |
bogdanm | 13:0645d8841f51 | 27 | #ifdef __cplusplus |
bogdanm | 13:0645d8841f51 | 28 | extern "C" { |
bogdanm | 13:0645d8841f51 | 29 | #endif |
bogdanm | 13:0645d8841f51 | 30 | |
bogdanm | 15:4892fe388435 | 31 | typedef enum { |
bogdanm | 15:4892fe388435 | 32 | IRQ_RX, |
bogdanm | 15:4892fe388435 | 33 | IRQ_TX, |
bogdanm | 15:4892fe388435 | 34 | IRQ_ERROR, |
bogdanm | 15:4892fe388435 | 35 | IRQ_OVERRUN, |
bogdanm | 15:4892fe388435 | 36 | IRQ_WAKEUP, |
bogdanm | 15:4892fe388435 | 37 | IRQ_PASSIVE, |
bogdanm | 15:4892fe388435 | 38 | IRQ_ARB, |
bogdanm | 15:4892fe388435 | 39 | IRQ_BUS, |
bogdanm | 15:4892fe388435 | 40 | IRQ_READY |
bogdanm | 15:4892fe388435 | 41 | } CanIrqType; |
bogdanm | 15:4892fe388435 | 42 | |
bogdanm | 15:4892fe388435 | 43 | |
bogdanm | 15:4892fe388435 | 44 | typedef enum { |
bogdanm | 15:4892fe388435 | 45 | MODE_RESET, |
bogdanm | 15:4892fe388435 | 46 | MODE_NORMAL, |
bogdanm | 15:4892fe388435 | 47 | MODE_SILENT, |
bogdanm | 15:4892fe388435 | 48 | MODE_TEST_GLOBAL, |
bogdanm | 15:4892fe388435 | 49 | MODE_TEST_LOCAL, |
bogdanm | 15:4892fe388435 | 50 | MODE_TEST_SILENT |
bogdanm | 15:4892fe388435 | 51 | } CanMode; |
bogdanm | 15:4892fe388435 | 52 | |
bogdanm | 15:4892fe388435 | 53 | typedef void (*can_irq_handler)(uint32_t id, CanIrqType type); |
bogdanm | 15:4892fe388435 | 54 | |
bogdanm | 13:0645d8841f51 | 55 | typedef struct can_s can_t; |
bogdanm | 13:0645d8841f51 | 56 | |
bogdanm | 13:0645d8841f51 | 57 | void can_init (can_t *obj, PinName rd, PinName td); |
bogdanm | 13:0645d8841f51 | 58 | void can_free (can_t *obj); |
bogdanm | 13:0645d8841f51 | 59 | int can_frequency(can_t *obj, int hz); |
bogdanm | 15:4892fe388435 | 60 | |
bogdanm | 15:4892fe388435 | 61 | void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id); |
bogdanm | 15:4892fe388435 | 62 | void can_irq_free (can_t *obj); |
bogdanm | 15:4892fe388435 | 63 | void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable); |
bogdanm | 15:4892fe388435 | 64 | |
bogdanm | 13:0645d8841f51 | 65 | int can_write (can_t *obj, CAN_Message, int cc); |
bogdanm | 13:0645d8841f51 | 66 | int can_read (can_t *obj, CAN_Message *msg); |
bogdanm | 15:4892fe388435 | 67 | int can_mode (can_t *obj, CanMode mode); |
bogdanm | 13:0645d8841f51 | 68 | void can_reset (can_t *obj); |
bogdanm | 13:0645d8841f51 | 69 | unsigned char can_rderror (can_t *obj); |
bogdanm | 13:0645d8841f51 | 70 | unsigned char can_tderror (can_t *obj); |
bogdanm | 13:0645d8841f51 | 71 | void can_monitor (can_t *obj, int silent); |
bogdanm | 13:0645d8841f51 | 72 | |
bogdanm | 13:0645d8841f51 | 73 | #ifdef __cplusplus |
bogdanm | 13:0645d8841f51 | 74 | }; |
bogdanm | 13:0645d8841f51 | 75 | #endif |
bogdanm | 13:0645d8841f51 | 76 | |
bogdanm | 13:0645d8841f51 | 77 | #endif // MBED_CAN_API_H |
bogdanm | 13:0645d8841f51 | 78 | |
bogdanm | 13:0645d8841f51 | 79 | #endif |