You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/04/29 00:28:51 UTC
[13/19] incubator-mynewt-core git commit: MYNEWT-741 Port of
LoRaMac-node library
MYNEWT-741 Port of LoRaMac-node library
Implement suggested changed from code review:
1. Replace hardcoded 0 argument to hal_spi_enable(); use syscfg setting
instead.
2. Merge hw/drivers/lora/node/{radio,board} --> hw/drivers/lora
3. Default LoRa SPI index to -1; require BSP to override this setting
with an actual value.
Regarding 2: the purpose of the "node" subdirectory was to distinguish
this code from a potential gateway implementation. This subdirectory
remains in the net/lora directory (mirroring
net/nimble/{host,controller}), but it has been removed from the driver
directory tree. Presumably, end-device vs. gateway drivers use
different hardware, and will be distinguishable by their package name.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/560fa920
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/560fa920
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/560fa920
Branch: refs/heads/master
Commit: 560fa9206904948bff567ab980c8a94ea064d65c
Parents: 9986f68
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Apr 27 11:46:05 2017 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Apr 28 17:27:51 2017 -0700
----------------------------------------------------------------------
apps/lorashell/src/main.c | 2 +-
hw/bsp/telee02/pkg.yml | 3 +-
hw/bsp/telee02/syscfg.yml | 1 +
hw/drivers/lora/node/board/nrf52/LICENSE.txt | 25 -
.../lora/node/board/nrf52/include/board/board.h | 92 -
hw/drivers/lora/node/board/nrf52/pkg.yml | 34 -
.../lora/node/board/nrf52/src/lora_nrf52.c | 44 -
hw/drivers/lora/node/board/nrf52/syscfg.yml | 27 -
hw/drivers/lora/node/radio/sx1276/LICENSE.txt | 25 -
.../node/radio/sx1276/include/radio/radio.h | 33 -
hw/drivers/lora/node/radio/sx1276/pkg.yml | 35 -
.../lora/node/radio/sx1276/src/sx1276-board.c | 163 --
.../lora/node/radio/sx1276/src/sx1276-board.h | 119 --
hw/drivers/lora/node/radio/sx1276/src/sx1276.c | 1826 ------------------
hw/drivers/lora/node/radio/sx1276/src/sx1276.h | 364 ----
.../lora/node/radio/sx1276/src/sx1276Regs-Fsk.h | 1134 -----------
.../node/radio/sx1276/src/sx1276Regs-LoRa.h | 565 ------
hw/drivers/lora/sx1276/LICENSE.txt | 25 +
hw/drivers/lora/sx1276/include/radio/radio.h | 33 +
hw/drivers/lora/sx1276/pkg.yml | 32 +
hw/drivers/lora/sx1276/src/sx1276-board.c | 179 ++
hw/drivers/lora/sx1276/src/sx1276-board.h | 127 ++
hw/drivers/lora/sx1276/src/sx1276.c | 1824 +++++++++++++++++
hw/drivers/lora/sx1276/src/sx1276.h | 364 ++++
hw/drivers/lora/sx1276/src/sx1276Regs-Fsk.h | 1134 +++++++++++
hw/drivers/lora/sx1276/src/sx1276Regs-LoRa.h | 565 ++++++
hw/drivers/lora/sx1276/syscfg.yml | 27 +
net/lora/node/pkg.yml | 3 +-
net/lora/node/src/mac/LoRaMac.c | 5 +-
29 files changed, 4318 insertions(+), 4492 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/apps/lorashell/src/main.c
----------------------------------------------------------------------
diff --git a/apps/lorashell/src/main.c b/apps/lorashell/src/main.c
index 7f12578..68c8635 100644
--- a/apps/lorashell/src/main.c
+++ b/apps/lorashell/src/main.c
@@ -53,6 +53,7 @@
* lora_tx_rpt 50 5 100
*/
+#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "sysinit/sysinit.h"
@@ -61,7 +62,6 @@
#include "hal/hal_spi.h"
#include "bsp/bsp.h"
#include "os/os.h"
-#include "board/board.h"
#include "node/radio.h"
#include "console/console.h"
#include "shell/shell.h"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/bsp/telee02/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/telee02/pkg.yml b/hw/bsp/telee02/pkg.yml
index 0324334..654fcf4 100644
--- a/hw/bsp/telee02/pkg.yml
+++ b/hw/bsp/telee02/pkg.yml
@@ -90,8 +90,7 @@ pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/nrf52
pkg.deps.LORA_NODE:
- - hw/drivers/lora/node/radio/sx1276
- - hw/drivers/lora/node/board/nrf52
+ - hw/drivers/lora/sx1276
pkg.deps.UART_0:
- hw/drivers/uart/uart_hal
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/bsp/telee02/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/telee02/syscfg.yml b/hw/bsp/telee02/syscfg.yml
index a98b4a9..956d00c 100644
--- a/hw/bsp/telee02/syscfg.yml
+++ b/hw/bsp/telee02/syscfg.yml
@@ -96,3 +96,4 @@ syscfg.vals:
NFFS_FLASH_AREA: FLASH_AREA_NFFS
COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
MCU_DCDC_ENABLED: 1
+ SX1276_SPI_IDX: 0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/board/nrf52/LICENSE.txt
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/board/nrf52/LICENSE.txt b/hw/drivers/lora/node/board/nrf52/LICENSE.txt
deleted file mode 100644
index 82695a7..0000000
--- a/hw/drivers/lora/node/board/nrf52/LICENSE.txt
+++ /dev/null
@@ -1,25 +0,0 @@
---- Revised BSD License ---
-Copyright (c) 2013, SEMTECH S.A.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Semtech corporation nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL SEMTECH S.A. BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/board/nrf52/include/board/board.h
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/board/nrf52/include/board/board.h b/hw/drivers/lora/node/board/nrf52/include/board/board.h
deleted file mode 100644
index 7d60c5f..0000000
--- a/hw/drivers/lora/node/board/nrf52/include/board/board.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- / _____) _ | |
-( (____ _____ ____ _| |_ _____ ____| |__
- \____ \| ___ | (_ _) ___ |/ ___) _ \
- _____) ) ____| | | || |_| ____( (___| | | |
-(______/|_____)_|_|_| \__)_____)\____)_| |_|
- (C)2013 Semtech
-
-Description: Target board general functions implementation
-
-License: Revised BSD License, see LICENSE.TXT file include in the project
-
-Maintainer: Miguel Luis and Gregory Cristian
-*/
-#ifndef __BOARD_H__
-#define __BOARD_H__
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include "bsp/bsp.h"
-#include "node/utilities.h"
-
-/*!
- * Board MCU pins definitions
- */
-
-#define RADIO_RESET SX1276_NRESET
-
-#define RADIO_SPI_IDX MYNEWT_VAL(LORA_NODE_BOARD_SPI_IDX)
-
-#if RADIO_SPI_IDX == 0
-#define RADIO_NSS MYNEWT_VAL(SPI_0_MASTER_SS_PIN)
-#else
-#error Invalid LORA_NODE_BOARD_SPI_IDX value
-#endif
-
-#define RADIO_DIO_0 SX1276_DIO0
-#define RADIO_DIO_1 SX1276_DIO1
-#define RADIO_DIO_2 SX1276_DIO2
-#define RADIO_DIO_3 SX1276_DIO3
-#define RADIO_DIO_4 SX1276_DIO4
-#define RADIO_DIO_5 SX1276_DIO5
-
-#define RADIO_ANT_SWITCH_HF SX1276_ANT_HF_CTRL
-
-#define RF_RXTX SX1276_RXTX
-
-/*!
- * Possible power sources
- */
-enum BoardPowerSources
-{
- USB_POWER = 0,
- BATTERY_POWER,
-};
-
-/*!
- * \brief Get the current battery level
- *
- * \retval value battery level [ 0: USB,
- * 1: Min level,
- * x: level
- * 254: fully charged,
- * 255: Error]
- */
-uint8_t BoardGetBatteryLevel( void );
-
-/*!
- * Returns a pseudo random seed generated using the MCU Unique ID
- *
- * \retval seed Generated pseudo random seed
- */
-uint32_t BoardGetRandomSeed( void );
-
-/*!
- * \brief Gets the board 64 bits unique ID
- *
- * \param [IN] id Pointer to an array that will contain the Unique ID
- */
-void BoardGetUniqueId( uint8_t *id );
-
-/*!
- * \brief Get the board power source
- *
- * \retval value power source [0: USB_POWER, 1: BATTERY_POWER]
- */
-uint8_t GetBoardPowerSource( void );
-
-#endif // __BOARD_H__
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/board/nrf52/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/board/nrf52/pkg.yml b/hw/drivers/lora/node/board/nrf52/pkg.yml
deleted file mode 100644
index d626845..0000000
--- a/hw/drivers/lora/node/board/nrf52/pkg.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-pkg.name: hw/drivers/lora/node/board/nrf52
-pkg.description: LoRaMac-node board driver for nRF52 systems.
-pkg.author: "Telenor Digital AS"
-pkg.homepage: "http://mynewt.apache.org/"
-pkg.keywords:
- - lora
-pkg.deps:
- - "@apache-mynewt-core/kernel/os"
- - "@apache-mynewt-core/net/lora/node"
-
-pkg.apis:
- - lora_node_board
-
-pkg.init:
- lora_node_nrf52_init: 100
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/board/nrf52/src/lora_nrf52.c
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/board/nrf52/src/lora_nrf52.c b/hw/drivers/lora/node/board/nrf52/src/lora_nrf52.c
deleted file mode 100644
index 828f5bb..0000000
--- a/hw/drivers/lora/node/board/nrf52/src/lora_nrf52.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "sysinit/sysinit.h"
-#include "syscfg/syscfg.h"
-#include "hal/hal_gpio.h"
-#include "hal/hal_spi.h"
-#include "board/board.h"
-
-void
-lora_node_nrf52_init(void)
-{
- struct hal_spi_settings spi_settings;
- int rc;
-
- hal_gpio_init_out(RADIO_NSS, 1);
-
- spi_settings.data_order = HAL_SPI_MSB_FIRST;
- spi_settings.data_mode = HAL_SPI_MODE0;
- spi_settings.baudrate = MYNEWT_VAL(LORA_NODE_BOARD_SPI_BAUDRATE);
- spi_settings.word_size = HAL_SPI_WORD_SIZE_8BIT;
-
- rc = hal_spi_config(RADIO_SPI_IDX, &spi_settings);
- SYSINIT_PANIC_ASSERT_MSG(rc == 0, "Failed to configure LoRa SPI");
-
- rc = hal_spi_enable(0);
- SYSINIT_PANIC_ASSERT_MSG(rc == 0, "Failed to enable LoRa SPI");
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/board/nrf52/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/board/nrf52/syscfg.yml b/hw/drivers/lora/node/board/nrf52/syscfg.yml
deleted file mode 100644
index 0babd74..0000000
--- a/hw/drivers/lora/node/board/nrf52/syscfg.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-syscfg.defs:
- LORA_NODE_BOARD_SPI_IDX:
- description:
- value: 0
-
- LORA_NODE_BOARD_SPI_BAUDRATE:
- description:
- value: 500
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/radio/sx1276/LICENSE.txt
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/radio/sx1276/LICENSE.txt b/hw/drivers/lora/node/radio/sx1276/LICENSE.txt
deleted file mode 100644
index 82695a7..0000000
--- a/hw/drivers/lora/node/radio/sx1276/LICENSE.txt
+++ /dev/null
@@ -1,25 +0,0 @@
---- Revised BSD License ---
-Copyright (c) 2013, SEMTECH S.A.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Semtech corporation nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL SEMTECH S.A. BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/radio/sx1276/include/radio/radio.h
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/radio/sx1276/include/radio/radio.h b/hw/drivers/lora/node/radio/sx1276/include/radio/radio.h
deleted file mode 100644
index 6f23183..0000000
--- a/hw/drivers/lora/node/radio/sx1276/include/radio/radio.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- / _____) _ | |
-( (____ _____ ____ _| |_ _____ ____| |__
- \____ \| ___ | (_ _) ___ |/ ___) _ \
- _____) ) ____| | | || |_| ____( (___| | | |
-(______/|_____)_|_|_| \__)_____)\____)_| |_|
- (C)2013 Semtech
-
-Description: Generic SX1276 driver implementation
-
-License: Revised BSD License, see LICENSE.TXT file include in the project
-
-Maintainer: Miguel Luis and Gregory Cristian
-*/
-#ifndef H_RADIO_RADIO_
-#define H_RADIO_RADIO_
-
-/*!
- * Radio wakeup time from SLEEP mode
- */
-#define RADIO_OSC_STARTUP 1 // [ms]
-
-/*!
- * Radio PLL lock and Mode Ready delay which can vary with the temperature
- */
-#define RADIO_SLEEP_TO_RX 2 // [ms]
-
-/*!
- * Radio complete Wake-up Time with margin for temperature compensation
- */
-#define RADIO_WAKEUP_TIME ( RADIO_OSC_STARTUP + RADIO_SLEEP_TO_RX )
-
-#endif /* H_RADIO_RADIO */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/radio/sx1276/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/radio/sx1276/pkg.yml b/hw/drivers/lora/node/radio/sx1276/pkg.yml
deleted file mode 100644
index 5b98cef..0000000
--- a/hw/drivers/lora/node/radio/sx1276/pkg.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-pkg.name: hw/drivers/lora/node/radio/sx1276
-pkg.description: LoRaMac-node radio driver for the SX1276 modem.
-pkg.author: "Semtech"
-pkg.homepage: "http://mynewt.apache.org/"
-pkg.keywords:
- - lora
-
-pkg.deps:
- - "@apache-mynewt-core/kernel/os"
- - "@apache-mynewt-core/net/lora/node"
-
-pkg.apis:
- - lora_node_radio
-
-pkg.req_apis:
- - lora_node_board
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/radio/sx1276/src/sx1276-board.c
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/radio/sx1276/src/sx1276-board.c b/hw/drivers/lora/node/radio/sx1276/src/sx1276-board.c
deleted file mode 100644
index 7bebcc5..0000000
--- a/hw/drivers/lora/node/radio/sx1276/src/sx1276-board.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- / _____) _ | |
-( (____ _____ ____ _| |_ _____ ____| |__
- \____ \| ___ | (_ _) ___ |/ ___) _ \
- _____) ) ____| | | || |_| ____( (___| | | |
-(______/|_____)_|_|_| \__)_____)\____)_| |_|
- (C)2013 Semtech
-
-Description: SX1276 driver specific target board functions implementation
-
-License: Revised BSD License, see LICENSE.TXT file include in the project
-
-Maintainer: Miguel Luis and Gregory Cristian
-*/
-#include <assert.h>
-#include "board/board.h"
-#include "node/radio.h"
-#include "sx1276.h"
-#include "sx1276-board.h"
-
-/*!
- * Flag used to set the RF switch control pins in low power mode when the radio is not active.
- */
-static bool RadioIsActive = false;
-
-/*!
- * Radio driver structure initialization
- */
-const struct Radio_s Radio =
-{
- .Init = SX1276Init,
- .GetStatus = SX1276GetStatus,
- .SetModem = SX1276SetModem,
- .SetChannel = SX1276SetChannel,
- .IsChannelFree = SX1276IsChannelFree,
- .Random = SX1276Random,
- .SetRxConfig = SX1276SetRxConfig,
- .SetTxConfig = SX1276SetTxConfig,
- .CheckRfFrequency = SX1276CheckRfFrequency,
- .TimeOnAir = SX1276GetTimeOnAir,
- .Send = SX1276Send,
- .Sleep = SX1276SetSleep,
- .Standby = SX1276SetStby,
- .Rx = SX1276SetRx,
- .StartCad = SX1276StartCad,
- .Rssi = SX1276ReadRssi,
- .Write = SX1276Write,
- .Read = SX1276Read,
- .WriteBuffer = SX1276WriteBuffer,
- .ReadBuffer = SX1276ReadBuffer,
- .SetMaxPayloadLength = SX1276SetMaxPayloadLength
-};
-
-void SX1276IoInit( void )
-{
- int rc;
-
- rc = hal_gpio_init_out(RF_RXTX, 1);
- assert(rc == 0);
-}
-
-void SX1276IoIrqInit( DioIrqHandler **irqHandlers )
-{
- int rc;
-
- rc = hal_gpio_irq_init(RADIO_DIO_0, irqHandlers[0], NULL,
- HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_NONE);
- assert(rc == 0);
- hal_gpio_irq_enable(RADIO_DIO_0);
-
- rc = hal_gpio_irq_init(RADIO_DIO_1, irqHandlers[1], NULL,
- HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_NONE);
- assert(rc == 0);
- hal_gpio_irq_enable(RADIO_DIO_1);
-
- rc = hal_gpio_irq_init(RADIO_DIO_2, irqHandlers[2], NULL,
- HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_NONE);
- assert(rc == 0);
- hal_gpio_irq_enable(RADIO_DIO_2);
-
- rc = hal_gpio_irq_init(RADIO_DIO_3, irqHandlers[3], NULL,
- HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_NONE);
- assert(rc == 0);
- hal_gpio_irq_enable(RADIO_DIO_3);
-
- rc = hal_gpio_irq_init(RADIO_DIO_4, irqHandlers[4], NULL,
- HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_NONE);
- assert(rc == 0);
- hal_gpio_irq_enable(RADIO_DIO_4);
-
- rc = hal_gpio_irq_init(RADIO_DIO_5, irqHandlers[5], NULL,
- HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_NONE);
- assert(rc == 0);
- hal_gpio_irq_enable(RADIO_DIO_5);
-}
-
-void SX1276IoDeInit( void )
-{
- hal_gpio_irq_release(RADIO_DIO_0);
- hal_gpio_irq_release(RADIO_DIO_1);
- hal_gpio_irq_release(RADIO_DIO_2);
- hal_gpio_irq_release(RADIO_DIO_3);
- hal_gpio_irq_release(RADIO_DIO_4);
- hal_gpio_irq_release(RADIO_DIO_5);
-}
-
-uint8_t SX1276GetPaSelect( uint32_t channel )
-{
- if( channel < RF_MID_BAND_THRESH )
- {
- return RF_PACONFIG_PASELECT_PABOOST;
- }
- else
- {
- return RF_PACONFIG_PASELECT_RFO;
- }
-}
-
-void SX1276SetAntSwLowPower( bool status )
-{
- if( RadioIsActive != status )
- {
- RadioIsActive = status;
-
- if( status == false )
- {
- SX1276AntSwInit( );
- }
- else
- {
- SX1276AntSwDeInit( );
- }
- }
-}
-
-void SX1276AntSwInit( void )
-{
- // Consider turning off GPIO pins for low power. They are always on right
- // now. GPIOTE library uses 0.5uA max when on, typical 0.1uA.
-}
-
-void SX1276AntSwDeInit( void )
-{
- // Consider this for low power - ie turning off GPIO pins
-}
-
-void SX1276SetAntSw( uint8_t rxTx )
-{
- if( rxTx != 0 ) // 1: TX, 0: RX
- {
- hal_gpio_write(SX1276_RXTX, 1);
- }
- else
- {
- hal_gpio_write(SX1276_RXTX, 0);
- }
-}
-
-bool SX1276CheckRfFrequency( uint32_t frequency )
-{
- // Implement check. Currently all frequencies are supported
- return true;
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/560fa920/hw/drivers/lora/node/radio/sx1276/src/sx1276-board.h
----------------------------------------------------------------------
diff --git a/hw/drivers/lora/node/radio/sx1276/src/sx1276-board.h b/hw/drivers/lora/node/radio/sx1276/src/sx1276-board.h
deleted file mode 100644
index 5156e8a..0000000
--- a/hw/drivers/lora/node/radio/sx1276/src/sx1276-board.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- / _____) _ | |
-( (____ _____ ____ _| |_ _____ ____| |__
- \____ \| ___ | (_ _) ___ |/ ___) _ \
- _____) ) ____| | | || |_| ____( (___| | | |
-(______/|_____)_|_|_| \__)_____)\____)_| |_|
- (C)2013 Semtech
-
-Description: SX1276 driver specific target board functions implementation
-
-License: Revised BSD License, see LICENSE.TXT file include in the project
-
-Maintainer: Miguel Luis and Gregory Cristian
-*/
-#ifndef __SX1276_ARCH_H__
-#define __SX1276_ARCH_H__
-
-#include "hal/hal_gpio.h"
-
-/*!
- * \brief Radio hardware registers initialization definition
- *
- * \remark Can be automatically generated by the SX1276 GUI (not yet implemented)
- */
-#define RADIO_INIT_REGISTERS_VALUE \
-{ \
- { MODEM_FSK , REG_LNA , 0x23 },\
- { MODEM_FSK , REG_RXCONFIG , 0x1E },\
- { MODEM_FSK , REG_RSSICONFIG , 0xD2 },\
- { MODEM_FSK , REG_AFCFEI , 0x01 },\
- { MODEM_FSK , REG_PREAMBLEDETECT , 0xAA },\
- { MODEM_FSK , REG_OSC , 0x07 },\
- { MODEM_FSK , REG_SYNCCONFIG , 0x12 },\
- { MODEM_FSK , REG_SYNCVALUE1 , 0xC1 },\
- { MODEM_FSK , REG_SYNCVALUE2 , 0x94 },\
- { MODEM_FSK , REG_SYNCVALUE3 , 0xC1 },\
- { MODEM_FSK , REG_PACKETCONFIG1 , 0xD8 },\
- { MODEM_FSK , REG_FIFOTHRESH , 0x8F },\
- { MODEM_FSK , REG_IMAGECAL , 0x02 },\
- { MODEM_FSK , REG_DIOMAPPING1 , 0x00 },\
- { MODEM_FSK , REG_DIOMAPPING2 , 0x30 },\
- { MODEM_LORA, REG_LR_PAYLOADMAXLENGTH, 0x40 },\
-} \
-
-#define RF_MID_BAND_THRESH 525000000
-
-/*!
- * \brief Initializes the radio I/Os pins interface
- */
-void SX1276IoInit( void );
-
-void SX1276IoIrqInit( DioIrqHandler **irqHandlers );
-
-/*!
- * \brief De-initializes the radio I/Os pins interface.
- *
- * \remark Useful when going in MCU low power modes
- */
-void SX1276IoDeInit( void );
-
-/*!
- * \brief Sets the radio output power.
- *
- * \param [IN] power Sets the RF output power
- */
-void SX1276SetRfTxPower( int8_t power );
-
-/*!
- * \brief Gets the board PA selection configuration
- *
- * \param [IN] channel Channel frequency in Hz
- * \retval PaSelect RegPaConfig PaSelect value
- */
-uint8_t SX1276GetPaSelect( uint32_t channel );
-
-/*!
- * \brief Set the RF Switch I/Os pins in Low Power mode
- *
- * \param [IN] status enable or disable
- */
-void SX1276SetAntSwLowPower( bool status );
-
-/*!
- * \brief Initializes the RF Switch I/Os pins interface
- */
-void SX1276AntSwInit( void );
-
-/*!
- * \brief De-initializes the RF Switch I/Os pins interface
- *
- * \remark Needed to decrease the power consumption in MCU low power modes
- */
-void SX1276AntSwDeInit( void );
-
-/*!
- * \brief Controls the antenna switch if necessary.
- *
- * \remark see errata note
- *
- * \param [IN] opMode Current radio operating mode
- */
-void SX1276SetAntSw( uint8_t opMode );
-
-/*!
- * \brief Checks if the given RF frequency is supported by the hardware
- *
- * \param [IN] frequency RF frequency to be checked
- * \retval isSupported [true: supported, false: unsupported]
- */
-bool SX1276CheckRfFrequency( uint32_t frequency );
-
-void hal_pin_rxtx (int val);
-
-/*!
- * Radio hardware and global parameters
- */
-extern SX1276_t SX1276;
-
-#endif // __SX1276_ARCH_H__