Easily add all supported connectivity methods to your mbed OS project

Dependencies:   type-yd-driver

Committer:
MACRUM
Date:
Wed Jul 12 10:52:58 2017 +0000
Revision:
0:615f90842ce8
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:615f90842ce8 1 /*
MACRUM 0:615f90842ce8 2 * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
MACRUM 0:615f90842ce8 3 * SPDX-License-Identifier: Apache-2.0
MACRUM 0:615f90842ce8 4 * Licensed under the Apache License, Version 2.0 (the License); you may
MACRUM 0:615f90842ce8 5 * not use this file except in compliance with the License.
MACRUM 0:615f90842ce8 6 * You may obtain a copy of the License at
MACRUM 0:615f90842ce8 7 *
MACRUM 0:615f90842ce8 8 * http://www.apache.org/licenses/LICENSE-2.0
MACRUM 0:615f90842ce8 9 *
MACRUM 0:615f90842ce8 10 * Unless required by applicable law or agreed to in writing, software
MACRUM 0:615f90842ce8 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
MACRUM 0:615f90842ce8 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 0:615f90842ce8 13 * See the License for the specific language governing permissions and
MACRUM 0:615f90842ce8 14 * limitations under the License.
MACRUM 0:615f90842ce8 15 */
MACRUM 0:615f90842ce8 16
MACRUM 0:615f90842ce8 17 #ifndef NANOSTACK_PHY_MCR20A_H_
MACRUM 0:615f90842ce8 18 #define NANOSTACK_PHY_MCR20A_H_
MACRUM 0:615f90842ce8 19
MACRUM 0:615f90842ce8 20 #include "mbed.h"
MACRUM 0:615f90842ce8 21 #include "NanostackRfPhy.h"
MACRUM 0:615f90842ce8 22
MACRUM 0:615f90842ce8 23 // Arduino pin defaults for convenience
MACRUM 0:615f90842ce8 24 #if !defined(MCR20A_SPI_MOSI)
MACRUM 0:615f90842ce8 25 #define MCR20A_SPI_MOSI D11
MACRUM 0:615f90842ce8 26 #endif
MACRUM 0:615f90842ce8 27 #if !defined(MCR20A_SPI_MISO)
MACRUM 0:615f90842ce8 28 #define MCR20A_SPI_MISO D12
MACRUM 0:615f90842ce8 29 #endif
MACRUM 0:615f90842ce8 30 #if !defined(MCR20A_SPI_SCLK)
MACRUM 0:615f90842ce8 31 #define MCR20A_SPI_SCLK D13
MACRUM 0:615f90842ce8 32 #endif
MACRUM 0:615f90842ce8 33 #if !defined(MCR20A_SPI_CS)
MACRUM 0:615f90842ce8 34 #define MCR20A_SPI_CS D10
MACRUM 0:615f90842ce8 35 #endif
MACRUM 0:615f90842ce8 36 #if !defined(MCR20A_SPI_RST)
MACRUM 0:615f90842ce8 37 #define MCR20A_SPI_RST D5
MACRUM 0:615f90842ce8 38 #endif
MACRUM 0:615f90842ce8 39 #if !defined(MCR20A_SPI_IRQ)
MACRUM 0:615f90842ce8 40 #define MCR20A_SPI_IRQ D2
MACRUM 0:615f90842ce8 41 #endif
MACRUM 0:615f90842ce8 42
MACRUM 0:615f90842ce8 43 class NanostackRfPhyMcr20a : public NanostackRfPhy {
MACRUM 0:615f90842ce8 44 public:
MACRUM 0:615f90842ce8 45 NanostackRfPhyMcr20a(PinName spi_mosi, PinName spi_miso,
MACRUM 0:615f90842ce8 46 PinName spi_sclk, PinName spi_cs, PinName spi_rst,
MACRUM 0:615f90842ce8 47 PinName spi_irq);
MACRUM 0:615f90842ce8 48 ~NanostackRfPhyMcr20a();
MACRUM 0:615f90842ce8 49 int8_t rf_register();
MACRUM 0:615f90842ce8 50 void rf_unregister();
MACRUM 0:615f90842ce8 51 void get_mac_address(uint8_t *mac);
MACRUM 0:615f90842ce8 52 void set_mac_address(uint8_t *mac);
MACRUM 0:615f90842ce8 53
MACRUM 0:615f90842ce8 54 private:
MACRUM 0:615f90842ce8 55 SPI _spi;
MACRUM 0:615f90842ce8 56 DigitalOut _rf_cs;
MACRUM 0:615f90842ce8 57 DigitalOut _rf_rst;
MACRUM 0:615f90842ce8 58 InterruptIn _rf_irq;
MACRUM 0:615f90842ce8 59 DigitalIn _rf_irq_pin;
MACRUM 0:615f90842ce8 60
MACRUM 0:615f90842ce8 61 void _pins_set();
MACRUM 0:615f90842ce8 62 void _pins_clear();
MACRUM 0:615f90842ce8 63 };
MACRUM 0:615f90842ce8 64
MACRUM 0:615f90842ce8 65 #endif /* NANOSTACK_PHY_MCR20A_H_ */