Mbed Cloud example program for workshop in W27 2018.

Dependencies:   MMA7660 LM75B

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NanostackRfPhyAtmel.h Source File

NanostackRfPhyAtmel.h

00001 /*
00002  * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef NANOSTACK_RF_PHY_ATMEL_H_
00018 #define NANOSTACK_RF_PHY_ATMEL_H_
00019 
00020 #include "at24mac.h"
00021 #include "PinNames.h"
00022 
00023 #ifdef MBED_CONF_NANOSTACK_CONFIGURATION
00024 
00025 #include "NanostackRfPhy.h"
00026 
00027 // Arduino pin defaults for convenience
00028 #if !defined(ATMEL_SPI_MOSI)
00029 #define ATMEL_SPI_MOSI   D11
00030 #endif
00031 #if !defined(ATMEL_SPI_MISO)
00032 #define ATMEL_SPI_MISO   D12
00033 #endif
00034 #if !defined(ATMEL_SPI_SCLK)
00035 #define ATMEL_SPI_SCLK   D13
00036 #endif
00037 #if !defined(ATMEL_SPI_CS)
00038 #define ATMEL_SPI_CS     D10
00039 #endif
00040 #if !defined(ATMEL_SPI_RST)
00041 #define ATMEL_SPI_RST    D5
00042 #endif
00043 #if !defined(ATMEL_SPI_SLP)
00044 #define ATMEL_SPI_SLP    D7
00045 #endif
00046 #if !defined(ATMEL_SPI_IRQ)
00047 #define ATMEL_SPI_IRQ    D9
00048 #endif
00049 #if !defined(ATMEL_I2C_SDA)
00050 #define ATMEL_I2C_SDA    D14
00051 #endif
00052 #if !defined(ATMEL_I2C_SCL)
00053 #define ATMEL_I2C_SCL    D15
00054 #endif
00055 
00056 class RFBits;
00057 
00058 class NanostackRfPhyAtmel : public NanostackRfPhy {
00059 public:
00060     NanostackRfPhyAtmel(PinName spi_mosi, PinName spi_miso,
00061             PinName spi_sclk, PinName spi_cs,  PinName spi_rst, PinName spi_slp, PinName spi_irq,
00062             PinName i2c_sda, PinName i2c_scl);
00063     virtual ~NanostackRfPhyAtmel();
00064     virtual int8_t rf_register();
00065     virtual void rf_unregister();
00066     virtual void get_mac_address(uint8_t *mac);
00067     virtual void set_mac_address(uint8_t *mac);
00068 
00069 private:
00070     AT24Mac _mac;
00071     uint8_t _mac_addr[8];
00072     RFBits *_rf;
00073     bool _mac_set;
00074 
00075     const PinName _spi_mosi;
00076     const PinName _spi_miso;
00077     const PinName _spi_sclk;
00078     const PinName _spi_cs;
00079     const PinName _spi_rst;
00080     const PinName _spi_slp;
00081     const PinName _spi_irq;
00082 };
00083 
00084 #endif /* MBED_CONF_NANOSTACK_CONFIGURATION */
00085 #endif /* NANOSTACK_RF_PHY_ATMEL_H_ */