Fork of my MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:45:51 2017 +0000
Revision:
0:f1d3878b8dd9
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vpcola 0:f1d3878b8dd9 1 /*
vpcola 0:f1d3878b8dd9 2 * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
vpcola 0:f1d3878b8dd9 3 * SPDX-License-Identifier: Apache-2.0
vpcola 0:f1d3878b8dd9 4 * Licensed under the Apache License, Version 2.0 (the License); you may
vpcola 0:f1d3878b8dd9 5 * not use this file except in compliance with the License.
vpcola 0:f1d3878b8dd9 6 * You may obtain a copy of the License at
vpcola 0:f1d3878b8dd9 7 *
vpcola 0:f1d3878b8dd9 8 * http://www.apache.org/licenses/LICENSE-2.0
vpcola 0:f1d3878b8dd9 9 *
vpcola 0:f1d3878b8dd9 10 * Unless required by applicable law or agreed to in writing, software
vpcola 0:f1d3878b8dd9 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
vpcola 0:f1d3878b8dd9 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vpcola 0:f1d3878b8dd9 13 * See the License for the specific language governing permissions and
vpcola 0:f1d3878b8dd9 14 * limitations under the License.
vpcola 0:f1d3878b8dd9 15 */
vpcola 0:f1d3878b8dd9 16
vpcola 0:f1d3878b8dd9 17 #ifndef NANOSTACK_RF_PHY_ATMEL_H_
vpcola 0:f1d3878b8dd9 18 #define NANOSTACK_RF_PHY_ATMEL_H_
vpcola 0:f1d3878b8dd9 19
vpcola 0:f1d3878b8dd9 20 #include "NanostackRfPhy.h"
vpcola 0:f1d3878b8dd9 21 #include "at24mac.h"
vpcola 0:f1d3878b8dd9 22 #include "PinNames.h"
vpcola 0:f1d3878b8dd9 23
vpcola 0:f1d3878b8dd9 24 // Arduino pin defaults for convenience
vpcola 0:f1d3878b8dd9 25 #if !defined(ATMEL_SPI_MOSI)
vpcola 0:f1d3878b8dd9 26 #define ATMEL_SPI_MOSI D11
vpcola 0:f1d3878b8dd9 27 #endif
vpcola 0:f1d3878b8dd9 28 #if !defined(ATMEL_SPI_MISO)
vpcola 0:f1d3878b8dd9 29 #define ATMEL_SPI_MISO D12
vpcola 0:f1d3878b8dd9 30 #endif
vpcola 0:f1d3878b8dd9 31 #if !defined(ATMEL_SPI_SCLK)
vpcola 0:f1d3878b8dd9 32 #define ATMEL_SPI_SCLK D13
vpcola 0:f1d3878b8dd9 33 #endif
vpcola 0:f1d3878b8dd9 34 #if !defined(ATMEL_SPI_CS)
vpcola 0:f1d3878b8dd9 35 #define ATMEL_SPI_CS D10
vpcola 0:f1d3878b8dd9 36 #endif
vpcola 0:f1d3878b8dd9 37 #if !defined(ATMEL_SPI_RST)
vpcola 0:f1d3878b8dd9 38 #define ATMEL_SPI_RST D5
vpcola 0:f1d3878b8dd9 39 #endif
vpcola 0:f1d3878b8dd9 40 #if !defined(ATMEL_SPI_SLP)
vpcola 0:f1d3878b8dd9 41 #define ATMEL_SPI_SLP D7
vpcola 0:f1d3878b8dd9 42 #endif
vpcola 0:f1d3878b8dd9 43 #if !defined(ATMEL_SPI_IRQ)
vpcola 0:f1d3878b8dd9 44 #define ATMEL_SPI_IRQ D9
vpcola 0:f1d3878b8dd9 45 #endif
vpcola 0:f1d3878b8dd9 46 #if !defined(ATMEL_I2C_SDA)
vpcola 0:f1d3878b8dd9 47 #define ATMEL_I2C_SDA D14
vpcola 0:f1d3878b8dd9 48 #endif
vpcola 0:f1d3878b8dd9 49 #if !defined(ATMEL_I2C_SCL)
vpcola 0:f1d3878b8dd9 50 #define ATMEL_I2C_SCL D15
vpcola 0:f1d3878b8dd9 51 #endif
vpcola 0:f1d3878b8dd9 52
vpcola 0:f1d3878b8dd9 53 class RFBits;
vpcola 0:f1d3878b8dd9 54
vpcola 0:f1d3878b8dd9 55 class NanostackRfPhyAtmel : public NanostackRfPhy {
vpcola 0:f1d3878b8dd9 56 public:
vpcola 0:f1d3878b8dd9 57 NanostackRfPhyAtmel(PinName spi_mosi, PinName spi_miso,
vpcola 0:f1d3878b8dd9 58 PinName spi_sclk, PinName spi_cs, PinName spi_rst, PinName spi_slp, PinName spi_irq,
vpcola 0:f1d3878b8dd9 59 PinName i2c_sda, PinName i2c_scl);
vpcola 0:f1d3878b8dd9 60 ~NanostackRfPhyAtmel();
vpcola 0:f1d3878b8dd9 61 int8_t rf_register();
vpcola 0:f1d3878b8dd9 62 void rf_unregister();
vpcola 0:f1d3878b8dd9 63 void get_mac_address(uint8_t *mac);
vpcola 0:f1d3878b8dd9 64 void set_mac_address(uint8_t *mac);
vpcola 0:f1d3878b8dd9 65
vpcola 0:f1d3878b8dd9 66 private:
vpcola 0:f1d3878b8dd9 67 AT24Mac _mac;
vpcola 0:f1d3878b8dd9 68 uint8_t _mac_addr[8];
vpcola 0:f1d3878b8dd9 69 RFBits *_rf;
vpcola 0:f1d3878b8dd9 70 bool _mac_set;
vpcola 0:f1d3878b8dd9 71
vpcola 0:f1d3878b8dd9 72 const PinName _spi_mosi;
vpcola 0:f1d3878b8dd9 73 const PinName _spi_miso;
vpcola 0:f1d3878b8dd9 74 const PinName _spi_sclk;
vpcola 0:f1d3878b8dd9 75 const PinName _spi_cs;
vpcola 0:f1d3878b8dd9 76 const PinName _spi_rst;
vpcola 0:f1d3878b8dd9 77 const PinName _spi_slp;
vpcola 0:f1d3878b8dd9 78 const PinName _spi_irq;
vpcola 0:f1d3878b8dd9 79 };
vpcola 0:f1d3878b8dd9 80
vpcola 0:f1d3878b8dd9 81 #endif /* NANOSTACK_RF_PHY_ATMEL_H_ */