Merge branch 'develop' into impl-starting-EB-RFC8180

This commit is contained in:
Simon Duquennoy 2019-02-18 09:41:10 +01:00 committed by GitHub
commit 8c9a06d66a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
189 changed files with 12148 additions and 562 deletions

View File

@ -82,7 +82,10 @@ uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
### Include target makefile (TODO Unsafe?)
target_makefile := $(wildcard $(CONTIKI)/arch/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
# Configurable arch path
ARCH_PATH ?= $(CONTIKI)/arch
target_makefile := $(wildcard $(ARCH_PATH)/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
# Check if the target makefile exists, and create the object directory if necessary.
ifeq ($(strip $(target_makefile)),)
@ -326,13 +329,13 @@ clean:
@echo Target $(TARGET) cleaned
distclean:
@for TARG in `ls $(CONTIKI)/arch/platform $(TARGETDIRS)`; do \
@for TARG in `ls $(ARCH_PATH)/platform $(TARGETDIRS)`; do \
echo Running: $(MAKE) TARGET=$$TARG clean; \
$(MAKE) TARGET=$$TARG clean; \
done
-$(Q)rm -rf $(BUILD_DIR)
-include $(CONTIKI)/arch/platform/$(TARGET)/Makefile.customrules-$(TARGET)
-include $(ARCH_PATH)/platform/$(TARGET)/Makefile.customrules-$(TARGET)
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
@ -414,7 +417,7 @@ endif
include $(CONTIKI)/Makefile.help
targets:
@ls $(CONTIKI)/arch/platform $(TARGETDIRS)
@ls $(ARCH_PATH)/platform $(TARGETDIRS)
boards:
ifdef BOARD
@ -475,6 +478,8 @@ ifeq ($(PLATFORM_ACTION),skip)
# Skip this target.
$(CONTIKI_PROJECT):
@echo "Skipping $@: not for the '$(TARGET)/$(BOARD)' platform!"
%.$(TARGET):
@echo "Skipping $@: not for the '$(TARGET)/$(BOARD)' platform!"
else
# Build this target.
# Match-anything pattern rule to allow the project makefiles to

View File

@ -8,7 +8,7 @@
Contiki-NG is an open-source, cross-platform operating system for Next-Generation IoT devices. It focuses on dependable (secure and reliable) low-power communication and standard protocols, such as IPv6/6LoWPAN, 6TiSCH, RPL, and CoAP. Contiki-NG comes with extensive documentation, tutorials, a roadmap, release cycle, and well-defined development flow for smooth integration of community contributions.
Unless excplicitly stated otherwise, Contiki-NG sources are distributed under
Unless explicitly stated otherwise, Contiki-NG sources are distributed under
the terms of the [3-clause BSD license](LICENSE.md). This license gives
everyone the right to use and distribute the code, either in binary or
source code format, as long as the copyright license is retained in

View File

@ -25,4 +25,4 @@ $(OUT_ELF): $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.o $(PROJECT_OBJECTFILES)
$(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFLAGS) -o $@
include $(CONTIKI)/arch/cpu/arm/Makefile.arm
include $(ARCH_PATH)/cpu/arm/Makefile.arm

View File

@ -6,4 +6,4 @@ LDFLAGS += -mcpu=cortex-m3 -nostartfiles
TARGET_LIBFILES += -lm
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m
include $(ARCH_PATH)/cpu/arm/cortex-m/Makefile.cortex-m

View File

@ -4,4 +4,4 @@ CFLAGS += -mcpu=cortex-m4
LDFLAGS += -mcpu=cortex-m4
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m
include $(ARCH_PATH)/cpu/arm/cortex-m/Makefile.cortex-m

View File

@ -52,4 +52,4 @@ $(LDSCRIPT): $(SOURCE_LDSCRIPT) FORCE | $(OBJECTDIR)
$(TRACE_CC)
$(Q)$(CC) $(LDGENFLAGS) $< | grep -v '^\s*#\s*pragma\>' > $@
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3
include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3

View File

@ -44,6 +44,7 @@ CONTIKI_CPU_SOURCEFILES += rf-core.c rf-ble.c ieee-mode.c
CONTIKI_CPU_SOURCEFILES += ble-cc2650.c ble-hal-cc26xx.c ble-addr.c rf-ble-cmd.c
CONTIKI_CPU_SOURCEFILES += random.c soc-trng.c int-master.c
CONTIKI_CPU_SOURCEFILES += spi-arch.c
CONTIKI_CPU_SOURCEFILES += cc26xx-aes.c
CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES)
@ -81,7 +82,7 @@ STACK_SIZE = 0
@$(SIZE) -A $< | egrep "data|bss" | awk '{s+=$$2} END {s=s+$(STACK_SIZE); f=$(RAM_SIZE)-s; printf "[RAM] used %6d, free %6d\n",s,f;}'
@$(SIZE) -A $< | egrep "text|isr_vector" | awk '{s+=$$2} END {f=$(FLASH_SIZE)-s; printf "[Flash] used %6d, free %6d\n",s,f;}'
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3
include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3
ifeq ($(BOARD_SUPPORTS_BSL),1)
%.upload: $(OUT_BIN)

View File

@ -102,6 +102,11 @@
#define NETSTACK_RADIO_MAX_PAYLOAD_LEN 125
/* Platform-specific (H/W) AES implementation */
#ifndef AES_128_CONF
#define AES_128_CONF cc26xx_aes_128_driver
#endif /* AES_128_CONF */
/** @} */
/*---------------------------------------------------------------------------*/
/**

View File

@ -0,0 +1,127 @@
/*
* Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute 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 INSTITUTE 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 THE INSTITUTE OR CONTRIBUTORS 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.
*/
/**
* \addtogroup cc26xx-aes
* @{
*
* \file
* Implementation of the AES driver for the CC26x0/CC13x0 SoC
* \author
* Atis Elsts <atis.elsts@gmail.com>
*/
#include "contiki.h"
#include "dev/cc26xx-aes.h"
#include "ti-lib.h"
/*---------------------------------------------------------------------------*/
#include "sys/log.h"
#define LOG_MODULE "cc26xx-aes"
#define LOG_LEVEL LOG_LEVEL_MAIN
/*---------------------------------------------------------------------------*/
static uint32_t skey[AES_128_KEY_LENGTH / sizeof(uint32_t)];
/*---------------------------------------------------------------------------*/
void
cc26xx_aes_set_key(const uint8_t *key)
{
memcpy(skey, key, AES_128_KEY_LENGTH);
}
/*---------------------------------------------------------------------------*/
static void
encrypt_decrypt(uint8_t *plaintext_and_result, bool do_encrypt)
{
uint32_t result[AES_128_BLOCK_SIZE / sizeof(uint32_t)];
unsigned status;
int i;
/* First, make sure the PERIPH PD is on */
ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH);
while((ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH)
!= PRCM_DOMAIN_POWER_ON));
/* Enable CRYPTO peripheral */
ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_CRYPTO);
ti_lib_prcm_load_set();
while(!ti_lib_prcm_load_get());
status = ti_lib_crypto_aes_load_key(skey, CRYPTO_KEY_AREA_0);
if(status != AES_SUCCESS) {
LOG_WARN("load key failed: %u\n", status);
} else {
status = ti_lib_crypto_aes_ecb((uint32_t *)plaintext_and_result, result, CRYPTO_KEY_AREA_0, do_encrypt, false);
if(status != AES_SUCCESS) {
LOG_WARN("ecb failed: %u\n", status);
} else {
for(i = 0; i < 100; ++i) {
ti_lib_cpu_delay(10);
status = ti_lib_crypto_aes_ecb_status();
if(status != AES_DMA_BSY) {
break;
}
}
ti_lib_crypto_aes_ecb_finish();
if(status != AES_SUCCESS) {
LOG_WARN("ecb get result failed: %u\n", status);
}
}
}
ti_lib_prcm_peripheral_run_disable(PRCM_PERIPH_CRYPTO);
ti_lib_prcm_load_set();
while(!ti_lib_prcm_load_get());
if(status == AES_SUCCESS) {
memcpy(plaintext_and_result, result, AES_128_BLOCK_SIZE);
} else {
/* corrupt the result */
plaintext_and_result[0] ^= 1;
}
}
/*---------------------------------------------------------------------------*/
void
cc26xx_aes_encrypt(uint8_t *plaintext_and_result)
{
encrypt_decrypt(plaintext_and_result, true);
}
/*---------------------------------------------------------------------------*/
void
cc26xx_aes_decrypt(uint8_t *cyphertext_and_result)
{
encrypt_decrypt(cyphertext_and_result, false);
}
/*---------------------------------------------------------------------------*/
const struct aes_128_driver cc26xx_aes_128_driver = {
cc26xx_aes_set_key,
cc26xx_aes_encrypt
};
/** @} */

View File

@ -0,0 +1,80 @@
/*
* Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute 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 INSTITUTE 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 THE INSTITUTE OR CONTRIBUTORS 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.
*/
/**
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-aes CC26x0/CC13x0 AES-128
*
* AES-128 driver for the CC26x0/CC13x0 SoC
* @{
*
* \file
* Header file of the AES-128 driver for the CC26xx SoC
* \author
* Atis Elsts <atis.elsts@gmail.com>
*/
#ifndef CC2538_AES_H_
#define CC2538_AES_H_
#include "lib/aes-128.h"
/**
* \brief Set a key to use in subsequent encryption & decryption operations.
* \param key The key to use
*
* The size of the key must be AES_128_KEY_LENGTH.
*/
void cc26xx_aes_set_key(const uint8_t *key);
/**
* \brief Encrypt a message using the SoC AES-128 hardware implementation
* \param plaintext_and_result In: message to encrypt, out: the encrypted message.
*
* The size of the message must be AES_128_BLOCK_SIZE.
* The key to use in the encryption must be set before calling this function.
*/
void cc26xx_aes_encrypt(uint8_t *plaintext_and_result);
/**
* \brief Decrypt a message using the SoC AES-128 hardware implementation
* \param cyphertext_and_result In: message to decrypt, out: the decrypted message.
*
* The size of the message must be AES_128_BLOCK_SIZE.
* The key to use in the decryption must be set before calling this function.
*/
void cc26xx_aes_decrypt(uint8_t *cyphertext_and_result);
extern const struct aes_128_driver cc26xx_aes_128_driver;
#endif /* CC2538_AES_H_ */
/**
* @}
* @}
*/

View File

@ -572,6 +572,14 @@
#define ti_lib_watchdog_stall_enable(...) WatchdogStallEnable(__VA_ARGS__)
#define ti_lib_watchdog_stall_disable(...) WatchdogStallDisable(__VA_ARGS__)
/*---------------------------------------------------------------------------*/
/* crypto.h */
#include "driverlib/crypto.h"
#define ti_lib_crypto_aes_load_key(...) CRYPTOAesLoadKey(__VA_ARGS__)
#define ti_lib_crypto_aes_ecb(...) CRYPTOAesEcb(__VA_ARGS__)
#define ti_lib_crypto_aes_ecb_status(...) CRYPTOAesEcbStatus(__VA_ARGS__)
#define ti_lib_crypto_aes_ecb_finish(...) CRYPTOAesEcbFinish(__VA_ARGS__)
/*---------------------------------------------------------------------------*/
#endif /* TI_LIB_H_ */
/*---------------------------------------------------------------------------*/
/**

View File

@ -11,7 +11,7 @@ CFLAGS += -gstabs+
.SUFFIXES:
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/msp430
CONTIKI_CPU=$(ARCH_PATH)/cpu/msp430
### Define the source files we have in the MSP430 port

View File

@ -185,10 +185,12 @@ $(OBJECT_DIRECTORY)/%.o: %.s
$(TRACE_CC)
$(Q)$(CC) $(ASMFLAGS) $(addprefix -I$(NRF52_SDK_ROOT)/, $(INC_PATHS)) -c -o $@ $<
%.jlink:
sed -e 's/#OUTPUT_FILENAME#/$*.hex/' $(CONTIKI_CPU)/flash.jlink > $@
include $(ARCH_PATH)/cpu/arm/cortex-m/cm4/Makefile.cm4
%.flash: %.hex %.jlink
%.jlink: $(OUT_HEX)
sed -e 's,#OUTPUT_FILENAME#,$<,' $(CONTIKI_CPU)/flash.jlink > $@
%.flash: %.jlink
@echo Flashing: $^
$(JLINK) $(JLINK_OPTS) -CommanderScript $*.jlink
@ -203,5 +205,3 @@ erase:
$(JLINK) $(JLINK_OPTS) -CommanderScript $(CONTIKI_CPU)/erase.jlink
.PHONY: softdevice.jlink
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm4/Makefile.cm4

View File

@ -8,4 +8,4 @@ TARGET_LIBFILES += $(SDK_DRIVERS)/lib/drivers_$(SDK_LIB_NAME).am3g
TARGET_LIBFILES += $(SDK_DEVICES)/driverlib/bin/gcc/driverlib.lib
# CC13x0/CC26x0 is a Cortex-M3 architecture
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3
include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3

View File

@ -8,4 +8,4 @@ TARGET_LIBFILES += $(SDK_DRIVERS)/lib/drivers_$(SDK_LIB_NAME).am4fg
TARGET_LIBFILES += $(SDK_DEVICES)/driverlib/bin/gcc/driverlib.lib
# CC13x2/CC26x2 is a Cortex-M4 architecture
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm4/Makefile.cm4
include $(ARCH_PATH)/cpu/arm/cortex-m/cm4/Makefile.cm4

View File

@ -133,6 +133,32 @@
#define RF_MODE RF_CONF_MODE
#endif /* RF_CONF_MODE */
/* Sub-1 GHz path front-end mode configuration */
#ifdef RF_SUB_1_GHZ_CONF_FRONT_END_MODE
#define RF_SUB_1_GHZ_FRONT_END_MODE RF_SUB_1_GHZ_CONF_FRONT_END_MODE
#else
#define RF_SUB_1_GHZ_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#endif
#ifdef RF_SUB_1_GHZ_CONF_BIAS_MODE
#define RF_SUB_1_GHZ_BIAS_MODE RF_SUB_1_GHZ_CONF_BIAS_MODE
#else
#define RF_SUB_1_GHZ_BIAS_MODE RF_BIAS_MODE_INTERNAL
#endif
/* 2.4 GHz path front-end mode configuration */
#ifdef RF_2_4_GHZ_CONF_FRONT_END_MODE
#define RF_2_4_GHZ_FRONT_END_MODE RF_2_4_GHZ_CONF_FRONT_END_MODE
#else
#define RF_2_4_GHZ_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#endif
#ifdef RF_2_4_GHZ_CONF_BIAS_MODE
#define RF_2_4_GHZ_BIAS_MODE RF_2_4_GHZ_CONF_BIAS_MODE
#else
#define RF_2_4_GHZ_BIAS_MODE RF_BIAS_MODE_INTERNAL
#endif
/* Number of RX buffers. */
#ifndef RF_CONF_RX_BUF_CNT
#define RF_CONF_RX_BUF_CNT 4

View File

@ -96,7 +96,7 @@ to_hal_cfg(PIN_Config pin_cfg, gpio_hal_pin_cfg_t *cfg)
/* Input config */
if(pin_cfg & PIN_BM_INPUT_MODE) {
/* Hysteresis config */
if((pin_cfg & PIN_BM_HYSTERESIS) == PIN_HYSTERESIS) {
if((pin_cfg & PIN_BM_HYSTERESIS) == PIN_BM_HYSTERESIS) {
*cfg |= GPIO_HAL_PIN_CFG_HYSTERESIS;
}

View File

@ -56,12 +56,18 @@
/* TI-RTOS RF Mode Object */
RF_Mode rf_ble_mode =
{
.rfMode = RF_MODE_BLE,
.rfMode = RF_MODE_MULTIPLE,
.cpePatchFxn = &rf_patch_cpe_ble,
.mcePatchFxn = 0,
.rfePatchFxn = &rf_patch_rfe_ble,
};
/*---------------------------------------------------------------------------*/
/*
* CMD_RADIO_SETUP must be configured with default TX power value
* in the .txPower field.
*/
#define DEFAULT_TX_POWER 0x5F3C /* 5 dBm */
/*---------------------------------------------------------------------------*/
/* Overrides for CMD_RADIO_SETUP */
uint32_t rf_ble_overrides[] CC_ALIGN(4) =
{
@ -109,46 +115,14 @@ rfc_CMD_RADIO_SETUP_t rf_ble_cmd_radio_setup =
.condition.nSkip = 0x0,
.mode = 0x00,
.loDivider = 0x00,
.config.frontEndMode = 0x0,
.config.biasMode = 0x0,
.config.frontEndMode = 0x0, /* set by driver */
.config.biasMode = 0x0, /* set by driver */
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = 0x3D3F,
.txPower = DEFAULT_TX_POWER,
.pRegOverride = rf_ble_overrides,
};
/*---------------------------------------------------------------------------*/
/* Structure for CMD_BLE_ADV_NC.pParams */
rfc_bleAdvPar_t rf_ble_adv_par =
{
.pRxQ = 0,
.rxConfig.bAutoFlushIgnored = 0x0,
.rxConfig.bAutoFlushCrcErr = 0x0,
.rxConfig.bAutoFlushEmpty = 0x0,
.rxConfig.bIncludeLenByte = 0x0,
.rxConfig.bIncludeCrc = 0x0,
.rxConfig.bAppendRssi = 0x0,
.rxConfig.bAppendStatus = 0x0,
.rxConfig.bAppendTimestamp = 0x0,
.advConfig.advFilterPolicy = 0x0,
.advConfig.deviceAddrType = 0x0,
.advConfig.peerAddrType = 0x0,
.advConfig.bStrictLenFilter = 0x0,
.advConfig.rpaMode = 0x0,
.advLen = 0x18,
.scanRspLen = 0x00,
.pAdvData = 0,
.pScanRspData = 0,
.pDeviceAddress = 0,
.pWhiteList = 0,
.__dummy0 = 0x0000,
.__dummy1 = 0x00,
.endTrigger.triggerType = TRIG_NEVER,
.endTrigger.bEnaCmd = 0x0,
.endTrigger.triggerNo = 0x0,
.endTrigger.pastTrig = 0x0,
.endTime = 0x00000000,
};
/*---------------------------------------------------------------------------*/
/* CMD_BLE_ADV_NC: BLE Non-Connectable Advertiser Command */
rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc =
{
@ -159,13 +133,13 @@ rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc =
.startTrigger.triggerType = TRIG_NOW,
.startTrigger.bEnaCmd = 0x0,
.startTrigger.triggerNo = 0x0,
.startTrigger.pastTrig = 0x0,
.condition.rule = COND_NEVER,
.startTrigger.pastTrig = 0x1,
.condition.rule = 0x0, /* set by driver */
.condition.nSkip = 0x0,
.channel = 0x8C,
.whitening.init = 0x51,
.channel = 0x00, /* set by driver */
.whitening.init = 0x00, /* set by driver */
.whitening.bOverride = 0x1,
.pParams = &rf_ble_adv_par,
.pOutput = 0,
.pParams = 0x00000000, /* set by driver */
.pOutput = 0x00000000, /* set by driver */
};
/*---------------------------------------------------------------------------*/

View File

@ -43,7 +43,6 @@ extern RF_Mode rf_ble_mode;
/*---------------------------------------------------------------------------*/
/* RF Core API commands */
extern rfc_CMD_RADIO_SETUP_t rf_ble_cmd_radio_setup;
extern rfc_bleAdvPar_t rf_ble_adv_par;
extern rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc;
/*---------------------------------------------------------------------------*/
/* RF Core API Overrides */

View File

@ -57,7 +57,7 @@
/* TI-RTOS RF Mode Object */
RF_Mode rf_ieee_mode =
{
.rfMode = RF_MODE_IEEE_15_4,
.rfMode = RF_MODE_MULTIPLE,
.cpePatchFxn = 0,
.mcePatchFxn = 0,
.rfePatchFxn = 0,
@ -110,8 +110,8 @@ rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup =
.condition.rule = COND_NEVER,
.condition.nSkip = 0x0,
.mode = 0x01,
.config.frontEndMode = 0x0,
.config.biasMode = 0x0,
.config.frontEndMode = 0x0, /* set by driver */
.config.biasMode = 0x0, /* set by driver */
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = DEFAULT_TX_POWER, /* 5 dBm default */

View File

@ -68,7 +68,7 @@
/* TI-RTOS RF Mode Object */
RF_Mode rf_prop_mode =
{
.rfMode = RF_MODE_PROPRIETARY_SUB_1,
.rfMode = RF_MODE_MULTIPLE,
.cpePatchFxn = &rf_patch_cpe_genfsk,
.mcePatchFxn = 0,
.rfePatchFxn = &rf_patch_rfe_genfsk,

View File

@ -47,7 +47,7 @@
#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_bt5.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_bt5.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_bt5.h)
@ -59,11 +59,17 @@
RF_Mode rf_ble_mode =
{
.rfMode = RF_MODE_AUTO,
.cpePatchFxn = &rf_patch_cpe_bt5,
.cpePatchFxn = &rf_patch_cpe_multi_protocol,
.mcePatchFxn = &rf_patch_mce_bt5,
.rfePatchFxn = &rf_patch_rfe_bt5,
};
/*---------------------------------------------------------------------------*/
/*
* CMD_RADIO_SETUP must be configured with default TX power value
* in the .txPower field.
*/
#define DEFAULT_TX_POWER 0x941E /* 5 dBm */
/*---------------------------------------------------------------------------*/
/* Overrides for CMD_BLE5_RADIO_SETUP */
uint32_t rf_ble_overrides_common[] CC_ALIGN(4) =
{
@ -137,71 +143,39 @@ rfc_CMD_BLE5_RADIO_SETUP_t rf_ble_cmd_radio_setup =
.defaultPhy.mainMode = 0x0,
.defaultPhy.coding = 0x0,
.loDivider = 0x00,
.config.frontEndMode = 0x0,
.config.biasMode = 0x0,
.config.frontEndMode = 0x0, /* set by driver */
.config.biasMode = 0x0, /* set by driver */
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = 0x941E,
.txPower = DEFAULT_TX_POWER,
.pRegOverrideCommon = rf_ble_overrides_common,
.pRegOverride1Mbps = rf_ble_overrides_1mbps,
.pRegOverride2Mbps = rf_ble_overrides_2mbps,
.pRegOverrideCoded = rf_ble_overrides_coded,
};
/*---------------------------------------------------------------------------*/
/* Structure for CMD_BLE5_ADV_NC.pParams */
rfc_bleAdvPar_t rf_ble_adv_par =
{
.pRxQ = 0,
.rxConfig.bAutoFlushIgnored = 0x0,
.rxConfig.bAutoFlushCrcErr = 0x0,
.rxConfig.bAutoFlushEmpty = 0x0,
.rxConfig.bIncludeLenByte = 0x0,
.rxConfig.bIncludeCrc = 0x0,
.rxConfig.bAppendRssi = 0x0,
.rxConfig.bAppendStatus = 0x0,
.rxConfig.bAppendTimestamp = 0x0,
.advConfig.advFilterPolicy = 0x0,
.advConfig.deviceAddrType = 0x0,
.advConfig.peerAddrType = 0x0,
.advConfig.bStrictLenFilter = 0x0,
.advConfig.rpaMode = 0x0,
.advLen = 0x18,
.scanRspLen = 0x00,
.pAdvData = 0,
.pScanRspData = 0,
.pDeviceAddress = 0,
.pWhiteList = 0,
.__dummy0 = 0x0000,
.__dummy1 = 0x00,
.endTrigger.triggerType = TRIG_NEVER,
.endTrigger.bEnaCmd = 0x0,
.endTrigger.triggerNo = 0x0,
.endTrigger.pastTrig = 0x0,
.endTime = 0x00000000,
};
/*---------------------------------------------------------------------------*/
/* CMD_BLE5_ADV_NC: Bluetooth 5 Non-Connectable Advertiser Command */
rfc_CMD_BLE5_ADV_NC_t rf_ble_cmd_ble_adv_nc =
{
.commandNo = 0x182D,
.status = 0x0000,
.pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
.commandNo = CMD_BLE5_ADV_NC,
.status = IDLE,
.pNextOp = 0,
.startTime = 0x00000000,
.startTrigger.triggerType = 0x0,
.startTrigger.triggerType = TRIG_NOW,
.startTrigger.bEnaCmd = 0x0,
.startTrigger.triggerNo = 0x0,
.startTrigger.pastTrig = 0x0,
.condition.rule = 0x1,
.startTrigger.pastTrig = 0x1,
.condition.rule = 0x0, /* set by driver */
.condition.nSkip = 0x0,
.channel = 0x8C,
.whitening.init = 0x51,
.channel = 0x00, /* set by driver */
.whitening.init = 0x00, /* set by driver */
.whitening.bOverride = 0x1,
.phyMode.mainMode = 0x0,
.phyMode.coding = 0x0,
.rangeDelay = 0x00,
.txPower = 0x0000,
.pParams = &rf_ble_adv_par,
.pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
.pParams = 0x00000000, /* set by driver */
.pOutput = 0x00000000, /* set by driver */
.tx20Power = 0x00000000,
};
/*---------------------------------------------------------------------------*/

View File

@ -43,7 +43,6 @@ extern RF_Mode rf_ble_mode;
/*---------------------------------------------------------------------------*/
/* RF Core API commands */
extern rfc_CMD_BLE5_RADIO_SETUP_t rf_ble_cmd_radio_setup;
extern rfc_bleAdvPar_t rf_ble_adv_par;
extern rfc_CMD_BLE5_ADV_NC_t rf_ble_cmd_ble_adv_nc;
/*---------------------------------------------------------------------------*/
/* RF Core API Overrides */

View File

@ -51,7 +51,7 @@
#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_ieee_802_15_4.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_ieee_802_15_4.h)
#include <ti/drivers/rf/RF.h>
@ -62,7 +62,7 @@
RF_Mode rf_ieee_mode =
{
.rfMode = RF_MODE_AUTO,
.cpePatchFxn = &rf_patch_cpe_ieee_802_15_4,
.cpePatchFxn = &rf_patch_cpe_multi_protocol,
.mcePatchFxn = &rf_patch_mce_ieee_802_15_4,
.rfePatchFxn = 0,
};
@ -180,8 +180,8 @@ rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup =
.condition.nSkip = 0x0,
.mode = 0x01,
.loDivider = 0x00,
.config.frontEndMode = 0x0,
.config.biasMode = 0x0,
.config.frontEndMode = 0x0, /* set by driver */
.config.biasMode = 0x0, /* set by driver */
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = DEFAULT_TX_POWER, /* 5 dBm default */

View File

@ -63,7 +63,7 @@
#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_prop.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_genfsk.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_genfsk.h)
@ -75,7 +75,7 @@
RF_Mode rf_prop_mode =
{
.rfMode = RF_MODE_AUTO,
.cpePatchFxn = &rf_patch_cpe_prop,
.cpePatchFxn = &rf_patch_cpe_multi_protocol,
.mcePatchFxn = &rf_patch_mce_genfsk,
.rfePatchFxn = &rf_patch_rfe_genfsk,
};

View File

@ -55,12 +55,18 @@
/* TI-RTOS RF Mode Object */
RF_Mode rf_ble_mode =
{
.rfMode = RF_MODE_BLE,
.rfMode = RF_MODE_MULTIPLE,
.cpePatchFxn = &rf_patch_cpe_ble,
.mcePatchFxn = 0,
.rfePatchFxn = &rf_patch_rfe_ble,
};
/*---------------------------------------------------------------------------*/
/*
* CMD_RADIO_SETUP must be configured with default TX power value
* in the .txPower field.
*/
#define DEFAULT_TX_POWER 0x9330 /* 5 dBm */
/*---------------------------------------------------------------------------*/
/* Overrides for CMD_RADIO_SETUP */
uint32_t rf_ble_overrides[] CC_ALIGN(4) =
{
@ -105,46 +111,14 @@ rfc_CMD_RADIO_SETUP_t rf_ble_cmd_radio_setup =
.condition.nSkip = 0x0,
.mode = 0x00,
.__dummy0 = 0x00,
.config.frontEndMode = 0x0,
.config.biasMode = 0x0,
.config.frontEndMode = 0x0, /* set by driver */
.config.biasMode = 0x0, /* set by driver */
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = 0x9330,
.txPower = DEFAULT_TX_POWER,
.pRegOverride = rf_ble_overrides,
};
/*---------------------------------------------------------------------------*/
/* Structure for CMD_BLE_ADV_NC.pParams */
rfc_bleAdvPar_t rf_ble_adv_par =
{
.pRxQ = 0,
.rxConfig.bAutoFlushIgnored = 0x0,
.rxConfig.bAutoFlushCrcErr = 0x0,
.rxConfig.bAutoFlushEmpty = 0x0,
.rxConfig.bIncludeLenByte = 0x0,
.rxConfig.bIncludeCrc = 0x0,
.rxConfig.bAppendRssi = 0x0,
.rxConfig.bAppendStatus = 0x0,
.rxConfig.bAppendTimestamp = 0x0,
.advConfig.advFilterPolicy = 0x0,
.advConfig.deviceAddrType = 0x0,
.advConfig.peerAddrType = 0x0,
.advConfig.bStrictLenFilter = 0x0,
.advConfig.rpaMode = 0x0,
.advLen = 0x18,
.scanRspLen = 0x00,
.pAdvData = 0,
.pScanRspData = 0,
.pDeviceAddress = 0,
.pWhiteList = 0,
.__dummy0 = 0x0000,
.__dummy1 = 0x00,
.endTrigger.triggerType = TRIG_NEVER,
.endTrigger.bEnaCmd = 0x0,
.endTrigger.triggerNo = 0x0,
.endTrigger.pastTrig = 0x0,
.endTime = 0x00000000,
};
/*---------------------------------------------------------------------------*/
/* CMD_BLE_ADV_NC: BLE Non-Connectable Advertiser Command */
rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc =
{
@ -155,13 +129,13 @@ rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc =
.startTrigger.triggerType = TRIG_NOW,
.startTrigger.bEnaCmd = 0x0,
.startTrigger.triggerNo = 0x0,
.startTrigger.pastTrig = 0x0,
.condition.rule = COND_NEVER,
.startTrigger.pastTrig = 0x1,
.condition.rule = 0x0, /* set by driver */
.condition.nSkip = 0x0,
.channel = 0x8C,
.whitening.init = 0x51,
.channel = 0x00, /* set by driver */
.whitening.init = 0x00, /* set by driver */
.whitening.bOverride = 0x1,
.pParams = &rf_ble_adv_par,
.pOutput = 0,
.pParams = 0x00000000, /* set by driver */
.pOutput = 0x00000000, /* set by driver */
};
/*---------------------------------------------------------------------------*/

View File

@ -43,7 +43,6 @@ extern RF_Mode rf_ble_mode;
/*---------------------------------------------------------------------------*/
/* RF Core API commands */
extern rfc_CMD_RADIO_SETUP_t rf_ble_cmd_radio_setup;
extern rfc_bleAdvPar_t rf_ble_adv_par;
extern rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc;
/*---------------------------------------------------------------------------*/
/* RF Core API Overrides */

View File

@ -53,7 +53,7 @@
/* TI-RTOS RF Mode Object */
RF_Mode rf_ieee_mode =
{
.rfMode = RF_MODE_IEEE_15_4,
.rfMode = RF_MODE_MULTIPLE,
.cpePatchFxn = &rf_patch_cpe_ieee,
.mcePatchFxn = 0,
.rfePatchFxn = 0,
@ -107,8 +107,8 @@ rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup =
.condition.nSkip = 0x0,
.mode = 0x01,
.__dummy0 = 0x00,
.config.frontEndMode = 0x0,
.config.biasMode = 0x0,
.config.frontEndMode = 0x0, /* set by driver */
.config.biasMode = 0x0, /* set by driver */
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = DEFAULT_TX_POWER, /* 5 dBm default */

View File

@ -46,7 +46,7 @@
#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_bt5.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_bt5.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_bt5.h)
@ -58,11 +58,17 @@
RF_Mode rf_ble_mode =
{
.rfMode = RF_MODE_AUTO,
.cpePatchFxn = &rf_patch_cpe_bt5,
.cpePatchFxn = &rf_patch_cpe_multi_protocol,
.mcePatchFxn = &rf_patch_mce_bt5,
.rfePatchFxn = &rf_patch_rfe_bt5,
};
/*---------------------------------------------------------------------------*/
/*
* CMD_RADIO_SETUP must be configured with default TX power value
* in the .txPower field.
*/
#define DEFAULT_TX_POWER 0x941E /* 5 dBm */
/*---------------------------------------------------------------------------*/
/* Overrides for CMD_BLE5_RADIO_SETUP */
uint32_t rf_ble_overrides_common[] CC_ALIGN(4) =
{
@ -137,71 +143,39 @@ rfc_CMD_BLE5_RADIO_SETUP_t rf_ble_cmd_radio_setup =
.defaultPhy.mainMode = 0x0,
.defaultPhy.coding = 0x0,
.loDivider = 0x00,
.config.frontEndMode = 0x0,
.config.biasMode = 0x0,
.config.frontEndMode = 0x0, /* set by driver */
.config.biasMode = 0x0, /* set by driver */
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = 0x941E,
.txPower = DEFAULT_TX_POWER,
.pRegOverrideCommon = rf_ble_overrides_common,
.pRegOverride1Mbps = rf_ble_overrides_1mbps,
.pRegOverride2Mbps = rf_ble_overrides_2mbps,
.pRegOverrideCoded = rf_ble_overrides_coded,
};
/*---------------------------------------------------------------------------*/
/* Structure for CMD_BLE5_ADV_NC.pParams */
rfc_bleAdvPar_t rf_ble_adv_par =
{
.pRxQ = 0,
.rxConfig.bAutoFlushIgnored = 0x0,
.rxConfig.bAutoFlushCrcErr = 0x0,
.rxConfig.bAutoFlushEmpty = 0x0,
.rxConfig.bIncludeLenByte = 0x0,
.rxConfig.bIncludeCrc = 0x0,
.rxConfig.bAppendRssi = 0x0,
.rxConfig.bAppendStatus = 0x0,
.rxConfig.bAppendTimestamp = 0x0,
.advConfig.advFilterPolicy = 0x0,
.advConfig.deviceAddrType = 0x0,
.advConfig.peerAddrType = 0x0,
.advConfig.bStrictLenFilter = 0x0,
.advConfig.rpaMode = 0x0,
.advLen = 0x18,
.scanRspLen = 0x00,
.pAdvData = 0,
.pScanRspData = 0,
.pDeviceAddress = 0,
.pWhiteList = 0,
.__dummy0 = 0x0000,
.__dummy1 = 0x00,
.endTrigger.triggerType = TRIG_NEVER,
.endTrigger.bEnaCmd = 0x0,
.endTrigger.triggerNo = 0x0,
.endTrigger.pastTrig = 0x0,
.endTime = 0x00000000,
};
/*---------------------------------------------------------------------------*/
/* CMD_BLE5_ADV_NC: Bluetooth 5 Non-Connectable Advertiser Command */
rfc_CMD_BLE5_ADV_NC_t rf_ble_cmd_ble_adv_nc =
{
.commandNo = 0x182D,
.status = 0x0000,
.pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
.commandNo = CMD_BLE5_ADV_NC,
.status = IDLE,
.pNextOp = 0,
.startTime = 0x00000000,
.startTrigger.triggerType = 0x0,
.startTrigger.triggerType = TRIG_NOW,
.startTrigger.bEnaCmd = 0x0,
.startTrigger.triggerNo = 0x0,
.startTrigger.pastTrig = 0x0,
.condition.rule = 0x1,
.startTrigger.pastTrig = 0x1,
.condition.rule = 0x0, /* set by driver */
.condition.nSkip = 0x0,
.channel = 0x8C,
.whitening.init = 0x51,
.channel = 0x00, /* set by driver */
.whitening.init = 0x00, /* set by driver */
.whitening.bOverride = 0x1,
.phyMode.mainMode = 0x0,
.phyMode.coding = 0x0,
.rangeDelay = 0x00,
.txPower = 0x0000,
.pParams = &rf_ble_adv_par,
.pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
.pParams = 0x00000000, /* set by driver */
.pOutput = 0x00000000, /* set by driver */
.tx20Power = 0x00000000,
};
/*---------------------------------------------------------------------------*/

View File

@ -43,7 +43,6 @@ extern RF_Mode rf_ble_mode;
/*---------------------------------------------------------------------------*/
/* RF Core API commands */
extern rfc_CMD_BLE5_RADIO_SETUP_t rf_ble_cmd_radio_setup;
extern rfc_bleAdvPar_t rf_ble_adv_par;
extern rfc_CMD_BLE5_ADV_NC_t rf_ble_cmd_ble_adv_nc;
/*---------------------------------------------------------------------------*/
/* RF Core API Overrides */

View File

@ -44,7 +44,7 @@
#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_ieee_802_15_4.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h)
#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_ieee_802_15_4.h)
#include <ti/drivers/rf/RF.h>
@ -55,7 +55,7 @@
RF_Mode rf_ieee_mode =
{
.rfMode = RF_MODE_AUTO,
.cpePatchFxn = &rf_patch_cpe_ieee_802_15_4,
.cpePatchFxn = &rf_patch_cpe_multi_protocol,
.mcePatchFxn = &rf_patch_mce_ieee_802_15_4,
.rfePatchFxn = 0,
};
@ -104,8 +104,8 @@ rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup =
.condition.nSkip = 0x0,
.mode = 0x01,
.loDivider = 0x00,
.config.frontEndMode = 0x0,
.config.biasMode = 0x0,
.config.frontEndMode = 0x0, /* set by driver */
.config.biasMode = 0x0, /* set by driver */
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = DEFAULT_TX_POWER,

View File

@ -81,7 +81,7 @@ ble_addr_ptr(void)
}
/*---------------------------------------------------------------------------*/
int
ble_addr_cpy(uint8_t *dst)
ble_addr_be_cpy(uint8_t *dst)
{
if(!dst) {
return -1;
@ -102,6 +102,23 @@ ble_addr_cpy(uint8_t *dst)
}
/*---------------------------------------------------------------------------*/
int
ble_addr_le_cpy(uint8_t *dst)
{
if(!dst) {
return -1;
}
volatile const uint8_t *const ble_addr = ble_addr_ptr();
size_t i;
for(i = 0; i < BLE_ADDR_SIZE; i++) {
dst[i] = ble_addr[i];
}
return 0;
}
/*---------------------------------------------------------------------------*/
int
ble_addr_to_eui64(uint8_t *dst, uint8_t *src)
{
if(!dst || !src) {
@ -126,7 +143,7 @@ ble_addr_to_eui64_cpy(uint8_t *dst)
int res;
uint8_t ble_addr[BLE_ADDR_SIZE];
res = ble_addr_cpy(ble_addr);
res = ble_addr_le_cpy(ble_addr);
if(res) {
return -1;
}

View File

@ -59,6 +59,7 @@ uint8_t *ble_addr_ptr(void);
/*---------------------------------------------------------------------------*/
/**
* \brief Copy the node's factory BLE address to a destination memory area
* in big-endian (be) order.
* \param dst A pointer to the destination area where the BLE address is to be
* written
* \return 0 : Returned successfully
@ -68,7 +69,21 @@ uint8_t *ble_addr_ptr(void);
* the process. The factory address on devices is normally little-endian,
* therefore you should expect dst to store the address in a big-endian order.
*/
int ble_addr_cpy(uint8_t *dst);
int ble_addr_be_cpy(uint8_t *dst);
/*---------------------------------------------------------------------------*/
/**
* \brief Copy the node's factory BLE address to a destination memory area
* in little-endian (le) order.
* \param dst A pointer to the destination area where the BLE address is to be
* written
* \return 0 : Returned successfully
* -1 : Returned with error
*
* This function will copy 6 bytes, but will **not** invert the byte order.
* This is usefull for the RF core which assumes the BLE MAC address in
* little-endian order.
*/
int ble_addr_le_cpy(uint8_t *dst);
/*---------------------------------------------------------------------------*/
/**
* \brief Copy the node's BLE address to a destination memory area and converts

View File

@ -52,6 +52,7 @@
#include <ti/drivers/rf/RF.h>
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
#include "rf/sched.h"
#include "rf/ble-addr.h"
#include "rf/ble-beacond.h"
@ -70,32 +71,58 @@
/*---------------------------------------------------------------------------*/
#if RF_CONF_BLE_BEACON_ENABLE
/*---------------------------------------------------------------------------*/
/* BLE Advertisement channels. Not to be changed by the user. */
typedef enum {
BLE_ADV_CHANNEL_37 = (1 << 0),
BLE_ADV_CHANNEL_38 = (1 << 1),
BLE_ADV_CHANNEL_39 = (1 << 2),
BLE_ADV_CHANNEL_ALL = (BLE_ADV_CHANNEL_37 |
BLE_ADV_CHANNEL_38 |
BLE_ADV_CHANNEL_39),
} ble_adv_channel_t;
#define BLE_ADV_CHANNEL_MIN 37
#define BLE_ADV_CHANNEL_MAX 39
/*---------------------------------------------------------------------------*/
/* Maximum BLE advertisement size. Not to be changed by the user. */
#define BLE_ADV_MAX_SIZE 31
/*---------------------------------------------------------------------------*/
/* BLE Intervals: Send a burst of advertisements every BLE_ADV_INTERVAL secs */
#define BLE_ADV_INTERVAL (CLOCK_SECOND * 5)
#define BLE_ADV_DUTY_CYCLE (CLOCK_SECOND / 10)
#define BLE_ADV_MESSAGES 10
/*
* BLE Intervals: Send a burst of advertisements every BLE_ADV_INTERVAL
* specified in milliseconds.
*/
#define BLE_ADV_INTERVAL ((100 * CLOCK_SECOND) / 1000)
/* GAP Advertisement data types */
#define BLE_ADV_TYPE_FLAGS 0x01
#define BLE_ADV_TYPE_16BIT_MORE 0x02
#define BLE_ADV_TYPE_16BIT_COMPLETE 0x03
#define BLE_ADV_TYPE_32BIT_MORE 0x04
#define BLE_ADV_TYPE_32BIT_COMPLETE 0x05
#define BLE_ADV_TYPE_128BIT_MORE 0x06
#define BLE_ADV_TYPE_128BIT_COMPLETE 0x07
#define BLE_ADV_TYPE_LOCAL_NAME_SHORT 0x08
#define BLE_ADV_TYPE_LOCAL_NAME_COMPLETE 0x09
#define BLE_ADV_TYPE_POWER_LEVEL 0x0A
#define BLE_ADV_TYPE_OOB_CLASS_OF_DEVICE 0x0D
#define BLE_ADV_TYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
#define BLE_ADV_TYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
#define BLE_ADV_TYPE_SM_TK 0x10
#define BLE_ADV_TYPE_SM_OOB_FLAG 0x11
#define BLE_ADV_TYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
#define BLE_ADV_TYPE_SIGNED_DATA 0x13
#define BLE_ADV_TYPE_SERVICE_LIST_16BIT 0x14
#define BLE_ADV_TYPE_SERVICE_LIST_128BIT 0x15
#define BLE_ADV_TYPE_SERVICE_DATA 0x16
#define BLE_ADV_TYPE_PUBLIC_TARGET_ADDR 0x17
#define BLE_ADV_TYPE_RANDOM_TARGET_ADDR 0x18
#define BLE_ADV_TYPE_APPEARANCE 0x19
#define BLE_ADV_TYPE_ADV_INTERVAL 0x1A
#define BLE_ADV_TYPE_LE_BD_ADDR 0x1B
#define BLE_ADV_TYPE_LE_ROLE 0x1C
#define BLE_ADV_TYPE_SIMPLE_PAIRING_HASHC_256 0x1D
#define BLE_ADV_TYPE_SIMPLE_PAIRING_RANDR_256 0x1E
#define BLE_ADV_TYPE_SERVICE_DATA_32BIT 0x20
#define BLE_ADV_TYPE_SERVICE_DATA_128BIT 0x21
#define BLE_ADV_TYPE_3D_INFO_DATA 0x3D
#define BLE_ADV_TYPE_MANUFACTURER_SPECIFIC 0xFF
/* GAP Advertisement data type flags */
/* Discovery Mode: LE Limited Discoverable Mode */
#define BLE_ADV_TYPE_FLAGS_LIMITED 0x01
/* Discovery Mode: LE General Discoverable Mode */
#define BLE_ADV_TYPE_FLAGS_GENERAL 0x02
/* Discovery Mode: BR/EDR Not Supported */
#define BLE_ADV_TYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
/* BLE Advertisement-related macros */
#define BLE_ADV_TYPE_DEVINFO 0x01
#define BLE_ADV_TYPE_NAME 0x09
#define BLE_ADV_TYPE_MANUFACTURER 0xFF
#define BLE_ADV_NAME_BUF_LEN BLE_ADV_MAX_SIZE
#define BLE_ADV_PAYLOAD_BUF_LEN 64
#define BLE_UUID_SIZE 16
@ -117,6 +144,11 @@ typedef struct {
/* RF driver */
RF_Handle rf_handle;
/* BLE command specific structures. Common accross BLE and BLE5. */
uint8_t ble_mac_addr[6];
rfc_bleAdvPar_t ble_adv_par;
rfc_bleAdvOutput_t ble_adv_output;
} ble_beacond_t;
static ble_beacond_t ble_beacond;
@ -126,13 +158,13 @@ PROCESS(ble_beacond_process, "RF BLE Beacon Daemon Process");
rf_ble_beacond_result_t
rf_ble_beacond_init(void)
{
ble_adv_par.pDeviceAddress = (uint16_t *)ble_addr_ptr();
ble_cmd_radio_setup.config.frontEndMode = RF_2_4_GHZ_FRONT_END_MODE;
ble_cmd_radio_setup.config.biasMode = RF_2_4_GHZ_BIAS_MODE;
RF_Params rf_params;
RF_Params_init(&rf_params);
/* Should immediately turn off radio if possible */
rf_params.nInactivityTimeout = 0;
rf_params.nInactivityTimeout = RF_CONF_INACTIVITY_TIMEOUT;
ble_beacond.rf_handle = ble_open(&rf_params);
@ -140,6 +172,18 @@ rf_ble_beacond_init(void)
return RF_BLE_BEACOND_ERROR;
}
/*
* It is important that the contents of the BLE MAC address is copied into
* RAM, as the System CPU, and subsequently flash, goes idle when pending
* on an RF command. This causes pend to hang forever.
*/
ble_addr_le_cpy(ble_beacond.ble_mac_addr);
ble_beacond.ble_adv_par.pDeviceAddress = (uint16_t *)ble_beacond.ble_mac_addr;
ble_beacond.ble_adv_par.endTrigger.triggerType = TRIG_NEVER;
rf_ble_cmd_ble_adv_nc.pParams = &ble_beacond.ble_adv_par;
rf_ble_cmd_ble_adv_nc.pOutput = &ble_beacond.ble_adv_output;
return RF_BLE_BEACOND_OK;
}
/*---------------------------------------------------------------------------*/
@ -154,12 +198,14 @@ rf_ble_beacond_config(clock_time_t interval, const char *name)
ble_beacond.ble_adv_interval = interval;
res = RF_BLE_BEACOND_OK;
} else {
ble_beacond.ble_adv_interval = BLE_ADV_INTERVAL;
}
if(name != NULL) {
const size_t name_len = strlen(name);
if((name_len == 0) || (name_len >= BLE_ADV_NAME_BUF_LEN)) {
if((0 < name_len) && (name_len < BLE_ADV_NAME_BUF_LEN)) {
ble_beacond.adv_name_len = name_len;
memcpy(ble_beacond.adv_name, name, name_len);
@ -235,37 +281,9 @@ rf_ble_get_tx_power(void)
return dbm;
}
/*---------------------------------------------------------------------------*/
static rf_ble_beacond_result_t
ble_beacon_burst(uint8_t channels_bm, uint8_t *data, uint8_t len)
{
rf_result_t res;
uint8_t channel;
for(channel = BLE_ADV_CHANNEL_MIN; channel <= BLE_ADV_CHANNEL_MAX; ++channel) {
const uint8_t channel_bv = (1 << (channel - BLE_ADV_CHANNEL_MIN));
if((channel_bv & channels_bm) == 0) {
continue;
}
ble_adv_par.advLen = len;
ble_adv_par.pAdvData = data;
ble_cmd_beacon.channel = channel;
res = ble_sched_beacon(NULL, 0);
if(res != RF_RESULT_OK) {
return RF_BLE_BEACOND_ERROR;
}
}
return RF_BLE_BEACOND_OK;
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(ble_beacond_process, ev, data)
{
static size_t i;
static size_t len;
size_t len;
PROCESS_BEGIN();
@ -278,30 +296,33 @@ PROCESS_THREAD(ble_beacond_process, ev, data)
PROCESS_EXIT();
}
/* Device info */
/* Set the adv payload each pass: The device name may have changed */
len = 0;
/* Device info */
ble_beacond.tx_buf[len++] = (uint8_t)0x02; /* 2 bytes */
ble_beacond.tx_buf[len++] = (uint8_t)BLE_ADV_TYPE_DEVINFO;
ble_beacond.tx_buf[len++] = (uint8_t)0x1A; /* LE general discoverable + BR/EDR */
ble_beacond.tx_buf[len++] = (uint8_t)ble_beacond.adv_name_len;
ble_beacond.tx_buf[len++] = (uint8_t)BLE_ADV_TYPE_NAME;
#define append_byte(x) ble_beacond.tx_buf[len++] = (uint8_t)((x))
/* 2 bytes */
append_byte(2);
append_byte(BLE_ADV_TYPE_FLAGS);
/* LE general discoverable + BR/EDR not supported */
append_byte(BLE_ADV_TYPE_FLAGS_GENERAL |
BLE_ADV_TYPE_FLAGS_BREDR_NOT_SUPPORTED);
/* 1 + len(name) bytes (excluding zero termination) */
append_byte(1 + ble_beacond.adv_name_len);
append_byte(BLE_ADV_TYPE_LOCAL_NAME_COMPLETE);
memcpy(ble_beacond.tx_buf + len, ble_beacond.adv_name, ble_beacond.adv_name_len);
len += ble_beacond.adv_name_len;
/*
* Send BLE_ADV_MESSAGES beacon bursts. Each burst on all three
* channels, with a BLE_ADV_DUTY_CYCLE interval between bursts
*/
ble_beacon_burst(BLE_ADV_CHANNEL_ALL, ble_beacond.tx_buf, len);
for(i = 1; i < BLE_ADV_MESSAGES; ++i) {
etimer_set(&ble_beacond.ble_adv_et, BLE_ADV_DUTY_CYCLE);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&ble_beacond.ble_adv_et));
#undef append_byte
ble_beacon_burst(BLE_ADV_CHANNEL_ALL, ble_beacond.tx_buf, len);
}
/* Send advertisements on all three channels */
ble_beacond.ble_adv_par.advLen = len;
ble_beacond.ble_adv_par.pAdvData = ble_beacond.tx_buf;
ble_sched_beacons(BLE_ADV_CHANNEL_ALL);
}
PROCESS_END();
}

View File

@ -217,6 +217,9 @@ rat_overflow_cb(void *arg)
static void
init_rf_params(void)
{
cmd_radio_setup.config.frontEndMode = RF_2_4_GHZ_FRONT_END_MODE;
cmd_radio_setup.config.biasMode = RF_2_4_GHZ_BIAS_MODE;
data_queue_t *rx_q = data_queue_init(sizeof(lensz_t));
cmd_rx.pRxQ = rx_q;
@ -550,32 +553,42 @@ read(void *buf, unsigned short buf_len)
static rf_result_t
cca_request(cmd_cca_req_t *cmd_cca_req)
{
RF_Stat stat = RF_StatRadioInactiveError;
rf_result_t res;
bool stop_rx = false;
const bool rx_is_idle = !rx_is_active();
/* RX is required to be running in order to do a CCA request */
if(!rx_is_active()) {
/* If RX is not pending, i.e. soon to be running, schedule the RX command */
if(cmd_rx.status != PENDING) {
res = netstack_sched_rx(false);
if(res != RF_RESULT_OK) {
LOG_ERR("CCA request failed to schedule RX\n");
return res;
}
if(rx_is_idle) {
res = netstack_sched_rx(false);
if(res != RF_RESULT_OK) {
/* We only stop RX if we had to schedule it */
stop_rx = true;
}
/* Make sure RX is running before we continue, unless we timeout and fail */
RTIMER_BUSYWAIT_UNTIL(!rx_is_active(), TIMEOUT_ENTER_RX_WAIT);
if(!rx_is_active()) {
LOG_ERR("CCA request failed to turn on RX, RX status=0x%04X\n", cmd_rx.status);
return RF_RESULT_ERROR;
}
}
const rtimer_clock_t t0 = RTIMER_NOW();
while((cmd_rx.status != ACTIVE) &&
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_ENTER_RX_WAIT)) ;
/* Perform the CCA request */
stat = RF_runImmediateCmd(ieee_radio.rf_handle, (uint32_t *)&cmd_cca_req);
RF_Stat stat = RF_StatRadioInactiveError;
if(rx_is_active()) {
stat = RF_runImmediateCmd(ieee_radio.rf_handle, (uint32_t *)&cmd_cca_req);
}
if(rx_is_idle) {
if(stop_rx) {
netstack_stop_rx();
}
if(stat != RF_StatCmdDoneSuccess) {
LOG_ERR("CCA request failed, stat=0x%02X\n", stat);
LOG_ERR("CCA request command failed, stat=0x%02X\n", stat);
return RF_RESULT_ERROR;
}

View File

@ -61,6 +61,7 @@
#include <ti/drivers/rf/RF.h>
/*---------------------------------------------------------------------------*/
/* Platform RF dev */
#include "rf/rf.h"
#include "rf/dot-15-4g.h"
#include "rf/sched.h"
#include "rf/data-queue.h"
@ -193,6 +194,8 @@ static int off(void);
static void
init_rf_params(void)
{
cmd_radio_setup.config.frontEndMode = RF_SUB_1_GHZ_FRONT_END_MODE;
cmd_radio_setup.config.biasMode = RF_SUB_1_GHZ_BIAS_MODE;
cmd_radio_setup.centerFreq = PROP_MODE_CENTER_FREQ;
cmd_radio_setup.loDivider = PROP_MODE_LO_DIVIDER;
@ -207,26 +210,36 @@ static int8_t
get_rssi(void)
{
rf_result_t res;
bool stop_rx = false;
int8_t rssi = RF_GET_RSSI_ERROR_VAL;
const bool rx_is_idle = !rx_is_active();
/* RX is required to be running in order to do a RSSI measurement */
if(!rx_is_active()) {
/* If RX is not pending, i.e. soon to be running, schedule the RX command */
if(cmd_rx.status != PENDING) {
res = netstack_sched_rx(false);
if(res != RF_RESULT_OK) {
LOG_ERR("RSSI measurement failed to schedule RX\n");
return res;
}
if(rx_is_idle) {
res = netstack_sched_rx(false);
if(res != RF_RESULT_OK) {
return RF_GET_RSSI_ERROR_VAL;
/* We only stop RX if we had to schedule it */
stop_rx = true;
}
/* Make sure RX is running before we continue, unless we timeout and fail */
RTIMER_BUSYWAIT_UNTIL(!rx_is_active(), TIMEOUT_ENTER_RX_WAIT);
if(!rx_is_active()) {
LOG_ERR("RSSI measurement failed to turn on RX, RX status=0x%04X\n", cmd_rx.status);
return RF_RESULT_ERROR;
}
}
const rtimer_clock_t t0 = RTIMER_NOW();
while((cmd_rx.status != ACTIVE) &&
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_ENTER_RX_WAIT)) ;
/* Perform the RSSI measurement */
rssi = RF_getRssi(prop_radio.rf_handle);
int8_t rssi = RF_GET_RSSI_ERROR_VAL;
if(rx_is_active()) {
rssi = RF_getRssi(prop_radio.rf_handle);
}
if(rx_is_idle) {
if(stop_rx) {
netstack_stop_rx();
}

View File

@ -60,6 +60,37 @@
RF_MODE_2_4_GHZ)
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name The different front-end modes the CC13xx/CC26xx devices support. The
* front-end mode can be configured independently of the bias mode. The
* two types of modes are as follows:
* - Differential: Both RF_P and RF_N are used as a differential RF
* interface.
* - Single ended: Either the RF_P pin or the RF_N pin is used as the
* RF path.
*
* @{
*/
/* Available front-end mode configurations */
#define RF_FRONT_END_MODE_DIFFERENTIAL 0
#define RF_FRONT_END_MODE_SINGLE_ENDED_RFP 1
#define RF_FRONT_END_MODE_SINGLE_ENDED_RFN 2
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name The different bias modes the CC13xx/CC26xx devices support. The
* bias mode can be configured independently of the front-end mode. The
* two different modes are as follows:
* - Internal bias: the LNA is biased by an internal bias.
* - External bias: the LNA is biased by an external bias.
*
* @{
*/
/* Available bias mode configurations */
#define RF_BIAS_MODE_INTERNAL 0
#define RF_BIAS_MODE_EXTERNAL 1
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CORE_H_ */
/*---------------------------------------------------------------------------*/
/**

View File

@ -51,6 +51,7 @@
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
#include DeviceFamily_constructPath(driverlib/rf_ble_mailbox.h)
#include <ti/drivers/rf/RF.h>
/*---------------------------------------------------------------------------*/
@ -68,8 +69,6 @@
#define LOG_MODULE "Radio"
#define LOG_LEVEL LOG_LEVEL_NONE
/*---------------------------------------------------------------------------*/
/* Configuration parameters */
/*---------------------------------------------------------------------------*/
#define CMD_FS_RETRIES 3
#define RF_EVENTS_CMD_DONE (RF_EventCmdDone | RF_EventLastCmdDone | \
@ -82,6 +81,13 @@
#define EVENTS_CMD_DONE(events) (((events) & RF_EVENTS_CMD_DONE) != 0)
/*---------------------------------------------------------------------------*/
/* BLE advertisement channel range (inclusive) */
#define BLE_ADV_CHANNEL_MIN 37
#define BLE_ADV_CHANNEL_MAX 39
/* Number of BLE advertisement channels */
#define NUM_BLE_ADV_CHANNELS (BLE_ADV_CHANNEL_MAX - BLE_ADV_CHANNEL_MIN + 1)
/*---------------------------------------------------------------------------*/
/* Synth re-calibration every 3 minutes */
#define SYNTH_RECAL_INTERVAL (CLOCK_SECOND * 60 * 3)
/* Set re-calibration interval with a jitter of 10 seconds */
@ -89,6 +95,12 @@
static struct etimer synth_recal_timer;
/*---------------------------------------------------------------------------*/
#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
typedef rfc_CMD_BLE_ADV_NC_t ble_cmd_adv_nc_t;
#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
typedef rfc_CMD_BLE5_ADV_NC_t ble_cmd_adv_nc_t;
#endif
/*---------------------------------------------------------------------------*/
static RF_Object rf_netstack;
#if RF_CONF_BLE_BEACON_ENABLE
@ -479,45 +491,171 @@ ble_open(RF_Params *params)
#endif
}
/*---------------------------------------------------------------------------*/
#if RF_CONF_BLE_BEACON_ENABLE
static RF_Op *
init_ble_adv_array(ble_cmd_adv_nc_t *ble_adv_array, uint8_t bm_channel)
{
RF_Op *first_ble_adv = NULL;
ble_cmd_adv_nc_t *cmd_adv_37 = &ble_adv_array[0];
ble_cmd_adv_nc_t *cmd_adv_38 = &ble_adv_array[1];
ble_cmd_adv_nc_t *cmd_adv_39 = &ble_adv_array[2];
/* Setup channel 37 advertisement if enabled */
if(bm_channel & BLE_ADV_CHANNEL_37) {
/* Default configurations from ble_cmd_adv_nc */
memcpy(cmd_adv_37, &ble_cmd_adv_nc, sizeof(ble_cmd_adv_nc));
cmd_adv_37->channel = 37;
/* Magic number: initialization for whitener, specific for channel 37 */
cmd_adv_37->whitening.init = 0x65;
/*
* The next advertisement is chained depending on whether they are
* enbled or not. If both 38 and 39 are disabled, then there is no
* chaining.
*/
if(bm_channel & BLE_ADV_CHANNEL_38) {
cmd_adv_37->pNextOp = (RF_Op *)cmd_adv_38;
cmd_adv_37->condition.rule = COND_ALWAYS;
} else if(bm_channel & BLE_ADV_CHANNEL_39) {
cmd_adv_37->pNextOp = (RF_Op *)cmd_adv_39;
cmd_adv_37->condition.rule = COND_ALWAYS;
} else {
cmd_adv_37->pNextOp = NULL;
cmd_adv_37->condition.rule = COND_NEVER;
}
/* Channel 37 will always be first if enabled */
first_ble_adv = (RF_Op *)cmd_adv_37;
}
/* Setup channel 38 advertisement if enabled */
if(bm_channel & BLE_ADV_CHANNEL_38) {
memcpy(cmd_adv_38, &ble_cmd_adv_nc, sizeof(ble_cmd_adv_nc));
cmd_adv_38->channel = 38;
/* Magic number: initialization for whitener, specific for channel 38 */
cmd_adv_38->whitening.init = 0x66;
/*
* The next advertisement is chained depending on whether they are
* enbled or not. If 39 is disabled, then there is no chaining.
*/
if(bm_channel & BLE_ADV_CHANNEL_39) {
cmd_adv_38->pNextOp = (RF_Op *)cmd_adv_39;
cmd_adv_38->condition.rule = COND_ALWAYS;
} else {
cmd_adv_38->pNextOp = NULL;
cmd_adv_38->condition.rule = COND_NEVER;
}
/*
* Channel 38 is only first if the first_ble_adv pointer is not
* set by channel 37.
*/
if(first_ble_adv == NULL) {
first_ble_adv = (RF_Op *)cmd_adv_38;
}
}
/* Setup channel 39 advertisement if enabled */
if(bm_channel & BLE_ADV_CHANNEL_39) {
memcpy(cmd_adv_39, &ble_cmd_adv_nc, sizeof(ble_cmd_adv_nc));
cmd_adv_39->channel = 39;
/* Magic number: initialization for whitener, specific for channel 39 */
cmd_adv_39->whitening.init = 0x67;
/* Channel 39 is always the last advertisement in the chain */
cmd_adv_39->pNextOp = NULL;
cmd_adv_39->condition.rule = COND_NEVER;
/*
* Channel 39 is only first if the first_ble_adv pointer is not
* set by channel 37 or channel 38.
*/
if(first_ble_adv == NULL) {
first_ble_adv = (RF_Op *)cmd_adv_39;
}
}
return first_ble_adv;
}
#endif /* RF_CONF_BLE_BEACON_ENABLE */
/*---------------------------------------------------------------------------*/
rf_result_t
ble_sched_beacon(RF_Callback cb, RF_EventMask bm_event)
ble_sched_beacons(uint8_t bm_channel)
{
#if RF_CONF_BLE_BEACON_ENABLE
RF_ScheduleCmdParams sched_params;
RF_ScheduleCmdParams_init(&sched_params);
/*
* Allocate the advertisement commands on the stack rather than statically
* to RAM in order to save space. We don't need them after the
* advertisements have been transmitted.
*/
ble_cmd_adv_nc_t ble_cmd_adv_nc_array[NUM_BLE_ADV_CHANNELS];
RF_Op *initial_adv = NULL;
RF_ScheduleCmdParams sched_params;
RF_CmdHandle beacon_handle;
RF_EventMask beacon_events;
rf_result_t rf_result;
/* If no channels are mapped, then early return OK */
if((bm_channel & BLE_ADV_CHANNEL_ALL) == 0) {
return RF_RESULT_OK;
}
initial_adv = init_ble_adv_array(ble_cmd_adv_nc_array, bm_channel);
if(initial_adv == NULL) {
LOG_ERR("Initializing BLE Advertisement chain failed\n");
return RF_RESULT_ERROR;
}
RF_ScheduleCmdParams_init(&sched_params);
sched_params.priority = RF_PriorityNormal;
sched_params.endTime = 0;
sched_params.allowDelay = RF_AllowDelayAny;
CMD_STATUS(ble_cmd_beacon) = PENDING;
RF_CmdHandle beacon_handle = RF_scheduleCmd(
&rf_ble,
(RF_Op *)&ble_cmd_beacon,
&sched_params,
cb,
bm_event);
/*
* The most efficient way to schedule the command is as follows:
* 1. Schedule the BLE advertisement chain
* 2. Reschedule the RX command IF it was running.
* 3. Pend on the BLE avertisement chain
*/
beacon_handle = RF_scheduleCmd(
&rf_ble,
initial_adv,
&sched_params,
NULL,
0);
if(!CMD_HANDLE_OK(beacon_handle)) {
LOG_ERR("Unable to schedule BLE Beacon command, handle=%d status=0x%04x\n",
beacon_handle, CMD_STATUS(ble_cmd_beacon));
beacon_handle, CMD_STATUS(ble_cmd_adv_nc));
return RF_RESULT_ERROR;
}
const uint_fast8_t rx_key = cmd_rx_disable();
/* Note that this only reschedules RX if it is running */
rf_result = cmd_rx_restore(cmd_rx_disable());
/* Wait until Beacon operation finishes */
RF_EventMask beacon_events = RF_pendCmd(&rf_ble, beacon_handle, 0);
if(!EVENTS_CMD_DONE(beacon_events)) {
LOG_ERR("Pending on scheduled BLE Beacon command generated error, events=0x%08llx status=0x%04x\n",
beacon_events, CMD_STATUS(ble_cmd_beacon));
beacon_events = RF_pendCmd(&rf_ble, beacon_handle, 0);
if(rf_result != RF_RESULT_OK) {
LOG_ERR("Rescheduling CMD_RX failed when BLE advertising\n");
return RF_RESULT_ERROR;
}
if(!EVENTS_CMD_DONE(beacon_events)) {
LOG_ERR("Pending on scheduled BLE Beacon command generated error, events=0x%08llx status=0x%04x\n",
beacon_events, CMD_STATUS(ble_cmd_adv_nc));
cmd_rx_restore(rx_key);
return RF_RESULT_ERROR;
}
cmd_rx_restore(rx_key);
return RF_RESULT_OK;
#else

View File

@ -58,6 +58,16 @@ typedef enum {
RF_RESULT_ERROR,
} rf_result_t;
/*---------------------------------------------------------------------------*/
typedef enum {
BLE_ADV_CHANNEL_37 = (1 << 0),
BLE_ADV_CHANNEL_38 = (1 << 1),
BLE_ADV_CHANNEL_39 = (1 << 2),
BLE_ADV_CHANNEL_ALL = (BLE_ADV_CHANNEL_37 |
BLE_ADV_CHANNEL_38 |
BLE_ADV_CHANNEL_39),
} ble_adv_channel_t;
/*---------------------------------------------------------------------------*/
/**
* \name Common RF scheduler functionality.
*
@ -91,7 +101,7 @@ rf_result_t netstack_stop_rx(void);
* @{
*/
RF_Handle ble_open(RF_Params *params);
rf_result_t ble_sched_beacon(RF_Callback cb, RF_EventMask bm_event);
rf_result_t ble_sched_beacons(uint8_t bm_adv_channel);
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_SCHED_H_ */

View File

@ -89,7 +89,7 @@
#define ble_mode rf_ble_mode
#define ble_cmd_radio_setup rf_ble_cmd_radio_setup
#define ble_adv_par rf_ble_adv_par
#define ble_cmd_beacon rf_ble_cmd_ble_adv_nc
#define ble_cmd_adv_nc rf_ble_cmd_ble_adv_nc
/* CC13x2/CC26x2 devices */
#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
@ -97,7 +97,7 @@
#define ble_mode rf_ble_mode
#define ble_cmd_radio_setup rf_ble_cmd_radio_setup
#define ble_adv_par rf_ble_adv_par
#define ble_cmd_beacon rf_ble_cmd_ble_adv_nc
#define ble_cmd_adv_nc rf_ble_cmd_ble_adv_nc
#endif /* DeviceFamily_PARENT */

View File

@ -14,7 +14,7 @@ CONTIKI_TARGET_SOURCEFILES += board-buttons.c als-sensor.c
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc2538
CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538
include $(CONTIKI_CPU)/Makefile.cc2538
MODULES += os/storage/cfs

View File

@ -11,7 +11,7 @@ BOARDS = srf06/cc26x0 srf06/cc13x0 launchpad/cc2640r2 launchpad/cc2650 launchpad
CONTIKI_TARGET_DIRS += .
### Include the board-specific makefile
PLATFORM_ROOT_DIR = $(CONTIKI)/arch/platform/$(TARGET)
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)
-include $(PLATFORM_ROOT_DIR)/$(BOARD)/Makefile.$(notdir $(BOARD))
CONTIKI_TARGET_SOURCEFILES += platform.c leds-arch.c
@ -25,5 +25,5 @@ SMALL ?= 0
### Define the CPU directory and pull in the correct CPU makefile. This will
### be defined by one of the makefiles included above and it can be either
### Makefile.cc26xx or Makefile.cc13xx
CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc26x0-cc13x0
CONTIKI_CPU=$(ARCH_PATH)/cpu/cc26x0-cc13x0
include $(CONTIKI_CPU)/Makefile.$(CPU_FAMILY)

View File

@ -41,13 +41,13 @@ JNILIB = $(BUILD_DIR_BOARD)/$(LIBNAME).$(TARGET)
CONTIKI_APP_OBJ = $(CONTIKI_APP).o
### COOJA platform sources
COOJA = $(CONTIKI)/arch/platform/$(TARGET)
COOJA = $(ARCH_PATH)/platform/$(TARGET)
CONTIKI_TARGET_DIRS = . dev lib sys cfs net
# (COOJA_SOURCEDIRS contains additional sources dirs set from simulator)
vpath %.c $(COOJA_SOURCEDIRS)
COOJA_BASE = simEnvChange.c cooja_mt.c cooja_mtarch.c rtimer-arch.c slip.c watchdog.c
COOJA_BASE = simEnvChange.c cooja_mt.c cooja_mtarch.c rtimer-arch.c slip.c watchdog.c int-master.c
COOJA_INTFS = beep.c button-sensor.c ip.c leds-arch.c moteid.c \
pir-sensor.c rs232.c vib-sensor.c \
@ -67,7 +67,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
CLEAN += COOJA.log
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/x86
CONTIKI_CPU=$(ARCH_PATH)/cpu/x86
### Compiler arguments
#CC = gcc

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2018, George Oikonomou - http://www.spd.gr
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "sys/int-master.h"
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
#define DISABLED 0
#define ENABLED 1
/*---------------------------------------------------------------------------*/
static int_master_status_t stat = DISABLED;
/*---------------------------------------------------------------------------*/
void
int_master_enable(void)
{
stat = ENABLED;
}
/*---------------------------------------------------------------------------*/
int_master_status_t
int_master_read_and_disable(void)
{
int_master_status_t rv = stat;
stat = DISABLED;
return rv;
}
/*---------------------------------------------------------------------------*/
void
int_master_status_set(int_master_status_t status)
{
stat = status;
}
/*---------------------------------------------------------------------------*/
bool
int_master_is_enabled(void)
{
return stat == DISABLED ? false : true;
}
/*---------------------------------------------------------------------------*/

View File

@ -28,5 +28,5 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
MAKE_MAC ?= MAKE_MAC_NULLMAC
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/native
include $(CONTIKI)/arch/cpu/native/Makefile.native
CONTIKI_CPU=$(ARCH_PATH)/cpu/native
include $(ARCH_PATH)/cpu/native/Makefile.native

View File

@ -3,7 +3,7 @@ ifndef CONTIKI
endif
### Include the board-specific makefile
PLATFORM_ROOT_DIR = $(CONTIKI)/arch/platform/$(TARGET)
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)
CONTIKI_TARGET_DIRS += . dev config
CONTIKI_SOURCEFILES += platform.c leds-arch.c nrf52dk-sensors.c button-sensor.c temperature-sensor.c
@ -21,5 +21,5 @@ endif
SMALL ?= 0
### Define the CPU directory and pull in the correct CPU makefile.
CONTIKI_CPU=$(CONTIKI)/arch/cpu/nrf52832
CONTIKI_CPU=$(ARCH_PATH)/cpu/nrf52832
include $(CONTIKI_CPU)/Makefile.nrf52832

View File

@ -64,7 +64,16 @@ static int
value(int type)
{
#ifndef SOFTDEVICE_PRESENT
return nrf_temp_read();
int32_t volatile temp;
NRF_TEMP->TASKS_START = 1;
/* nRF52832 datasheet: one temperature measurement takes typically 36 us */
RTIMER_BUSYWAIT_UNTIL(NRF_TEMP->EVENTS_DATARDY, RTIMER_SECOND * 72 / 1000000);
NRF_TEMP->EVENTS_DATARDY = 0;
temp = nrf_temp_read();
NRF_TEMP->TASKS_STOP = 1;
return temp;
#else
int32_t temp;
sd_temp_get(&temp);

View File

@ -11,7 +11,7 @@ endif
### Configure the build for the board and pull in board-specific sources
CONTIKI_TARGET_DIRS += . dev
PLATFORM_ROOT_DIR = $(CONTIKI)/arch/platform/$(TARGET)
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)
### Include
CONTIKI_TARGET_SOURCEFILES += platform.c board.c
@ -21,7 +21,7 @@ CONTIKI_TARGET_SOURCEFILES += antenna.c adxl346.c max44009.c sht21.c tps62730.c
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc2538
CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538
include $(CONTIKI_CPU)/Makefile.cc2538
MODULES += os/storage/cfs

View File

@ -51,7 +51,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
CPU_FAMILY = cc13xx-cc26xx
# Define the CPU directory and pull in the correct CPU Makefile
CONTIKI_CPU := $(realpath $(CONTIKI)/arch/cpu/simplelink-$(CPU_FAMILY))
CONTIKI_CPU := $(realpath $(ARCH_PATH)/cpu/simplelink-$(CPU_FAMILY))
include $(CONTIKI_CPU)/Makefile.$(CPU_FAMILY)
MODULES += os/net os/net/mac os/net/mac/framer

View File

@ -31,6 +31,10 @@
* \addtogroup cc13xx-cc26xx-platform
* @{
*
* The order of which these header files are included is important in order
* for the configurations to be correctly set. This has to do with some
* slight unfortunate configuration dependencies of the board file.
*
* \file
* Configuration for the SimpleLink CC13xx/CC26xx platform.
* \author
@ -40,18 +44,16 @@
#ifndef CONTIKI_CONF_H_
#define CONTIKI_CONF_H_
/*---------------------------------------------------------------------------*/
#include "board-conf.h"
/*---------------------------------------------------------------------------*/
/* Include Project Specific conf */
/* Include project-specific configurations */
#ifdef PROJECT_CONF_PATH
#include PROJECT_CONF_PATH
#endif
/*---------------------------------------------------------------------------*/
/* Include CPU-related configuration */
#include "cc13xx-cc26xx-conf.h"
/* Include board-specific configurations */
#include "board-conf.h"
/*---------------------------------------------------------------------------*/
/* Must be included after cc13xx-cc26xx-conf.h */
#include <Board.h>
/* Include CPU-related configurations */
#include "cc13xx-cc26xx-conf.h"
/*---------------------------------------------------------------------------*/
#endif /* CONTIKI_CONF_H_ */
/*---------------------------------------------------------------------------*/

View File

@ -50,7 +50,7 @@
#ifndef BOARD_CONF_H_
#define BOARD_CONF_H_
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
#include "rf-conf.h"
/*---------------------------------------------------------------------------*/
/**
* \name LED configurations for the dev/leds.h API.

View File

@ -36,6 +36,9 @@
#define Board_CC1310_LAUNCHXL
#define BOARD_STRING "TI CC1310 LaunchPad"
#define RF_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -498,7 +498,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC1310_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1310_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1310_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC1310_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC1310_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC1310_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC1310_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC1310_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */

View File

@ -0,0 +1,66 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for the Sub-1 GHz path
* on the radio.
*
* These are the following front-end mode configurations for the
* CC1310-LAUNCHXL board:
* - Sub-1 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1312R1_LAUNCHXL
#define BOARD_STRING "TI CC1312R1 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1312R1_LAUNCHXL.h"
#define Board_CC1312R1_LAUNCHXL
#define BOARD_STRING "TI CC1312R1 LaunchPad"
#define Board_initGeneral() CC1312R1_LAUNCHXL_initGeneral()
#define Board_shutDownExtFlash() CC1312R1_LAUNCHXL_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1312R1_LAUNCHXL_wakeUpExtFlash()

View File

@ -619,7 +619,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC1312R1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1312R1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1312R1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC1312R1_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC1312R1_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC1312R1_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC1312R1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC1312R1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */

View File

@ -0,0 +1,65 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for the Sub-1 GHz path
* on the radio.
*
* These are the following front-end mode configurations for the
* CC1312R1-LAUNCHXL board:
* - Sub-1 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1350_LAUNCHXL_433
#define BOARD_STRING "TI CC1350-433 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1350_LAUNCHXL_433.h"
#define Board_CC1350_LAUNCHXL_433
#define BOARD_STRING "TI CC1350-433 LaunchPad"
#define Board_initGeneral() CC1350_LAUNCHXL_433_initGeneral()
#define Board_shutDownExtFlash() CC1350_LAUNCHXL_433_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1350_LAUNCHXL_433_wakeUpExtFlash()

View File

@ -493,7 +493,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC1350_LAUNCHXL_433_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1350_LAUNCHXL_433_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1350_LAUNCHXL_433_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC1350_LAUNCHXL_433_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC1350_LAUNCHXL_433_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC1350_LAUNCHXL_433_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC1350_LAUNCHXL_433_DIO1_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* RF SW Switch defaults to 2.4 GHz path*/
CC1350_LAUNCHXL_433_DIO30_RF_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* External RF Switch is powered off by default */

View File

@ -165,23 +165,60 @@ void Board_initHook()
#if defined(Board_RF_SUB1GHZ)
/*
* ======== CC1350_LAUNCHXL_433_rfDriverCallback ========
* This is an implementation for the CC1350 launchpad which uses a
* Mask to be used to determine the effective value of the setup command's
* loDivider field.
*/
#define LODIVIDER_MASK 0x7F
/*
* ======== rfDriverCallback ========
* This is an implementation for the CC1350 LaunchPad which uses a
* single signal for antenna switching.
*/
void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
{
/* Decode input arguments. */
(void)client;
RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg;
/* Local variable. */
bool sub1GHz = false;
uint8_t loDivider = 0;
if (events & RF_GlobalEventRadioSetup) {
/* Power up the antenna switch */
PINCC26XX_setOutputValue(Board_RF_POWER, 1);
if (setupCommand->common.commandNo == CMD_PROP_RADIO_DIV_SETUP) {
/* Sub-1 GHz, requires antenna switch high */
/* Decision about the frequency band shall be made based on the
loDivider field. */
switch (setupCommand->common.commandNo) {
case (CMD_RADIO_SETUP):
case (CMD_BLE5_RADIO_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->common.loDivider;
/* Sub-1 GHz, requires antenna switch high. */
if ((loDivider != 0) && (loDivider != 2)) {
sub1GHz = true;
}
break;
case (CMD_PROP_RADIO_DIV_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider;
/* Sub-1 GHz, requires antenna switch high. */
if ((loDivider != 0) && (loDivider != 2)) {
sub1GHz = true;
}
break;
default:break;
}
/* Select the correct antenna. */
if (sub1GHz) {
PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1);
}
else {
PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0);
}
}
else if (events & RF_GlobalEventRadioPowerDown) {
/* Disable antenna switch to save current */

View File

@ -0,0 +1,69 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for both the Sub-1 GHz
* path and the 2.4 GHz path on the radio.
*
* These are the following front-end mode configurations for the
* CC1350-4-LAUNCHXL board:
* - Sub-1 GHz: differential and external bias
* - 2.4 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1350_LAUNCHXL
#define BOARD_STRING "TI CC1350 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1350_LAUNCHXL.h"
#define Board_CC1350_LAUNCHXL
#define BOARD_STRING "TI CC1350 LaunchPad"
#define Board_initGeneral() CC1350_LAUNCHXL_initGeneral()
#define Board_shutDownExtFlash() CC1350_LAUNCHXL_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1350_LAUNCHXL_wakeUpExtFlash()

View File

@ -498,7 +498,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC1350_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1350_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1350_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC1350_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC1350_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC1350_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC1350_LAUNCHXL_DIO1_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* RF SW Switch defaults to 2.4 GHz path*/
CC1350_LAUNCHXL_DIO30_RF_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* External RF Switch is powered off by default */

View File

@ -166,6 +166,12 @@ void Board_initHook()
*/
#if defined(Board_RF_SUB1GHZ)
/*
* Mask to be used to determine the effective value of the setup command's
* loDivider field.
*/
#define LODIVIDER_MASK 0x7F
/*
* ======== rfDriverCallback ========
* This is an implementation for the CC1350 launchpad which uses a
@ -173,17 +179,48 @@ void Board_initHook()
*/
void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
{
/* Decode input arguments. */
(void)client;
RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg;
/* Local variable. */
bool sub1GHz = false;
uint8_t loDivider = 0;
if (events & RF_GlobalEventRadioSetup) {
/* Power up the antenna switch */
PINCC26XX_setOutputValue(Board_RF_POWER, 1);
if (setupCommand->common.commandNo == CMD_PROP_RADIO_DIV_SETUP) {
/* Sub-1 GHz, requires antenna switch high */
/* Decision about the frequency band shall be made based on the
loDivider field. */
switch (setupCommand->common.commandNo) {
case (CMD_RADIO_SETUP):
case (CMD_BLE5_RADIO_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->common.loDivider;
/* Sub-1 GHz, requires antenna switch high. */
if ((loDivider != 0) && (loDivider != 2)) {
sub1GHz = true;
}
break;
case (CMD_PROP_RADIO_DIV_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider;
/* Sub-1 GHz, requires antenna switch high. */
if ((loDivider != 0) && (loDivider != 2)) {
sub1GHz = true;
}
break;
default:break;
}
/* Select the correct antenna. */
if (sub1GHz) {
PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1);
}
else {
PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0);
}
}
else if (events & RF_GlobalEventRadioPowerDown) {
/* Disable antenna switch to save current */

View File

@ -0,0 +1,69 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for both the Sub-1 GHz
* path and the 2.4 GHz path on the radio.
*
* These are the following front-end mode configurations for the
* CC1350-LAUNCHXL board:
* - Sub-1 GHz: differential and external bias
* - 2.4 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1352P_2_LAUNCHXL
#define BOARD_STRING "TI CC1352P-2 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1352P_2_LAUNCHXL.h"
#define Board_CC1352P_2_LAUNCHXL
#define BOARD_STRING "TI CC1352P-2 LaunchPad"
#define Board_initGeneral() CC1352P_2_LAUNCHXL_initGeneral()
#define Board_shutDownExtFlash() CC1352P_2_LAUNCHXL_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1352P_2_LAUNCHXL_wakeUpExtFlash()

View File

@ -585,7 +585,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC1352P_2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1352P_2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1352P_2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC1352P_2_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC1352P_2_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC1352P_2_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC1352P_2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC1352P_2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */

View File

@ -152,6 +152,12 @@ void CC1352P_2_LAUNCHXL_shutDownExtFlash(void)
*/
#if defined(Board_RF_SUB1GHZ)
/*
* Mask to be used to determine the effective value of the setup command's
* loDivider field.
*/
#define LODIVIDER_MASK 0x7F
/*
* ======== Antenna switching ========
*/
@ -170,7 +176,7 @@ void initAntennaSwitch()
}
/*
* ======== rfDriverCallback ========
* ======== CC1352P1_LAUNCHXL_rfDriverCallback ========
* Sets up the antenna switch depending on the current PHY configuration.
* Truth table:
*
@ -183,6 +189,10 @@ void initAntennaSwitch()
*/
void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
{
/* Local variable. */
bool sub1GHz = false;
uint8_t loDivider = 0;
/* Switch off all paths first. Needs to be done anyway in every sub-case below. */
PINCC26XX_setOutputValue(Board_RF_24GHZ, 0);
PINCC26XX_setOutputValue(Board_RF_HIGH_PA, 0);
@ -195,15 +205,36 @@ void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
/* Decode the generic argument as a setup command. */
RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg;
if (setupCommand->common.commandNo == CMD_PROP_RADIO_DIV_SETUP) {
switch (setupCommand->common.commandNo) {
case (CMD_RADIO_SETUP):
case (CMD_BLE5_RADIO_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->common.loDivider;
/* Sub-1GHz front-end. */
if (loDivider != 0) {
sub1GHz = true;
}
break;
case (CMD_PROP_RADIO_DIV_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider;
/* Sub-1GHz front-end. */
if (loDivider != 0) {
sub1GHz = true;
}
break;
default:break;
}
if (sub1GHz) {
/* Sub-1 GHz */
if (paType == RF_TxPowerTable_HighPA) {
/* PA enable --> HIGH PA
* LNA enable --> Sub-1 GHz
*/
PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO);
// Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
// de-asserted on CC1352 Rev A.
/* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
de-asserted on CC1352 Rev A. */
PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_RFC_GPO0);
} else {
@ -221,8 +252,8 @@ void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
* LNA enable --> 2.4 GHz
*/
PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_RFC_GPO0);
// Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
// de-asserted on CC1352 Rev A.
/* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
de-asserted on CC1352 Rev A. */
PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO);
} else {

View File

@ -0,0 +1,69 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for both the Sub-1 GHz
* path and the 2.4 GHz path on the radio.
*
* These are the following front-end mode configurations for the
* CC1352P-2-LAUNCHXL board:
* - Sub-1 GHz: differential and external bias
* - 2.4 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1352P_4_LAUNCHXL
#define BOARD_STRING "TI CC1352P-4 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1352P_4_LAUNCHXL.h"
#define Board_CC1352P_4_LAUNCHXL
#define BOARD_STRING "TI CC1352P-4 LaunchPad"
#define Board_initGeneral() CC1352P_4_LAUNCHXL_initGeneral()
#define Board_shutDownExtFlash() CC1352P_4_LAUNCHXL_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1352P_4_LAUNCHXL_wakeUpExtFlash()

View File

@ -585,7 +585,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC1352P_4_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1352P_4_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1352P_4_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC1352P_4_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC1352P_4_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC1352P_4_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC1352P_4_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC1352P_4_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */

View File

@ -152,6 +152,12 @@ void CC1352P_4_LAUNCHXL_shutDownExtFlash(void)
*/
#if defined(Board_RF_SUB1GHZ)
/*
* Mask to be used to determine the effective value of the setup command's
* loDivider field.
*/
#define LODIVIDER_MASK 0x7F
/*
* ======== Antenna switching ========
*/
@ -170,7 +176,7 @@ void initAntennaSwitch()
}
/*
* ======== rfDriverCallback ========
* ======== CC1352P1_LAUNCHXL_rfDriverCallback ========
* Sets up the antenna switch depending on the current PHY configuration.
* Truth table:
*
@ -183,6 +189,10 @@ void initAntennaSwitch()
*/
void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
{
/* Local variable. */
bool sub1GHz = false;
uint8_t loDivider = 0;
/* Switch off all paths first. Needs to be done anyway in every sub-case below. */
PINCC26XX_setOutputValue(Board_RF_24GHZ, 0);
PINCC26XX_setOutputValue(Board_RF_HIGH_PA, 0);
@ -195,15 +205,36 @@ void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
/* Decode the generic argument as a setup command. */
RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg;
if (setupCommand->common.commandNo == CMD_PROP_RADIO_DIV_SETUP) {
switch (setupCommand->common.commandNo) {
case (CMD_RADIO_SETUP):
case (CMD_BLE5_RADIO_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->common.loDivider;
/* Sub-1GHz front-end. */
if (loDivider != 0) {
sub1GHz = true;
}
break;
case (CMD_PROP_RADIO_DIV_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider;
/* Sub-1GHz front-end. */
if (loDivider != 0) {
sub1GHz = true;
}
break;
default:break;
}
if (sub1GHz) {
/* Sub-1 GHz */
if (paType == RF_TxPowerTable_HighPA) {
/* PA enable --> HIGH PA
* LNA enable --> Sub-1 GHz
*/
PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO);
// Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
// de-asserted on CC1352 Rev A.
/* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
de-asserted on CC1352 Rev A. */
PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_RFC_GPO0);
} else {
@ -221,8 +252,8 @@ void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
* LNA enable --> 2.4 GHz
*/
PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_RFC_GPO0);
// Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
// de-asserted on CC1352 Rev A.
/* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
de-asserted on CC1352 Rev A. */
PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO);
} else {

View File

@ -0,0 +1,69 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for both the Sub-1 GHz
* path and the 2.4 GHz path on the radio.
*
* These are the following front-end mode configurations for the
* CC1352P-4-LAUNCHXL board:
* - Sub-1 GHz: differential and external bias
* - 2.4 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1352P1_LAUNCHXL
#define BOARD_STRING "TI CC1352P1 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1352P1_LAUNCHXL.h"
#define Board_CC1352P1_LAUNCHXL
#define BOARD_STRING "TI CC1352P1 LaunchPad"
#define Board_initGeneral() CC1352P1_LAUNCHXL_initGeneral()
#define Board_shutDownExtFlash() CC1352P1_LAUNCHXL_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1352P1_LAUNCHXL_wakeUpExtFlash()

View File

@ -585,7 +585,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC1352P1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1352P1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1352P1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC1352P1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC1352P1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC1352P1_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC1352P1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC1352P1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */

View File

@ -152,6 +152,12 @@ void CC1352P1_LAUNCHXL_shutDownExtFlash(void)
*/
#if defined(Board_RF_SUB1GHZ)
/*
* Mask to be used to determine the effective value of the setup command's
* loDivider field.
*/
#define LODIVIDER_MASK 0x7F
/*
* ======== Antenna switching ========
*/
@ -170,7 +176,7 @@ void initAntennaSwitch()
}
/*
* ======== rfDriverCallback ========
* ======== CC1352P1_LAUNCHXL_rfDriverCallback ========
* Sets up the antenna switch depending on the current PHY configuration.
* Truth table:
*
@ -183,6 +189,10 @@ void initAntennaSwitch()
*/
void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
{
/* Local variable. */
bool sub1GHz = false;
uint8_t loDivider = 0;
/* Switch off all paths first. Needs to be done anyway in every sub-case below. */
PINCC26XX_setOutputValue(Board_RF_24GHZ, 0);
PINCC26XX_setOutputValue(Board_RF_HIGH_PA, 0);
@ -195,15 +205,36 @@ void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
/* Decode the generic argument as a setup command. */
RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg;
if (setupCommand->common.commandNo == CMD_PROP_RADIO_DIV_SETUP) {
switch (setupCommand->common.commandNo) {
case (CMD_RADIO_SETUP):
case (CMD_BLE5_RADIO_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->common.loDivider;
/* Sub-1GHz front-end. */
if (loDivider != 0) {
sub1GHz = true;
}
break;
case (CMD_PROP_RADIO_DIV_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider;
/* Sub-1GHz front-end. */
if (loDivider != 0) {
sub1GHz = true;
}
break;
default:break;
}
if (sub1GHz) {
/* Sub-1 GHz */
if (paType == RF_TxPowerTable_HighPA) {
/* PA enable --> HIGH PA
* LNA enable --> Sub-1 GHz
*/
PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO);
// Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
// de-asserted on CC1352 Rev A.
/* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
de-asserted on CC1352 Rev A. */
PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_RFC_GPO0);
} else {
@ -221,8 +252,8 @@ void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
* LNA enable --> 2.4 GHz
*/
PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_RFC_GPO0);
// Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
// de-asserted on CC1352 Rev A.
/* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
de-asserted on CC1352 Rev A. */
PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO);
} else {

View File

@ -0,0 +1,69 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for both the Sub-1 GHz
* path and the 2.4 GHz path on the radio.
*
* These are the following front-end mode configurations for the
* CC1352P1-LAUNCHXL board:
* - Sub-1 GHz: differential and external bias
* - 2.4 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1352R1_LAUNCHXL
#define BOARD_STRING "TI CC1352R1 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1352R1_LAUNCHXL.h"
#define Board_CC1352R1_LAUNCHXL
#define BOARD_STRING "TI CC1352R1 LaunchPad"
#define Board_initGeneral() CC1352R1_LAUNCHXL_initGeneral()
#define Board_shutDownExtFlash() CC1352R1_LAUNCHXL_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1352R1_LAUNCHXL_wakeUpExtFlash()

View File

@ -36,8 +36,6 @@
* CC1352R1_LAUNCHXL board.
*/
#include "contiki.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@ -609,7 +607,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC1352R1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1352R1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC1352R1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC1352R1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC1352R1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC1352R1_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC1352R1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC1352R1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */

View File

@ -164,23 +164,61 @@ void Board_initHook()
*/
#if defined(Board_RF_SUB1GHZ)
/*
* Mask to be used to determine the effective value of the setup command's
* loDivider field.
*/
#define LODIVIDER_MASK 0x7F
/*
* ======== rfDriverCallback ========
* This is an implementation for the CC1352R1 launchpad which uses a
* This is an implementation for the CC1352R launchpad which uses a
* single signal for antenna switching.
*/
void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
{
/* Decode input arguments. */
(void)client;
RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg;
if ((events & RF_GlobalEventRadioSetup) &&
(setupCommand->common.commandNo == CMD_PROP_RADIO_DIV_SETUP)) {
/* Sub-1 GHz, requires antenna switch high */
PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1);
/* Local variable. */
bool sub1GHz = false;
uint8_t loDivider = 0;
if (events & RF_GlobalEventRadioSetup) {
/* Decision about the frequency band shall be made based on the
loDivider field. */
switch (setupCommand->common.commandNo) {
case (CMD_RADIO_SETUP):
case (CMD_BLE5_RADIO_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->common.loDivider;
/* Sub-1GHz front-end. */
if (loDivider != 0) {
sub1GHz = true;
}
break;
case (CMD_PROP_RADIO_DIV_SETUP):
loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider;
/* Sub-1GHz front-end. */
if (loDivider != 0) {
sub1GHz = true;
}
break;
default:break;
}
/* Select the correct antenna. */
if (sub1GHz) {
PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1);
}
else {
PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0);
}
}
else if (events & RF_GlobalEventRadioPowerDown) {
/* Disable antenna switch to save current */
/* Set the antenna to 2.4 GHz as default. */
PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0);
}
}

View File

@ -0,0 +1,69 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for both the Sub-1 GHz
* path and the 2.4 GHz path on the radio.
*
* These are the following front-end mode configurations for the
* CC1352R1-LAUNCHXL board:
* - Sub-1 GHz: differential and external bias
* - 2.4 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,18 +33,18 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC2650_LAUNCHXL
#define BOARD_STRING "TI CC2650 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC2650_LAUNCHXL.h"
#define Board_initGeneral() CC2650_LAUNCHXL_initGeneral()
#define Board_CC2650_LAUNCHXL
#define BOARD_STRING "TI CC2650 LaunchPad"
#define Board_initGeneral() CC2650_LAUNCHXL_initGeneral()
#define Board_shutDownExtFlash() CC2650_LAUNCHXL_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC2650_LAUNCHXL_wakeUpExtFlash()
#define Board_wakeUpExtFlash() CC2650_LAUNCHXL_wakeUpExtFlash()
/* These #defines allow us to reuse TI-RTOS across other device families */

View File

@ -497,7 +497,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC2650_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC2650_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC2650_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC2650_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC2650_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC2650_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC2650_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC2650_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */

View File

@ -0,0 +1,65 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for the 2.4 GHz path
* on the radio.
*
* These are the following front-end mode configurations for the
* CC2650-LAUNCHXL board:
* - 2.4 GHz: differential and internal bias
*
* @{
*/
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_INTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,20 +33,18 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC26X2R1_LAUNCHXL
#define BOARD_STRING "TI CC26x2R1 LaunchPad"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC26X2R1_LAUNCHXL.h"
#define Board_initGeneral() CC26X2R1_LAUNCHXL_initGeneral()
#define Board_CC26X2R1_LAUNCHXL
#define BOARD_STRING "TI CC26x2R1 LaunchPad"
#define Board_initGeneral() CC26X2R1_LAUNCHXL_initGeneral()
#define Board_shutDownExtFlash() CC26X2R1_LAUNCHXL_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC26X2R1_LAUNCHXL_wakeUpExtFlash()
#define Board_wakeUpExtFlash() CC26X2R1_LAUNCHXL_wakeUpExtFlash()
/* These #defines allow us to reuse TI-RTOS across other device families */

View File

@ -35,7 +35,6 @@
* This file is responsible for setting up the board specific items for the
* CC26X2R1_LAUNCHXL board.
*/
#include "contiki.h"
#include <stdbool.h>
#include <stddef.h>
@ -619,7 +618,7 @@ const PIN_Config BoardGpioInitTable[] = {
CC26X2R1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC26X2R1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
CC26X2R1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
CC26X2R1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
CC26X2R1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
CC26X2R1_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
CC26X2R1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC26X2R1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */

View File

@ -0,0 +1,65 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for the 2.4 GHz path
* on the radio.
*
* These are the following front-end mode configurations for the
* CC26X2R1-LAUNCHXL board:
* - 2.4 GHz: differential and internal bias
*
* @{
*/
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_INTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -250,9 +250,9 @@ platform_init_stage_three(void)
LOG_INFO("RF: Channel %d", chan);
if(NETSTACK_RADIO.get_value(RADIO_PARAM_PAN_ID, &pan) == RADIO_RESULT_OK) {
LOG_INFO(", PANID 0x%04X", pan);
LOG_INFO_(", PANID 0x%04X", pan);
}
LOG_INFO("\n");
LOG_INFO_("\n");
LOG_INFO("Node ID: %d\n", node_id);

View File

@ -50,8 +50,7 @@
#ifndef BOARD_CONF_H_
#define BOARD_CONF_H_
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
/*---------------------------------------------------------------------------*/
#include "rf-conf.h"
#include "leds-arch.h"
/*---------------------------------------------------------------------------*/
/**

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1350STK
#define BOARD_STRING "TI CC1350 SensorTag"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1350STK.h"
#define Board_CC1350STK
#define BOARD_STRING "TI CC1350 SensorTag"
#define Board_initGeneral() CC1350STK_initGeneral()
#define Board_shutDownExtFlash() CC1350STK_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1350STK_wakeUpExtFlash()

View File

@ -0,0 +1,69 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for both the Sub-1 GHz
* path and the 2.4 GHz path on the radio.
*
* These are the following front-end mode configurations for the
* CC1350STK board:
* - Sub-1 GHz: single-ended RFN and external bias
* - 2.4 GHz: single-ended RFP and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_SINGLE_ENDED_RFN
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_SINGLE_ENDED_RFP
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC2650STK
#define BOARD_STRING "TI CC2650 SensorTag"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC2650STK.h"
#define Board_CC2650STK
#define BOARD_STRING "TI CC2650 SensorTag"
#define Board_initGeneral() CC2650STK_initGeneral()
#define Board_shutDownExtFlash() CC2650STK_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC2650STK_wakeUpExtFlash()

View File

@ -0,0 +1,65 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for the 2.4 GHz path
* on the radio.
*
* These are the following front-end mode configurations for the
* CC2650STK board:
* - 2.4 GHz: differential and internal bias
*
* @{
*/
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_INTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -303,9 +303,13 @@ value(int type)
result_value = SWAP16(result_value);
uint32_t e = (result_value & 0x0FFF) >> 0;
uint32_t m = (result_value & 0xF000) >> 12;
uint32_t converted = m * 100 * (1 << e);
/* formula for computing lux: lux = 0.01 * 2^e * m
* scale up by 100 to avoid floating point, then require
* users to scale down by same.
*/
uint32_t m = (result_value & 0x0FFF) >> 0;
uint32_t e = (result_value & 0xF000) >> 12;
uint32_t converted = m * (1 << e);
PRINTF("OPT: %04X r=%d (centilux)\n", result_value,
(int)(converted));

View File

@ -42,6 +42,8 @@
#ifndef BOARD_CONF_H_
#define BOARD_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf-conf.h"
/*---------------------------------------------------------------------------*/
/**
* \name LED configurations for the dev/leds.h API.
*

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC1350DK_7XD
#define BOARD_STRING "TI SmartRF06EB + CC13x0 EM"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC1350DK_7XD.h"
#define Board_CC1350DK_7XD
#define BOARD_STRING "TI SmartRF06EB + CC13x0 EM"
#define Board_initGeneral() CC1350DK_7XD_initGeneral()
#define Board_shutDownExtFlash() CC1350DK_7XD_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1350DK_7XD_wakeUpExtFlash()

View File

@ -0,0 +1,69 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for both the Sub-1 GHz
* path and the 2.4 GHz path on the radio.
*
* These are the following front-end mode configurations for the
* CC1350DK-7XD board:
* - Sub-1 GHz: differential and external bias
* - 2.4 GHz: differential and external bias
*
* @{
*/
#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -33,15 +33,15 @@
#ifndef __BOARD_H
#define __BOARD_H
#define Board_CC2650DK_7ID
#define BOARD_STRING "TI SmartRF06EB + CC26x0 EM"
#ifdef __cplusplus
extern "C" {
#endif
#include "CC2650DK_7ID.h"
#define Board_CC2650DK_7ID
#define BOARD_STRING "TI SmartRF06EB + CC26x0 EM"
#define Board_initGeneral() CC2650DK_7ID_initGeneral()
#define Board_shutDownExtFlash() CC2650DK_7ID_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC2650DK_7ID_wakeUpExtFlash()

View File

@ -0,0 +1,65 @@
/*
* 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
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 THE
* COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
/**
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Header file with board-specific RF configurations.
* \author
* Texas Instruments <e2e.ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CONF_H_
#define RF_CONF_H_
/*---------------------------------------------------------------------------*/
#include "rf/rf.h"
/*---------------------------------------------------------------------------*/
/**
* \name Board-specific front-end mode configurations for the 2.4 GHz path
* on the radio.
*
* These are the following front-end mode configurations for the
* CC2650DK-7ID board:
* - 2.4 GHz: differential and internal bias
*
* @{
*/
#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_INTERNAL
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* RF_CONF_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -18,7 +18,7 @@ endif
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
MCU=msp430f1611
include $(CONTIKI)/arch/cpu/msp430/Makefile.msp430
include $(ARCH_PATH)/cpu/msp430/Makefile.msp430
ifdef IAR

Some files were not shown because too many files have changed in this diff Show More