Skip to content

Commit

Permalink
Merge branch 'master' of github.com:alibaba/AliOS-Things
Browse files Browse the repository at this point in the history
  • Loading branch information
crazymouse2018 committed Apr 28, 2018
2 parents ad38eb2 + c1da208 commit 1d6ebe4
Show file tree
Hide file tree
Showing 45 changed files with 912 additions and 2,197 deletions.
4 changes: 2 additions & 2 deletions board/eml3047/eml3047.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ $(NAME)_SOURCES := board.c \

$(NAME)_COMPONENTS += modules.fs.kv

linklora ?= 0
ifeq ($(linklora), 0)
linkwan ?= 0
ifeq ($(linkwan), 0)
$(NAME)_SOURCES += src/lora.c
endif

Expand Down
13 changes: 10 additions & 3 deletions board/eml3047/src/eml3047_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
#include "low_power.h"
#include "vcom.h"

#include <k_api.h>

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
Expand Down Expand Up @@ -114,6 +116,9 @@ void USART4_5_IRQHandler(void)
int rx_ready = 0;
char rx;

CPSR_ALLOC();
RHINO_CPU_INTRPT_DISABLE();

if ( LL_USART_IsActiveFlag_RXNE(USART4) && (LL_USART_IsEnabledIT_RXNE(USART4 ) != RESET) )
{
/* no need to clear the RXNE flag because it is auto cleared by reading the data*/
Expand All @@ -122,11 +127,13 @@ void USART4_5_IRQHandler(void)
//PRINTF("%c\r\n", rx);
}
if (rx_ready) {
#ifdef CONFIG_LINKLORA_TEST
extern void linklora_test_cli_cb(uint8_t cmd);
linklora_test_cli_cb(rx);
#ifdef CONFIG_LINKWAN_TEST
extern void linkwan_test_cli_cb(uint8_t cmd);
linkwan_test_cli_cb(rx);
#endif
}

RHINO_CPU_INTRPT_ENABLE();
}

/* Private functions ---------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion board/eml3047/src/vcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void DBG_Uart_Init( void )
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
#ifdef CONFIG_LINKLORA_TEST
#ifdef CONFIG_LINKWAN_TEST
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
#else
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX;
Expand Down
9 changes: 3 additions & 6 deletions build/aos_toolchain_arm-none-eabi.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ ifeq ($(HOST_OS),Win32)
ifeq (,$(TOOLCHAIN_PATH))
SYSTEM_GCC_PATH = $(shell where $(TOOLCHAIN_PREFIX)gcc.exe)
ifneq (,$(findstring $(TOOLCHAIN_PREFIX)gcc.exe,$(SYSTEM_GCC_PATH)))
SYSTEM_TOOLCHAIN_PATH = $(subst $(TOOLCHAIN_PREFIX)gcc.exe,,$(SYSTEM_GCC_PATH))
TOOLCHAIN_PATH := $(SYSTEM_TOOLCHAIN_PATH)
TOOLCHAIN_PATH :=
else
DOWNLOAD_URL = "https://launchpad.net/gcc-arm-embedded/+download"
TOOLCHIAN_FILE = "gcc-arm-none-eabi-5_4-2016q3-20160926-win32.zip"
Expand All @@ -62,8 +61,7 @@ ifneq (,$(filter $(HOST_OS),Linux32 Linux64))
ifeq (,$(TOOLCHAIN_PATH))
SYSTEM_GCC_PATH = $(shell which $(TOOLCHAIN_PREFIX)gcc)
ifneq (,$(findstring $(TOOLCHAIN_PREFIX)gcc,$(SYSTEM_GCC_PATH)))
SYSTEM_TOOLCHAIN_PATH = $(subst $(TOOLCHAIN_PREFIX)gcc,,$(SYSTEM_GCC_PATH))
TOOLCHAIN_PATH := $(SYSTEM_TOOLCHAIN_PATH)
TOOLCHAIN_PATH :=
else
DOWNLOAD_URL = "https://launchpad.net/gcc-arm-embedded/+download"
TOOLCHIAN_FILE = "gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2"
Expand All @@ -90,8 +88,7 @@ ifeq ($(HOST_OS),OSX)
ifeq (,$(TOOLCHAIN_PATH))
SYSTEM_GCC_PATH = $(shell which $(TOOLCHAIN_PREFIX)gcc)
ifneq (,$(findstring $(TOOLCHAIN_PREFIX)gcc,$(SYSTEM_GCC_PATH)))
SYSTEM_TOOLCHAIN_PATH = $(subst $(TOOLCHAIN_PREFIX)gcc,,$(SYSTEM_GCC_PATH))
TOOLCHAIN_PATH := $(SYSTEM_TOOLCHAIN_PATH)
TOOLCHAIN_PATH :=
else
DOWNLOAD_URL = "https://launchpad.net/gcc-arm-embedded/+download"
TOOLCHIAN_FILE = "gcc-arm-none-eabi-5_4-2016q3-20160926-mac.tar.bz2"
Expand Down
2 changes: 1 addition & 1 deletion build/aos_toolchain_armhflinux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif #Linux32 Linux64 OSX

ifeq (,$(TOOLCHAIN_PATH))
ifneq (,$(SYSTEM_TOOLCHAIN_PATH))
TOOLCHAIN_PATH := $(SYSTEM_TOOLCHAIN_PATH)
TOOLCHAIN_PATH :=
else
$(error can not find compiler toolchain, please install gcc-arm-linux-gnueabihf toolchain first)
endif #SYSTEM_TOOLCHAIN_PATH
Expand Down
2 changes: 1 addition & 1 deletion build/aos_toolchain_csky.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ endif #WIN32

ifeq (,$(TOOLCHAIN_PATH))
ifneq (,$(SYSTEM_TOOLCHAIN_PATH))
TOOLCHAIN_PATH := $(SYSTEM_TOOLCHAIN_PATH)
TOOLCHAIN_PATH :=
else
$(error can not find compiler toolchain, please install gcc-csky-abiv2-elf toolchain to $(COMPILER_ROOT)/${TOOLCHAIN_DEFAULT_FOLDER/${HOST_OS} folder)
endif #SYSTEM_TOOLCHAIN_PATH
Expand Down
2 changes: 1 addition & 1 deletion build/aos_toolchain_rockchiplinux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif #Linux32 Linux64 OSX

ifeq (,$(TOOLCHAIN_PATH))
ifneq (,$(SYSTEM_TOOLCHAIN_PATH))
TOOLCHAIN_PATH := $(SYSTEM_TOOLCHAIN_PATH)
TOOLCHAIN_PATH :=
else
$(error can not find compiler toolchain, please install gcc-arm-linux-gnueabihf toolchain first)
endif #SYSTEM_TOOLCHAIN_PATH
Expand Down
2 changes: 1 addition & 1 deletion build/aos_toolchain_xtensa.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ endif #WIN32

ifeq (,$(TOOLCHAIN_PATH))
ifneq (,$(SYSTEM_TOOLCHAIN_PATH))
TOOLCHAIN_PATH := $(SYSTEM_TOOLCHAIN_PATH)
TOOLCHAIN_PATH :=
else
DOWNLOAD_URL = "https://esp-idf.readthedocs.io/en/latest/get-started/index.html\#setup-toolchain"
$(error can not find compiler toolchain, please setup toolchain as $(DOWNLOAD_URL) instructed)
Expand Down
2 changes: 1 addition & 1 deletion build/autobuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mk3239_targets="bluetooth.ble_advertisements bluetooth.ble_show_system_time"
mk3239_platforms=""
pca10056_targets="bluetooth.bleperipheral bluetooth.aisilopapp"
pca10056_platforms="pca10056"
eml3047_targets="lorawan.lorawanapp lorawan.linklora"
eml3047_targets="lorawan.linkwan"
eml3047_platforms="eml3047"
csky_targets="helloworld coapapp"
csky_platforms=""
Expand Down
1 change: 0 additions & 1 deletion device/lora/sx1276/sx1276.c
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,6 @@ void SX1276OnDio0Irq( void )
if( ( RadioEvents != NULL ) && ( RadioEvents->TxDone != NULL ) )
{
RadioEvents->TxDone( );
PRINTF("txDone\r\n");
}
break;
}
Expand Down
2 changes: 2 additions & 0 deletions example/linkkitapp/linkkit-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static int linkkit_started = 0;
static int awss_running = 0;

void reboot_system(void *parms);
int awss_success_notify();
static void wifi_service_event(input_event_t *event, void *priv_data) {
if (event->type != EV_WIFI) {
return;
Expand All @@ -64,6 +65,7 @@ static void wifi_service_event(input_event_t *event, void *priv_data) {
}
if (!linkkit_started) {
linkkit_app();
awss_success_notify();
linkkit_started = 1;
}
}
Expand Down
75 changes: 0 additions & 75 deletions example/lorawan/linklora/linklora.c

This file was deleted.

65 changes: 65 additions & 0 deletions example/lorawan/linkwan/linkwan.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
*/

#include "hw.h"
#include "low_power.h"
#include "linkwan.h"
#include "timeServer.h"
#include "version.h"
#include "radio.h"
#include "sx1276Regs-Fsk.h"
#include "sx1276Regs-LoRa.h"
#include "delay.h"

#include "LoRaMac.h"
#include "Region.h"
#include "commissioning.h"

#include <k_api.h>

static void LoraTxData(lora_AppData_t *AppData);
static void LoraRxData(lora_AppData_t *AppData);

static LoRaMainCallback_t LoRaMainCallbacks = {
HW_GetBatteryLevel,
HW_GetUniqueId,
HW_GetRandomSeed,
LoraTxData,
LoraRxData
};

static void lora_task_entry(void *arg)
{
lora_init(&LoRaMainCallbacks);
lora_fsm();
}

ktask_t g_lora_task;
cpu_stack_t g_lora_task_stack[512];
int application_start( void )
{
krhino_task_create(&g_lora_task, "lora_task", NULL,
5, 0u, g_lora_task_stack,
512, lora_task_entry, 1u);
}

static void LoraTxData(lora_AppData_t *AppData)
{
uint8_t index = 0;

if (AppData->BuffSize < 1) {
AppData->BuffSize = 1;
}

for (index = 0; index < AppData->BuffSize; index++) {
AppData->Buff[index] = '0' + index;
}
DBG_LINKWAN("tx, port %d, size %d\r\n", AppData->Port, AppData->BuffSize);
AppData->Port = LORAWAN_APP_PORT;
}

static void LoraRxData(lora_AppData_t *AppData)
{
DBG_LINKWAN( "rx, port %d, size %d\r\n", AppData->Port, AppData->BuffSize);
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
NAME := linklora
NAME := linkwan

GLOBAL_INCLUDES += .

GLOBAL_DEFINES += USE_FULL_LL_DRIVER
GLOBAL_DEFINES += USE_B_EML3047
GLOBAL_DEFINES += REGION_CN470S
GLOBAL_DEFINES += REGION_CN470A

linklora := 1
ifeq ($(linkloratest), 1)
linkwan := 1
ifeq ($(linkwantest), 1)
GLOBAL_DEFINES += LOW_POWER_DISABLE
endif

$(NAME)_SOURCES := linklora.c \
$(NAME)_SOURCES := linkwan.c \

$(NAME)_COMPONENTS := protocols.lorawan \

Expand Down
Loading

0 comments on commit 1d6ebe4

Please sign in to comment.