Fixed issue with drift in synth
This commit is contained in:
parent
de0197d71f
commit
10ff89ba01
@ -1,11 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2017, George Oikonomou - http://www.spd.gr
|
||||
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
@ -28,16 +27,15 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup cc13xx-cc26xx
|
||||
* \addtogroup cc13xx-cc26xx-cpu
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header with configuration defines common to the CC13xx/CC26xx platform.
|
||||
*
|
||||
* Header with configuration defines common to the CC13xx/CC26xx
|
||||
* platform.
|
||||
* \author
|
||||
* Edvard Pettersen <e.pettersen@ti.com>
|
||||
* Edvard Pettersen <e.pettersen@ti.com>
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef SIMPLELINK_CONF_H_
|
||||
@ -47,12 +45,20 @@
|
||||
|
||||
#include "rf-core.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* GPIO HAL configuration. */
|
||||
/**
|
||||
* \name GPIO HAL configuration.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define GPIO_HAL_CONF_ARCH_SW_TOGGLE 0
|
||||
#define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h"
|
||||
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* RF configuration */
|
||||
/**
|
||||
* \name RF configuration.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* If set, the systems keeps the HF crystal oscillator on even when the
|
||||
@ -65,96 +71,124 @@
|
||||
# define RF_FAST_RADIO_STARTUP 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Configure TX power to either default PA or High PA, defaults to
|
||||
* default PA.
|
||||
*/
|
||||
#ifndef RF_CONF_TXPOWER_HIGH_PA
|
||||
#define RF_CONF_TXPOWER_HIGH_PA 0
|
||||
#endif
|
||||
|
||||
#if (RF_CONF_TXPOWER_HIGH_PA) && !(SUPPORTS_HIGH_PA)
|
||||
# error "Device does not support High PA"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CC13xx only: Configure TX power to use boot mode, allowing to gain
|
||||
* up to 14 dBm with the default PA. This will, however, increase power
|
||||
* consumption.
|
||||
*/
|
||||
#ifndef RF_CONF_TXPOWER_BOOST_MODE
|
||||
#define RF_CONF_TXPOWER_BOOST_MODE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Configure RF mode. That is, whether to run on Sub-1 GHz (Prop-mode) or
|
||||
* 2.4 GHz (IEEE-mode).
|
||||
*/
|
||||
#ifdef RF_CONF_MODE
|
||||
/* Sanity check a valid configuration is given */
|
||||
/* Sanity check a valid configuration is provided. */
|
||||
# if !(RF_CONF_MODE & RF_MODE_BM)
|
||||
# error "Invalid RF_CONF_MODE"
|
||||
# error "Invalid RF_CONF_MODE provided"
|
||||
# endif
|
||||
|
||||
# define RF_MODE RF_CONF_MODE
|
||||
# define RF_MODE RF_CONF_MODE
|
||||
#endif /* RF_CONF_MODE */
|
||||
|
||||
/* Number of RX buffers */
|
||||
/* Number of RX buffers. */
|
||||
#ifdef RF_CONF_RX_BUF_CNT
|
||||
# define RF_RX_BUF_CNT RF_CONF_RX_BUF_CNT
|
||||
# define RF_RX_BUF_CNT RF_CONF_RX_BUF_CNT
|
||||
#else
|
||||
# define RF_RX_BUF_CNT 4
|
||||
# define RF_RX_BUF_CNT 4
|
||||
#endif
|
||||
|
||||
/* Size of each RX buffer in bytes */
|
||||
/* Size of each RX buffer in bytes. */
|
||||
#ifdef RF_CONF_RX_BUF_SIZE
|
||||
# define RF_RX_BUF_SIZE RF_CONF_RX_BUF_SIZE
|
||||
# define RF_RX_BUF_SIZE RF_CONF_RX_BUF_SIZE
|
||||
#else
|
||||
# define RF_RX_BUF_SIZE 144
|
||||
# define RF_RX_BUF_SIZE 144
|
||||
#endif
|
||||
|
||||
/* Enable/disable BLE beacon */
|
||||
/* Enable/disable BLE beacon. */
|
||||
#ifdef RF_CONF_BLE_BEACON_ENABLE
|
||||
# define RF_BLE_BEACON_ENABLE RF_CONF_BLE_BEACON_ENABLE
|
||||
# define RF_BLE_BEACON_ENABLE RF_CONF_BLE_BEACON_ENABLE
|
||||
#else
|
||||
# define RF_BLE_BEACON_ENABLE 0
|
||||
# define RF_BLE_BEACON_ENABLE 0
|
||||
#endif
|
||||
|
||||
#if (RF_BLE_BEACON_ENABLE) && !(SUPPORTS_BLE_BEACON)
|
||||
# error "Device does not support BLE for BLE beacon"
|
||||
#endif
|
||||
|
||||
/*----- CC13xx Device Line --------------------------------------------------*/
|
||||
/* CC13xx supports both IEEE and Prop mode, depending on which device */
|
||||
/* CC13xx supports both IEEE and Prop mode, depending on which device. */
|
||||
#if defined(DEVICE_LINE_CC13XX)
|
||||
|
||||
/* Default to Prop-mode for CC13xx devices if not configured */
|
||||
/* Default to Prop-mode for CC13xx devices if not configured. */
|
||||
# ifndef RF_MODE
|
||||
# define RF_MODE RF_MODE_SUB_1_GHZ
|
||||
# define RF_MODE RF_MODE_SUB_1_GHZ
|
||||
# endif
|
||||
|
||||
/*----- CC13xx Prop-mode ----------------------------------------------------*/
|
||||
# if (RF_MODE == RF_MODE_SUB_1_GHZ) && (SUPPORTS_PROP_MODE)
|
||||
/*----- CC13xx Prop Mode ----------------------------------------------------*/
|
||||
/* Netstack configuration */
|
||||
# define NETSTACK_CONF_RADIO prop_mode_driver
|
||||
|
||||
/* CSMA configuration */
|
||||
# define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300)
|
||||
# define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000)
|
||||
# define CSMA_CONF_SEND_SOFT_ACK 1
|
||||
/* Netstack configuration. */
|
||||
# define NETSTACK_CONF_RADIO prop_mode_driver
|
||||
|
||||
/* CSMA configuration. */
|
||||
# define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300)
|
||||
# define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000)
|
||||
# define CSMA_CONF_SEND_SOFT_ACK 1
|
||||
|
||||
/*----- CC13xx IEEE-mode ----------------------------------------------------*/
|
||||
# elif (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
|
||||
/*----- CC13xx IEEE Mode ----------------------------------------------------*/
|
||||
/* Netstack configuration */
|
||||
# define NETSTACK_CONF_RADIO ieee_mode_driver
|
||||
|
||||
/* CSMA configuration */
|
||||
# define CSMA_CONF_SEND_SOFT_ACK 0
|
||||
/* Netstack configuration. */
|
||||
# define NETSTACK_CONF_RADIO ieee_mode_driver
|
||||
|
||||
/* CSMA configuration. */
|
||||
# define CSMA_CONF_SEND_SOFT_ACK 0
|
||||
|
||||
# else
|
||||
/*----- CC13xx Non-supported Mode -------------------------------------------*/
|
||||
# error "Invalid radio mode configuration of CC13xx device"
|
||||
/*----- CC13xx Unsupported Mode ---------------------------------------------*/
|
||||
# error "Invalid RF mode configuration of CC13xx device"
|
||||
# endif /* CC13xx RF Mode configuration */
|
||||
|
||||
/*----- CC26xx Device Line --------------------------------------------------*/
|
||||
/* CC26xx only supports IEEE mode */
|
||||
#elif defined(DEVICE_LINE_CC26XX)
|
||||
|
||||
/* Default to IEEE-mode for CC13xx devices if not configured */
|
||||
/* Default to IEEE-mode for CC26xx devices if not configured */
|
||||
# ifndef RF_MODE
|
||||
# define RF_MODE RF_MODE_2_4_GHZ
|
||||
# define RF_MODE RF_MODE_2_4_GHZ
|
||||
# endif
|
||||
|
||||
/*----- CC26xx IEEE-mode ----------------------------------------------------*/
|
||||
# if (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
|
||||
/*----- CC26xx IEEE Mode ----------------------------------------------------*/
|
||||
|
||||
/* Netstack configuration */
|
||||
# define NETSTACK_CONF_RADIO ieee_mode_driver
|
||||
# define NETSTACK_CONF_RADIO ieee_mode_driver
|
||||
|
||||
/* CSMA configuration */
|
||||
# define CSMA_CONF_SEND_SOFT_ACK 0
|
||||
# define CSMA_CONF_SEND_SOFT_ACK 0
|
||||
|
||||
/* Frequncy band configuration */
|
||||
# undef DOT_15_4G_FREQ_BAND_ID
|
||||
# define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450
|
||||
# undef DOT_15_4G_FREQ_BAND_ID
|
||||
# define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450
|
||||
|
||||
# else
|
||||
/*----- CC26xx Non-supported Mode -------------------------------------------*/
|
||||
# error "IEEE mode only supported by CC26xx devices"
|
||||
/*----- CC26xx Unsupported Mode ---------------------------------------------*/
|
||||
# error "IEEE-mode only supported by CC26xx devices"
|
||||
# endif /* CC26xx RF Mode configuration */
|
||||
|
||||
/*----- Unsupported device line ---------------------------------------------*/
|
||||
@ -165,23 +199,23 @@
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name IEEE address configuration
|
||||
*
|
||||
* Used to generate our link-local & IPv6 address
|
||||
* \name IEEE address configuration. Used to generate our link-local and
|
||||
* global IPv6 addresses.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Location of the IEEE address
|
||||
* 0 => Read from InfoPage,
|
||||
* 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS
|
||||
* \brief Location of the IEEE address.
|
||||
* 0 => Read from InfoPage.
|
||||
* 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS.
|
||||
*/
|
||||
#ifndef IEEE_ADDR_CONF_HARDCODED
|
||||
#define IEEE_ADDR_CONF_HARDCODED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED
|
||||
* is defined as 1
|
||||
* \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED
|
||||
* is defined as 1. Must be a byte array of size 8.
|
||||
*/
|
||||
#ifndef IEEE_ADDR_CONF_ADDRESS
|
||||
#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF }
|
||||
@ -189,107 +223,157 @@
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name RF configuration
|
||||
* \name IEEE-mode configuration.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
/* RF Config */
|
||||
|
||||
/**
|
||||
* \brief Configure auto-ACK for IEEE-mode, which is ACK generated by the
|
||||
* radio.
|
||||
* 0 => ACK generated by software
|
||||
* 1 => ACK generated by the radio.
|
||||
*/
|
||||
#ifndef IEEE_MODE_CONF_AUTOACK
|
||||
#define IEEE_MODE_CONF_AUTOACK 1 /**< RF H/W generates ACKs */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Configure promiscouos mode for IEEE-mode.
|
||||
*/
|
||||
#ifndef IEEE_MODE_CONF_PROMISCOUS
|
||||
#define IEEE_MODE_CONF_PROMISCOUS 0 /**< 1 to enable promiscous mode */
|
||||
#endif
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name TI Drivers Configuration
|
||||
* \name TI Drivers Configuration.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* UART */
|
||||
/**
|
||||
* \brief Enable or disable UART driver.
|
||||
*/
|
||||
#ifndef TI_UART_CONF_ENABLE
|
||||
#define TI_UART_CONF_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Enable or disable UART0 peripheral.
|
||||
*/
|
||||
#ifndef TI_UART_CONF_UART0_ENABLE
|
||||
#define TI_UART_CONF_UART0_ENABLE TI_UART_CONF_ENABLE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Enable or disable UART1 peripheral.
|
||||
*/
|
||||
#ifndef TI_UART_CONF_UART1_ENABLE
|
||||
#define TI_UART_CONF_UART1_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief UART driver baud rate configuration.
|
||||
*/
|
||||
#ifndef TI_UART_CONF_BAUD_RATE
|
||||
#define TI_UART_CONF_BAUD_RATE 115200
|
||||
#endif
|
||||
|
||||
/* SPI */
|
||||
/**
|
||||
* \brief Enable or disable SPI driver.
|
||||
*/
|
||||
#ifndef TI_SPI_CONF_ENABLE
|
||||
#define TI_SPI_CONF_ENABLE 1
|
||||
#define TI_SPI_CONF_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Enable or disable SPI0 peripheral.
|
||||
*/
|
||||
#ifndef TI_SPI_CONF_SPI0_ENABLE
|
||||
#define TI_SPI_CONF_SPI0_ENABLE TI_SPI_CONF_ENABLE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Enable or disable SPI1 peripheral.
|
||||
*/
|
||||
#ifndef TI_SPI_CONF_SPI1_ENABLE
|
||||
#define TI_SPI_CONF_SPI1_ENABLE 0
|
||||
#endif
|
||||
|
||||
/* I2C */
|
||||
/**
|
||||
* \brief Enable or disable I2C driver.
|
||||
*/
|
||||
#ifndef TI_I2C_CONF_ENABLE
|
||||
#define TI_I2C_CONF_ENABLE 1
|
||||
#define TI_I2C_CONF_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Enable or disable I2C0 peripheral.
|
||||
*/
|
||||
#ifndef TI_I2C_CONF_I2C0_ENABLE
|
||||
#define TI_I2C_CONF_I2C0_ENABLE TI_I2C_CONF_ENABLE
|
||||
#endif
|
||||
|
||||
/* NVS */
|
||||
/**
|
||||
* \brief Enable or disable Non-Volatile Storage (NVS) driver.
|
||||
*/
|
||||
#ifndef TI_NVS_CONF_ENABLE
|
||||
#define TI_NVS_CONF_ENABLE 1
|
||||
#define TI_NVS_CONF_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Enable or disable internal flash storage.
|
||||
*/
|
||||
#ifndef TI_NVS_CONF_NVS_INTERNAL_ENABLE
|
||||
#define TI_NVS_CONF_NVS_INTERNAL_ENABLE TI_NVS_CONF_ENABLE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Enable or disable external flash storage.
|
||||
*/
|
||||
#ifndef TI_NVS_CONF_NVS_EXTERNAL_ENABLE
|
||||
#define TI_NVS_CONF_NVS_EXTERNAL_ENABLE TI_NVS_CONF_ENABLE
|
||||
#endif
|
||||
|
||||
/* Display */
|
||||
/**
|
||||
* \brief Enable or disable Display driver.
|
||||
*/
|
||||
#ifndef TI_DISPLAY_CONF_ENABLE
|
||||
#define TI_DISPLAY_CONF_ENABLE 0
|
||||
#endif
|
||||
|
||||
/* UART Display uses UART0 */
|
||||
/**
|
||||
* \brief Enable or disable UART Display peripheral.
|
||||
*/
|
||||
#ifndef TI_DISPLAY_CONF_UART_ENABLE
|
||||
#define TI_DISPLAY_CONF_UART_ENABLE TI_UART_CONF_UART0_ENABLE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Configure UART Display peripheral to use ANSI or not.
|
||||
*/
|
||||
#ifndef TI_DISPLAY_CONF_USE_UART_ANSI
|
||||
#define TI_DISPLAY_CONF_USE_UART_ANSI 0
|
||||
#endif
|
||||
|
||||
/* LCD Display uses SPI0 */
|
||||
/**
|
||||
* \brief Enable or disable LCD Display peripheral.
|
||||
*/
|
||||
#ifndef TI_DISPLAY_CONF_LCD_ENABLE
|
||||
#define TI_DISPLAY_CONF_LCD_ENABLE TI_SPI_CONF_SPI0_ENABLE
|
||||
#endif
|
||||
|
||||
/* SD card */
|
||||
/**
|
||||
* \brief Enable or disable SD driver.
|
||||
*/
|
||||
#ifndef TI_SD_CONF_ENABLE
|
||||
#define TI_SD_CONF_ENABLE 0
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Misc. Configuration
|
||||
* \name Slip configuration
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Alex Stanoev
|
||||
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -27,13 +27,14 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup cc13xx-cc26xx
|
||||
* \addtogroup cc13xx-cc26xx-cpu
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Customer Configuration (CCFG) for the cc13xx-cc26xx CPU family
|
||||
* Customer Configuration (CCFG) for the CC13xx/CC26xx CPU family.
|
||||
* \author
|
||||
* Edvard Pettersen <e.pettersen@ti.com>
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef CCFG_CONF_H_
|
||||
@ -50,14 +51,14 @@
|
||||
* @{
|
||||
*/
|
||||
#if CCFG_CONF_JTAG_INTERFACE_DISABLE
|
||||
# define SET_CCFG_CCFG_TI_OPTIONS_TI_FA_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_0_PRCM_TAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_1_PBIST2_TAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_1_PBIST1_TAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0x00
|
||||
#endif /* CCFG_CONF_JTAG_INTERFACE_DISABLE */
|
||||
# define SET_CCFG_CCFG_TI_OPTIONS_TI_FA_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_0_PRCM_TAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_1_PBIST2_TAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_1_PBIST1_TAP_ENABLE 0x00
|
||||
# define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0x00
|
||||
#endif
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
@ -67,36 +68,35 @@
|
||||
* output power with the default PA front-end configuration.
|
||||
* @{
|
||||
*/
|
||||
#if defined(DEVICE_LINE_CC13XX) && CC13XX_CONF_TXPOWER_BOOST_MODE
|
||||
# define CCFG_FORCE_VDDR_HH 1
|
||||
#endif /* CCFG_CONF_TXPOWER_BOOST_MODE */
|
||||
#if defined(DEVICE_LINE_CC13XX) && (RF_CONF_TXPOWER_BOOST_MODE)
|
||||
# define CCFG_FORCE_VDDR_HH 1
|
||||
#endif
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name ROM Bootloader configuration
|
||||
*
|
||||
* Enable/Disable the ROM bootloader in your image, if the board supports it.
|
||||
* Look in board.h to choose the DIO and corresponding level that will cause
|
||||
* Look in Board.h to choose the DIO and corresponding level that will cause
|
||||
* the chip to enter bootloader mode.
|
||||
* @{
|
||||
*/
|
||||
#ifndef CCFG_CONF_ROM_BOOTLOADER_ENABLE
|
||||
#define CCFG_CONF_ROM_BOOTLOADER_ENABLE 0
|
||||
#define CCFG_CONF_ROM_BOOTLOADER_ENABLE 0
|
||||
#endif
|
||||
|
||||
#if CCFG_CONF_ROM_BOOTLOADER_ENABLE
|
||||
# define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5
|
||||
# define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00
|
||||
# if defined(CCFG_CONF_BL_PIN_NUMBER)
|
||||
# define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCFG_CONF_BL_PIN_NUMBER
|
||||
# endif
|
||||
# define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5
|
||||
# define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5
|
||||
# define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00
|
||||
# if defined(CCFG_CONF_BL_PIN_NUMBER)
|
||||
# define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCFG_CONF_BL_PIN_NUMBER
|
||||
# endif
|
||||
# define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5
|
||||
#endif
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* CCFG_CONF_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -45,10 +45,13 @@
|
||||
#define DOT_15_4G_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <ti/devices/DeviceFamily.h>
|
||||
#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* IEEE 802.15.4g frequency band identifiers (Table 68f) */
|
||||
#define DOT_15_4G_FREQ_BAND_169 0 /* 169.400–169.475 (Europe) - 169 MHz band */
|
||||
#define DOT_15_4G_FREQ_BAND_450 1 /* 450–470 (US FCC Part 22/90) - 450 MHz band */
|
||||
@ -79,76 +82,89 @@
|
||||
*
|
||||
* DOT_15_4G_CHAN0_FREQ is specified here in KHz
|
||||
*/
|
||||
#if DOT_15_4G_FREQ_BAND_ID==DOT_15_4G_FREQ_BAND_470
|
||||
#if (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_470)
|
||||
# define DOT_15_4G_CHAN_MIN 0
|
||||
# define DOT_15_4G_CHAN_MAX 198
|
||||
# define DOT_15_4G_FREQ_SPACING 200
|
||||
# define DOT_15_4G_CHAN0_FREQ 470200
|
||||
|
||||
# define PROP_MODE_CONF_CENTER_FREQ 0x01EA
|
||||
# define PROP_MODE_CONF_LO_DIVIDER 0x0A
|
||||
|
||||
#elif DOT_15_4G_FREQ_BAND_ID==DOT_15_4G_FREQ_BAND_780
|
||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_780)
|
||||
# define DOT_15_4G_CHAN_MIN 0
|
||||
# define DOT_15_4G_CHAN_MAX 38
|
||||
# define DOT_15_4G_FREQ_SPACING 200
|
||||
# define DOT_15_4G_CHAN0_FREQ 779200
|
||||
|
||||
# define PROP_MODE_CONF_CENTER_FREQ 0x030F
|
||||
# define PROP_MODE_CONF_LO_DIVIDER 0x06
|
||||
|
||||
#elif DOT_15_4G_FREQ_BAND_ID==DOT_15_4G_FREQ_BAND_863
|
||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_863)
|
||||
# define DOT_15_4G_CHAN_MIN 0
|
||||
# define DOT_15_4G_CHAN_MAX 33
|
||||
# define DOT_15_4G_FREQ_SPACING 200
|
||||
# define DOT_15_4G_CHAN0_FREQ 863125
|
||||
|
||||
# define PROP_MODE_CONF_CENTER_FREQ 0x0362
|
||||
# define PROP_MODE_CONF_LO_DIVIDER 0x05
|
||||
|
||||
#elif DOT_15_4G_FREQ_BAND_ID==DOT_15_4G_FREQ_BAND_915
|
||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_915)
|
||||
# define DOT_15_4G_CHAN_MIN 0
|
||||
# define DOT_15_4G_CHAN_MAX 128
|
||||
# define DOT_15_4G_FREQ_SPACING 200
|
||||
# define DOT_15_4G_CHAN0_FREQ 902200
|
||||
|
||||
# define PROP_MODE_CONF_CENTER_FREQ 0x0393
|
||||
# define PROP_MODE_CONF_LO_DIVIDER 0x05
|
||||
|
||||
#elif DOT_15_4G_FREQ_BAND_ID==DOT_15_4G_FREQ_BAND_920
|
||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_920)
|
||||
# define DOT_15_4G_CHAN_MIN 0
|
||||
# define DOT_15_4G_CHAN_MAX 37
|
||||
# define DOT_15_4G_FREQ_SPACING 200
|
||||
# define DOT_15_4G_CHAN0_FREQ 920600
|
||||
|
||||
# define PROP_MODE_CONF_CENTER_FREQ 0x039C
|
||||
# define PROP_MODE_CONF_LO_DIVIDER 0x05
|
||||
|
||||
#elif DOT_15_4G_FREQ_BAND_ID==DOT_15_4G_FREQ_BAND_950
|
||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_950)
|
||||
# define DOT_15_4G_CHAN_MIN 0
|
||||
# define DOT_15_4G_CHAN_MAX 32
|
||||
# define DOT_15_4G_FREQ_SPACING 200
|
||||
# define DOT_15_4G_CHAN0_FREQ 951000
|
||||
|
||||
# define PROP_MODE_CONF_CENTER_FREQ 0x03BA
|
||||
# define PROP_MODE_CONF_LO_DIVIDER 0x05
|
||||
|
||||
#elif DOT_15_4G_FREQ_BAND_ID==DOT_15_4G_FREQ_BAND_2450
|
||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_2450)
|
||||
# define DOT_15_4G_CHAN_MIN 11
|
||||
# define DOT_15_4G_CHAN_MAX 26
|
||||
# define DOT_15_4G_FREQ_SPACING 5000
|
||||
# define DOT_15_4G_CHAN0_FREQ 2405000
|
||||
|
||||
#else
|
||||
# error The selected IEEE 802.15.4g frequency band is not supported
|
||||
# error "The selected IEEE 802.15.4g frequency band is not supported"
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define DOT_15_4_G_FREQ(chan) \
|
||||
(DOT_15_4G_CHAN0_FREQ + DOT_15_4G_FREQ_SPACING * ((chan) - DOT_15_4G_CHAN_MIN))
|
||||
|
||||
#define DOT_15_4_G_CHAN_IN_RANGE(chan) \
|
||||
(((chan) >= DOT_15_4G_CHAN_MIN) && ((chan) <= DOT_15_4G_CHAN_MAX))
|
||||
static inline uint32_t
|
||||
dot_15_4g_freq(const uint16_t chan)
|
||||
{
|
||||
const uint32_t chan0 = DOT_15_4G_CHAN0_FREQ;
|
||||
const uint32_t spacing = DOT_15_4G_FREQ_SPACING;
|
||||
const uint32_t chan_min = DOT_15_4G_CHAN_MIN;
|
||||
return (chan0 + spacing * ((uint32_t)chan - chan_min));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define DOT_15_4_G_DEFAULT_CHAN IEEE802154_DEFAULT_CHANNEL
|
||||
|
||||
/* Sanity check default channel */
|
||||
#if !(DOT_15_4_G_CHAN_IN_RANGE(DOT_15_4_G_DEFAULT_CHAN))
|
||||
# error IEEE802154_DEFAULT_CHANNEL is not in valid channel range
|
||||
#endif
|
||||
static inline bool
|
||||
dot_15_4g_chan_in_range(const uint16_t chan)
|
||||
{
|
||||
const uint16_t chan_min = DOT_15_4G_CHAN_MIN;
|
||||
const uint16_t chan_max = DOT_15_4G_CHAN_MAX;
|
||||
return ((chan >= chan_min) &&
|
||||
(chan <= chan_max));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define DOT_15_4G_DEFAULT_CHAN IEEE802154_DEFAULT_CHANNEL
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* DOT_15_4G_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "contiki.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "sys/cc.h"
|
||||
#include "sys/etimer.h"
|
||||
#include "sys/process.h"
|
||||
#include "sys/energest.h"
|
||||
#include "net/netstack.h"
|
||||
@ -60,10 +61,10 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if 0
|
||||
# define PRINTF(...)
|
||||
#else
|
||||
#if 1
|
||||
# define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
# define PRINTF(...)
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define CMD_FS_RETRIES 3
|
||||
@ -78,11 +79,17 @@
|
||||
|
||||
#define EVENTS_CMD_DONE(events) (((events) & RF_EVENTS_CMD_DONE) != 0)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Synth re-calibration every 3 minutes */
|
||||
#define SYNTH_RECAL_INTERVAL (CLOCK_SECOND * 60 * 3)
|
||||
|
||||
static struct etimer synth_recal_timer;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static RF_Object rf_netstack;
|
||||
static RF_Object rf_ble;
|
||||
|
||||
static RF_CmdHandle cmd_rx_handle;
|
||||
|
||||
static bool rf_is_on;
|
||||
static volatile bool rx_buf_full;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
@ -180,6 +187,9 @@ rf_yield(void)
|
||||
|
||||
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
|
||||
|
||||
etimer_stop(&synth_recal_timer);
|
||||
rf_is_on = false;
|
||||
|
||||
return RF_RESULT_OK;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -285,7 +295,7 @@ netstack_sched_ieee_tx(bool recieve_ack)
|
||||
* chained TX command.
|
||||
*/
|
||||
if (rx_ack_required) {
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(false);
|
||||
if (res != RF_RESULT_OK) {
|
||||
return res;
|
||||
}
|
||||
@ -393,7 +403,7 @@ netstack_sched_prop_tx(void)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
rf_result_t
|
||||
netstack_sched_rx(void)
|
||||
netstack_sched_rx(bool start)
|
||||
{
|
||||
if (cmd_rx_is_active()) {
|
||||
PRINTF("netstack_sched_rx: already in RX\n");
|
||||
@ -424,6 +434,11 @@ netstack_sched_rx(void)
|
||||
|
||||
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
|
||||
|
||||
if (start) {
|
||||
rf_is_on = true;
|
||||
process_poll(&rf_core_process);
|
||||
}
|
||||
|
||||
return RF_RESULT_OK;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -502,27 +517,47 @@ PROCESS_THREAD(rf_core_process, ev, data)
|
||||
PROCESS_BEGIN();
|
||||
|
||||
while(1) {
|
||||
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
|
||||
PROCESS_YIELD_UNTIL((ev == PROCESS_EVENT_POLL) ||
|
||||
etimer_expired(&synth_recal_timer));
|
||||
|
||||
do {
|
||||
//watchdog_periodic();
|
||||
packetbuf_clear();
|
||||
len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
||||
if (ev == PROCESS_EVENT_POLL) {
|
||||
do {
|
||||
watchdog_periodic();
|
||||
packetbuf_clear();
|
||||
len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
||||
|
||||
if (rx_buf_full) {
|
||||
PRINTF("rf_core: RX buf full, restart RX\n");
|
||||
rx_buf_full = false;
|
||||
/* Restart RX */
|
||||
netstack_stop_rx();
|
||||
netstack_sched_rx();
|
||||
}
|
||||
/*
|
||||
* RX will stop if the RX buffers are full. In this case, restart
|
||||
* RX after we've freed at least on packet.
|
||||
*/
|
||||
if (rx_buf_full) {
|
||||
PRINTF("rf_core: RX buf full, restart RX\n");
|
||||
rx_buf_full = false;
|
||||
|
||||
if(len > 0) {
|
||||
packetbuf_set_datalen(len);
|
||||
/* Restart RX. */
|
||||
netstack_stop_rx();
|
||||
netstack_sched_rx(false);
|
||||
}
|
||||
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
} while(len > 0);
|
||||
if(len > 0) {
|
||||
packetbuf_set_datalen(len);
|
||||
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
} while(len > 0);
|
||||
}
|
||||
|
||||
/* start the synth re-calibration timer once. */
|
||||
if (rf_is_on) {
|
||||
rf_is_on = false;
|
||||
etimer_set(&synth_recal_timer, SYNTH_RECAL_INTERVAL);
|
||||
}
|
||||
/* Scheduling CMD_FS will re-calibrate the synth. */
|
||||
if (etimer_expired(&synth_recal_timer)) {
|
||||
netstack_sched_fs();
|
||||
|
||||
etimer_reset(&synth_recal_timer);
|
||||
}
|
||||
}
|
||||
PROCESS_END();
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ RF_Handle netstack_open(RF_Params *params);
|
||||
rf_result_t netstack_sched_fs(void);
|
||||
rf_result_t netstack_sched_ieee_tx(bool recieve_ack);
|
||||
rf_result_t netstack_sched_prop_tx(void);
|
||||
rf_result_t netstack_sched_rx(void);
|
||||
rf_result_t netstack_sched_rx(bool start);
|
||||
rf_result_t netstack_stop_rx(void);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* BLE radio: BLE Beacon Daemon */
|
||||
|
@ -78,7 +78,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if 0
|
||||
#if 1
|
||||
# define PRINTF(...)
|
||||
#else
|
||||
# define PRINTF(...) printf(__VA_ARGS__)
|
||||
@ -106,23 +106,13 @@
|
||||
#else
|
||||
# define IEEE_MODE_RSSI_THRESHOLD 0xA6
|
||||
#endif /* IEEE_MODE_CONF_RSSI_THRESHOLD */
|
||||
|
||||
/* Configuration for TX power table */
|
||||
#ifdef IEEE_MODE_CONF_TX_POWER_TABLE
|
||||
# define TX_POWER_TABLE IEEE_MODE_CONF_TX_POWER_TABLE
|
||||
#else
|
||||
# define TX_POWER_TABLE rf_ieee_tx_power_table
|
||||
#endif
|
||||
|
||||
#ifdef IEEE_MODE_CONF_TX_POWER_TABLE_SIZE
|
||||
# define TX_POWER_TABLE_SIZE IEEE_MODE_CONF_TX_POWER_TABLE_SIZE
|
||||
#else
|
||||
# define TX_POWER_TABLE_SIZE RF_IEEE_TX_POWER_TABLE_SIZE
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* TX power table convenience macros */
|
||||
#define TX_POWER_MIN (TX_POWER_TABLE[0].power)
|
||||
#define TX_POWER_MAX (TX_POWER_TABLE[TX_POWER_TABLE_SIZE - 1].power)
|
||||
#define TX_POWER_TABLE rf_ieee_tx_power_table
|
||||
#define TX_POWER_TABLE_SIZE rf_ieee_tx_power_table_size
|
||||
|
||||
#define TX_POWER_MIN (TX_POWER_TABLE[0].power)
|
||||
#define TX_POWER_MAX (TX_POWER_TABLE[TX_POWER_TABLE_SIZE - 1].power)
|
||||
|
||||
#define TX_POWER_IN_RANGE(dbm) (((dbm) >= TX_POWER_MIN) && ((dbm) <= TX_POWER_MAX))
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -310,10 +300,10 @@ init_rf_params(void)
|
||||
static rf_result_t
|
||||
set_channel(uint8_t channel)
|
||||
{
|
||||
if (!DOT_15_4_G_CHAN_IN_RANGE(channel)) {
|
||||
if (!dot_15_4g_chan_in_range(channel)) {
|
||||
PRINTF("set_channel: illegal channel %d, defaults to %d\n",
|
||||
(int)channel, DOT_15_4_G_DEFAULT_CHAN);
|
||||
channel = DOT_15_4_G_DEFAULT_CHAN;
|
||||
(int)channel, DOT_15_4G_DEFAULT_CHAN);
|
||||
channel = DOT_15_4G_DEFAULT_CHAN;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -328,7 +318,7 @@ set_channel(uint8_t channel)
|
||||
|
||||
cmd_rx.channel = channel;
|
||||
|
||||
const uint32_t new_freq = (uint32_t)DOT_15_4_G_FREQ(channel);
|
||||
const uint32_t new_freq = dot_15_4g_freq(channel);
|
||||
const uint16_t freq = (uint16_t)(new_freq / 1000);
|
||||
const uint16_t frac = (uint16_t)(((new_freq - (freq * 1000)) * 0x10000) / 1000);
|
||||
|
||||
@ -428,7 +418,7 @@ init(void)
|
||||
return RF_RESULT_ERROR;
|
||||
}
|
||||
|
||||
set_channel(DOT_15_4_G_DEFAULT_CHAN);
|
||||
set_channel(DOT_15_4G_DEFAULT_CHAN);
|
||||
|
||||
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
|
||||
|
||||
@ -598,7 +588,7 @@ cca_request(cmd_cca_req_t *cmd_cca_req)
|
||||
const bool rx_is_idle = !rx_is_active();
|
||||
|
||||
if (rx_is_idle) {
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(false);
|
||||
if (res != RF_RESULT_OK) {
|
||||
return RF_RESULT_ERROR;
|
||||
}
|
||||
@ -700,7 +690,7 @@ on(void)
|
||||
|
||||
data_queue_reset();
|
||||
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(true);
|
||||
|
||||
if (res != RF_RESULT_OK) {
|
||||
return RF_RESULT_ERROR;
|
||||
@ -854,7 +844,7 @@ set_value(radio_param_t param, radio_value_t value)
|
||||
|
||||
/* Channel */
|
||||
case RADIO_PARAM_CHANNEL:
|
||||
if (!DOT_15_4_G_CHAN_IN_RANGE(value)) {
|
||||
if (!dot_15_4g_chan_in_range(value)) {
|
||||
return RADIO_RESULT_INVALID_VALUE;
|
||||
}
|
||||
set_channel((uint8_t)value);
|
||||
@ -868,7 +858,7 @@ set_value(radio_param_t param, radio_value_t value)
|
||||
}
|
||||
|
||||
netstack_stop_rx();
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(false);
|
||||
return (res == RF_RESULT_OK)
|
||||
? RADIO_RESULT_OK
|
||||
: RADIO_RESULT_ERROR;
|
||||
@ -881,7 +871,7 @@ set_value(radio_param_t param, radio_value_t value)
|
||||
}
|
||||
|
||||
netstack_stop_rx();
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(false);
|
||||
return (res == RF_RESULT_OK)
|
||||
? RADIO_RESULT_OK
|
||||
: RADIO_RESULT_ERROR;
|
||||
@ -920,7 +910,7 @@ set_value(radio_param_t param, radio_value_t value)
|
||||
}
|
||||
|
||||
netstack_stop_rx();
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(false);
|
||||
return (res == RF_RESULT_OK)
|
||||
? RADIO_RESULT_OK
|
||||
: RADIO_RESULT_ERROR;
|
||||
@ -952,7 +942,7 @@ set_value(radio_param_t param, radio_value_t value)
|
||||
}
|
||||
|
||||
netstack_stop_rx();
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(false);
|
||||
return (res == RF_RESULT_OK)
|
||||
? RADIO_RESULT_OK
|
||||
: RADIO_RESULT_ERROR;
|
||||
@ -1028,7 +1018,7 @@ set_object(radio_param_t param, const void *src, size_t size)
|
||||
}
|
||||
|
||||
netstack_stop_rx();
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(false);
|
||||
return (res == RF_RESULT_OK)
|
||||
? RADIO_RESULT_OK
|
||||
: RADIO_RESULT_ERROR;
|
||||
|
@ -136,15 +136,9 @@
|
||||
/* How long to wait for the rx read entry to become ready */
|
||||
#define TIMEOUT_DATA_ENTRY_BUSY (RTIMER_SECOND / 250)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Configuration for TX power table */
|
||||
#ifdef PROP_MODE_CONF_TX_POWER_TABLE
|
||||
# define TX_POWER_TABLE PROP_MODE_CONF_TX_POWER_TABLE
|
||||
#else
|
||||
# define TX_POWER_TABLE rf_prop_tx_power_table
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* TX power table convenience macros */
|
||||
#define TX_POWER_TABLE_SIZE ((sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1)
|
||||
#define TX_POWER_TABLE rf_prop_tx_power_table
|
||||
#define TX_POWER_TABLE_SIZE rf_prop_tx_power_table_size
|
||||
|
||||
#define TX_POWER_MIN (TX_POWER_TABLE[0].power)
|
||||
#define TX_POWER_MAX (TX_POWER_TABLE[TX_POWER_TABLE_SIZE - 1].power)
|
||||
@ -208,11 +202,14 @@ static int off(void);
|
||||
static void
|
||||
init_rf_params(void)
|
||||
{
|
||||
cmd_radio_setup.centerFreq = PROP_MODE_CONF_CENTER_FREQ;
|
||||
cmd_radio_setup.loDivider = PROP_MODE_CONF_LO_DIVIDER;
|
||||
|
||||
data_queue_t *data_queue = data_queue_init(sizeof(lensz_t));
|
||||
|
||||
cmd_rx.maxPktLen = DOT_4G_MAX_FRAME_LEN - cmd_rx.lenOffset;
|
||||
cmd_rx.pQueue = data_queue;
|
||||
cmd_rx.pOutput = (uint8_t *)&prop_radio.rx_stats;
|
||||
cmd_rx.pQueue = data_queue;
|
||||
cmd_rx.pOutput = (uint8_t *)&prop_radio.rx_stats;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int8_t
|
||||
@ -223,7 +220,7 @@ get_rssi(void)
|
||||
const bool rx_is_idle = !rx_is_active();
|
||||
|
||||
if (rx_is_idle) {
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(false);
|
||||
if (res != RF_RESULT_OK) {
|
||||
return RF_GET_RSSI_ERROR_VAL;
|
||||
}
|
||||
@ -266,10 +263,10 @@ set_channel(uint16_t channel)
|
||||
{
|
||||
rf_result_t res;
|
||||
|
||||
if (!DOT_15_4_G_CHAN_IN_RANGE(channel)) {
|
||||
if (!dot_15_4g_chan_in_range(channel)) {
|
||||
PRINTF("set_channel: illegal channel %d, defaults to %d\n",
|
||||
(int)channel, IEEE802154_DEFAULT_CHANNEL);
|
||||
channel = IEEE802154_DEFAULT_CHANNEL;
|
||||
(int)channel, DOT_15_4G_DEFAULT_CHAN);
|
||||
channel = DOT_15_4G_DEFAULT_CHAN;
|
||||
}
|
||||
|
||||
if (channel == prop_radio.channel) {
|
||||
@ -277,7 +274,7 @@ set_channel(uint16_t channel)
|
||||
return RF_RESULT_OK;
|
||||
}
|
||||
|
||||
const uint32_t new_freq = DOT_15_4_G_FREQ(channel);
|
||||
const uint32_t new_freq = dot_15_4g_freq(channel);
|
||||
const uint16_t freq = (uint16_t)(new_freq / 1000);
|
||||
const uint16_t frac = (uint16_t)(((new_freq - (freq * 1000)) * 0x10000) / 1000);
|
||||
|
||||
@ -513,7 +510,7 @@ on(void)
|
||||
|
||||
data_queue_reset();
|
||||
|
||||
res = netstack_sched_rx();
|
||||
res = netstack_sched_rx(true);
|
||||
|
||||
if (res != RF_RESULT_OK) {
|
||||
return RF_RESULT_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user