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/BusOut.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_BUSOUT_H |
dudmuck | 336:1e18a06a987b | 17 | #define MBED_BUSOUT_H |
dudmuck | 336:1e18a06a987b | 18 | |
dudmuck | 336:1e18a06a987b | 19 | #include "DigitalOut.h" |
dudmuck | 336:1e18a06a987b | 20 | |
dudmuck | 336:1e18a06a987b | 21 | namespace mbed { |
dudmuck | 336:1e18a06a987b | 22 | |
dudmuck | 336:1e18a06a987b | 23 | /** A digital output bus, used for setting the state of a collection of pins |
dudmuck | 336:1e18a06a987b | 24 | */ |
dudmuck | 336:1e18a06a987b | 25 | class BusOut { |
dudmuck | 336:1e18a06a987b | 26 | |
dudmuck | 336:1e18a06a987b | 27 | public: |
dudmuck | 336:1e18a06a987b | 28 | |
dudmuck | 336:1e18a06a987b | 29 | /** Create an BusOut, connected to the specified pins |
dudmuck | 336:1e18a06a987b | 30 | * |
dudmuck | 336:1e18a06a987b | 31 | * @param p<n> DigitalOut pin to connect to bus bit <n> (p5-p30, NC) |
dudmuck | 336:1e18a06a987b | 32 | * |
dudmuck | 336:1e18a06a987b | 33 | * @note |
dudmuck | 336:1e18a06a987b | 34 | * It is only required to specify as many pin variables as is required |
dudmuck | 336:1e18a06a987b | 35 | * for the bus; the rest will default to NC (not connected) |
dudmuck | 336:1e18a06a987b | 36 | */ |
dudmuck | 336:1e18a06a987b | 37 | BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, |
dudmuck | 336:1e18a06a987b | 38 | PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, |
dudmuck | 336:1e18a06a987b | 39 | PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, |
dudmuck | 336:1e18a06a987b | 40 | PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC); |
dudmuck | 336:1e18a06a987b | 41 | |
dudmuck | 336:1e18a06a987b | 42 | BusOut(PinName pins[16]); |
dudmuck | 336:1e18a06a987b | 43 | |
dudmuck | 336:1e18a06a987b | 44 | virtual ~BusOut(); |
dudmuck | 336:1e18a06a987b | 45 | |
dudmuck | 336:1e18a06a987b | 46 | /** Write the value to the output bus |
dudmuck | 336:1e18a06a987b | 47 | * |
dudmuck | 336:1e18a06a987b | 48 | * @param value An integer specifying a bit to write for every corresponding DigitalOut pin |
dudmuck | 336:1e18a06a987b | 49 | */ |
dudmuck | 336:1e18a06a987b | 50 | void write(int value); |
dudmuck | 336:1e18a06a987b | 51 | |
dudmuck | 336:1e18a06a987b | 52 | /** Read the value currently output on the bus |
dudmuck | 336:1e18a06a987b | 53 | * |
dudmuck | 336:1e18a06a987b | 54 | * @returns |
dudmuck | 336:1e18a06a987b | 55 | * An integer with each bit corresponding to associated DigitalOut pin setting |
dudmuck | 336:1e18a06a987b | 56 | */ |
dudmuck | 336:1e18a06a987b | 57 | int read(); |
dudmuck | 336:1e18a06a987b | 58 | |
dudmuck | 336:1e18a06a987b | 59 | #ifdef MBED_OPERATORS |
dudmuck | 336:1e18a06a987b | 60 | /** A shorthand for write() |
dudmuck | 336:1e18a06a987b | 61 | */ |
dudmuck | 336:1e18a06a987b | 62 | BusOut& operator= (int v); |
dudmuck | 336:1e18a06a987b | 63 | BusOut& operator= (BusOut& rhs); |
dudmuck | 336:1e18a06a987b | 64 | |
dudmuck | 336:1e18a06a987b | 65 | /** A shorthand for read() |
dudmuck | 336:1e18a06a987b | 66 | */ |
dudmuck | 336:1e18a06a987b | 67 | operator int(); |
dudmuck | 336:1e18a06a987b | 68 | #endif |
dudmuck | 336:1e18a06a987b | 69 | |
dudmuck | 336:1e18a06a987b | 70 | protected: |
dudmuck | 336:1e18a06a987b | 71 | DigitalOut* _pin[16]; |
dudmuck | 336:1e18a06a987b | 72 | |
dudmuck | 336:1e18a06a987b | 73 | /* disallow copy constructor and assignment operators */ |
dudmuck | 336:1e18a06a987b | 74 | private: |
dudmuck | 336:1e18a06a987b | 75 | BusOut(const BusOut&); |
dudmuck | 336:1e18a06a987b | 76 | BusOut & operator = (const BusOut&); |
dudmuck | 336:1e18a06a987b | 77 | }; |
dudmuck | 336:1e18a06a987b | 78 | |
dudmuck | 336:1e18a06a987b | 79 | } // namespace mbed |
dudmuck | 336:1e18a06a987b | 80 | |
dudmuck | 336:1e18a06a987b | 81 | #endif |