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/
api/mbed_interface.h@339:ac6f3fd999f3, 2016-01-07 (annotated)
- Committer:
- netblocks
- Date:
- Thu Jan 07 13:01:25 2016 +0000
- Revision:
- 339:ac6f3fd999f3
- Parent:
- 336:1e18a06a987b
HSE_VALUE set for XTAL 16Mhz
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudmuck | 336:1e18a06a987b | 1 | /* mbed Microcontroller Library |
dudmuck | 336:1e18a06a987b | 2 | * Copyright (c) 2006-2013 ARM Limited |
dudmuck | 336:1e18a06a987b | 3 | * |
dudmuck | 336:1e18a06a987b | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
dudmuck | 336:1e18a06a987b | 5 | * you may not use this file except in compliance with the License. |
dudmuck | 336:1e18a06a987b | 6 | * You may obtain a copy of the License at |
dudmuck | 336:1e18a06a987b | 7 | * |
dudmuck | 336:1e18a06a987b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
dudmuck | 336:1e18a06a987b | 9 | * |
dudmuck | 336:1e18a06a987b | 10 | * Unless required by applicable law or agreed to in writing, software |
dudmuck | 336:1e18a06a987b | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
dudmuck | 336:1e18a06a987b | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
dudmuck | 336:1e18a06a987b | 13 | * See the License for the specific language governing permissions and |
dudmuck | 336:1e18a06a987b | 14 | * limitations under the License. |
dudmuck | 336:1e18a06a987b | 15 | */ |
dudmuck | 336:1e18a06a987b | 16 | #ifndef MBED_INTERFACE_H |
dudmuck | 336:1e18a06a987b | 17 | #define MBED_INTERFACE_H |
dudmuck | 336:1e18a06a987b | 18 | |
dudmuck | 336:1e18a06a987b | 19 | #include "device.h" |
dudmuck | 336:1e18a06a987b | 20 | |
dudmuck | 336:1e18a06a987b | 21 | /* Mbed interface mac address |
dudmuck | 336:1e18a06a987b | 22 | * if MBED_MAC_ADD_x are zero, interface uid sets mac address, |
dudmuck | 336:1e18a06a987b | 23 | * otherwise MAC_ADD_x are used. |
dudmuck | 336:1e18a06a987b | 24 | */ |
dudmuck | 336:1e18a06a987b | 25 | #define MBED_MAC_ADDR_INTERFACE 0x00 |
dudmuck | 336:1e18a06a987b | 26 | #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE |
dudmuck | 336:1e18a06a987b | 27 | #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE |
dudmuck | 336:1e18a06a987b | 28 | #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE |
dudmuck | 336:1e18a06a987b | 29 | #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE |
dudmuck | 336:1e18a06a987b | 30 | #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE |
dudmuck | 336:1e18a06a987b | 31 | #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE |
dudmuck | 336:1e18a06a987b | 32 | #define MBED_MAC_ADDRESS_SUM (MBED_MAC_ADDR_0 | MBED_MAC_ADDR_1 | MBED_MAC_ADDR_2 | MBED_MAC_ADDR_3 | MBED_MAC_ADDR_4 | MBED_MAC_ADDR_5) |
dudmuck | 336:1e18a06a987b | 33 | |
dudmuck | 336:1e18a06a987b | 34 | #ifdef __cplusplus |
dudmuck | 336:1e18a06a987b | 35 | extern "C" { |
dudmuck | 336:1e18a06a987b | 36 | #endif |
dudmuck | 336:1e18a06a987b | 37 | |
dudmuck | 336:1e18a06a987b | 38 | #if DEVICE_SEMIHOST |
dudmuck | 336:1e18a06a987b | 39 | |
dudmuck | 336:1e18a06a987b | 40 | /** Functions to control the mbed interface |
dudmuck | 336:1e18a06a987b | 41 | * |
dudmuck | 336:1e18a06a987b | 42 | * mbed Microcontrollers have a built-in interface to provide functionality such as |
dudmuck | 336:1e18a06a987b | 43 | * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file |
dudmuck | 336:1e18a06a987b | 44 | * system. These functions provide means to control the interface suing semihost |
dudmuck | 336:1e18a06a987b | 45 | * calls it supports. |
dudmuck | 336:1e18a06a987b | 46 | */ |
dudmuck | 336:1e18a06a987b | 47 | |
dudmuck | 336:1e18a06a987b | 48 | /** Determine whether the mbed interface is connected, based on whether debug is enabled |
dudmuck | 336:1e18a06a987b | 49 | * |
dudmuck | 336:1e18a06a987b | 50 | * @returns |
dudmuck | 336:1e18a06a987b | 51 | * 1 if interface is connected, |
dudmuck | 336:1e18a06a987b | 52 | * 0 otherwise |
dudmuck | 336:1e18a06a987b | 53 | */ |
dudmuck | 336:1e18a06a987b | 54 | int mbed_interface_connected(void); |
dudmuck | 336:1e18a06a987b | 55 | |
dudmuck | 336:1e18a06a987b | 56 | /** Instruct the mbed interface to reset, as if the reset button had been pressed |
dudmuck | 336:1e18a06a987b | 57 | * |
dudmuck | 336:1e18a06a987b | 58 | * @returns |
dudmuck | 336:1e18a06a987b | 59 | * 1 if successful, |
dudmuck | 336:1e18a06a987b | 60 | * 0 otherwise (e.g. interface not present) |
dudmuck | 336:1e18a06a987b | 61 | */ |
dudmuck | 336:1e18a06a987b | 62 | int mbed_interface_reset(void); |
dudmuck | 336:1e18a06a987b | 63 | |
dudmuck | 336:1e18a06a987b | 64 | /** This will disconnect the debug aspect of the interface, so semihosting will be disabled. |
dudmuck | 336:1e18a06a987b | 65 | * The interface will still support the USB serial aspect |
dudmuck | 336:1e18a06a987b | 66 | * |
dudmuck | 336:1e18a06a987b | 67 | * @returns |
dudmuck | 336:1e18a06a987b | 68 | * 0 if successful, |
dudmuck | 336:1e18a06a987b | 69 | * -1 otherwise (e.g. interface not present) |
dudmuck | 336:1e18a06a987b | 70 | */ |
dudmuck | 336:1e18a06a987b | 71 | int mbed_interface_disconnect(void); |
dudmuck | 336:1e18a06a987b | 72 | |
dudmuck | 336:1e18a06a987b | 73 | /** This will disconnect the debug aspect of the interface, and if the USB cable is not |
dudmuck | 336:1e18a06a987b | 74 | * connected, also power down the interface. If the USB cable is connected, the interface |
dudmuck | 336:1e18a06a987b | 75 | * will remain powered up and visible to the host |
dudmuck | 336:1e18a06a987b | 76 | * |
dudmuck | 336:1e18a06a987b | 77 | * @returns |
dudmuck | 336:1e18a06a987b | 78 | * 0 if successful, |
dudmuck | 336:1e18a06a987b | 79 | * -1 otherwise (e.g. interface not present) |
dudmuck | 336:1e18a06a987b | 80 | */ |
dudmuck | 336:1e18a06a987b | 81 | int mbed_interface_powerdown(void); |
dudmuck | 336:1e18a06a987b | 82 | |
dudmuck | 336:1e18a06a987b | 83 | /** This returns a string containing the 32-character UID of the mbed interface |
dudmuck | 336:1e18a06a987b | 84 | * This is a weak function that can be overwritten if required |
dudmuck | 336:1e18a06a987b | 85 | * |
dudmuck | 336:1e18a06a987b | 86 | * @param uid A 33-byte array to write the null terminated 32-byte string |
dudmuck | 336:1e18a06a987b | 87 | * |
dudmuck | 336:1e18a06a987b | 88 | * @returns |
dudmuck | 336:1e18a06a987b | 89 | * 0 if successful, |
dudmuck | 336:1e18a06a987b | 90 | * -1 otherwise (e.g. interface not present) |
dudmuck | 336:1e18a06a987b | 91 | */ |
dudmuck | 336:1e18a06a987b | 92 | int mbed_interface_uid(char *uid); |
dudmuck | 336:1e18a06a987b | 93 | |
dudmuck | 336:1e18a06a987b | 94 | #endif |
dudmuck | 336:1e18a06a987b | 95 | |
dudmuck | 336:1e18a06a987b | 96 | /** This returns a unique 6-byte MAC address, based on the interface UID |
dudmuck | 336:1e18a06a987b | 97 | * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00) |
dudmuck | 336:1e18a06a987b | 98 | * |
dudmuck | 336:1e18a06a987b | 99 | * This is a weak function that can be overwritten if you want to provide your own mechanism to |
dudmuck | 336:1e18a06a987b | 100 | * provide a MAC address. |
dudmuck | 336:1e18a06a987b | 101 | * |
dudmuck | 336:1e18a06a987b | 102 | * @param mac A 6-byte array to write the MAC address |
dudmuck | 336:1e18a06a987b | 103 | */ |
dudmuck | 336:1e18a06a987b | 104 | void mbed_mac_address(char *mac); |
dudmuck | 336:1e18a06a987b | 105 | |
dudmuck | 336:1e18a06a987b | 106 | /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence |
dudmuck | 336:1e18a06a987b | 107 | */ |
dudmuck | 336:1e18a06a987b | 108 | void mbed_die(void); |
dudmuck | 336:1e18a06a987b | 109 | |
dudmuck | 336:1e18a06a987b | 110 | #ifdef __cplusplus |
dudmuck | 336:1e18a06a987b | 111 | } |
dudmuck | 336:1e18a06a987b | 112 | #endif |
dudmuck | 336:1e18a06a987b | 113 | |
dudmuck | 336:1e18a06a987b | 114 | #endif |