forked from xuos/xiuos
merge codes
This commit is contained in:
commit
f13343bf0f
|
@ -11,8 +11,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file pm1_0_ps5308.c
|
||||
* @brief PS5308 PM1.0 example
|
||||
* @filepm10_0_ps5308
|
||||
* @brief PS5308 PM10.0 example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.23
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file pm1_0_ps5308.c
|
||||
* @brief PS5308 PM1.0 example
|
||||
* @file pm2_5_ps5308
|
||||
* @brief PS5308 PM2.5 example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.23
|
||||
* @date 2021.12.28
|
||||
*/
|
||||
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
|
|
|
@ -34,7 +34,7 @@ int AdapterFrameworkInit(void)
|
|||
AppInitDoubleList(&adapter_list);
|
||||
|
||||
ret = PrivMutexCreate(&adapter_list_lock, 0);
|
||||
if(ret < 0) {
|
||||
if(ret != 0) {
|
||||
printf("AdapterFrameworkInit mutex create failed.\n");
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,16 @@ AdapterType AdapterDeviceFindByName(const char *name)
|
|||
{
|
||||
struct Adapter *ret = NULL;
|
||||
struct DoublelistNode *node;
|
||||
int status = 0;
|
||||
|
||||
if (NULL == name)
|
||||
return NULL;
|
||||
|
||||
PrivMutexObtain(&adapter_list_lock);
|
||||
status = PrivMutexObtain(&adapter_list_lock);
|
||||
if (status != 0){
|
||||
printf("%s:pthread_mutex_lock failed, status=%d\n",__func__,status);
|
||||
}
|
||||
|
||||
DOUBLE_LIST_FOR_EACH(node, &adapter_list) {
|
||||
struct Adapter *adapter = CONTAINER_OF(node,
|
||||
struct Adapter, link);
|
||||
|
@ -64,7 +69,11 @@ AdapterType AdapterDeviceFindByName(const char *name)
|
|||
}
|
||||
printf("PrivMutexObtain in loop\n");
|
||||
}
|
||||
PrivMutexAbandon(&adapter_list_lock);
|
||||
|
||||
status = PrivMutexAbandon(&adapter_list_lock);
|
||||
if (status != 0){
|
||||
printf("%s:pthread_mutex_unlock failed, status=%d\n",__func__,status);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -76,6 +85,7 @@ AdapterType AdapterDeviceFindByName(const char *name)
|
|||
*/
|
||||
int AdapterDeviceRegister(struct Adapter *adapter)
|
||||
{
|
||||
int status = 0;
|
||||
if (NULL == adapter )
|
||||
return -1;
|
||||
|
||||
|
@ -84,9 +94,17 @@ int AdapterDeviceRegister(struct Adapter *adapter)
|
|||
return -1;
|
||||
}
|
||||
|
||||
PrivMutexObtain(&adapter_list_lock);
|
||||
status = PrivMutexObtain(&adapter_list_lock);
|
||||
if (status != 0){
|
||||
printf("%s:pthread_mutex_lock failed, status=%d\n",__func__,status);
|
||||
}
|
||||
|
||||
AppDoubleListInsertNodeAfter(&adapter_list, &adapter->link);
|
||||
PrivMutexAbandon(&adapter_list_lock);
|
||||
|
||||
status = PrivMutexAbandon(&adapter_list_lock);
|
||||
if (status != 0){
|
||||
printf("%s:pthread_mutex_unlock failed, status=%d\n",__func__,status);
|
||||
}
|
||||
|
||||
adapter->adapter_status = REGISTERED;
|
||||
|
||||
|
@ -100,11 +118,20 @@ int AdapterDeviceRegister(struct Adapter *adapter)
|
|||
*/
|
||||
int AdapterDeviceUnregister(struct Adapter *adapter)
|
||||
{
|
||||
int status = 0;
|
||||
if (!adapter)
|
||||
return -1;
|
||||
PrivMutexObtain(&adapter_list_lock);
|
||||
status = PrivMutexObtain(&adapter_list_lock);
|
||||
if (status != 0){
|
||||
printf("%s:pthread_mutex_lock failed, status=%d\n",__func__,status);
|
||||
}
|
||||
|
||||
AppDoubleListRmNode(&adapter->link);
|
||||
PrivMutexAbandon(&adapter_list_lock);
|
||||
|
||||
status = PrivMutexAbandon(&adapter_list_lock);
|
||||
if (status != 0){
|
||||
printf("%s:pthread_mutex_unlock failed, status=%d\n",__func__,status);
|
||||
}
|
||||
|
||||
adapter->adapter_status = UNREGISTERED;
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
############################################################################
|
||||
# APP_Framework/Framework/connection/lora/Make.defs
|
||||
############################################################################
|
||||
ifneq ($(CONFIG_ADAPTER_SX1278),)
|
||||
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/connection/lora
|
||||
endif
|
||||
include $(wildcard $(APPDIR)/../../../APP_Framework/Framework/connection/lora/*/Make.defs)
|
|
@ -1,7 +1,16 @@
|
|||
SRC_FILES := adapter_lora.c
|
||||
include $(KERNEL_ROOT)/.config
|
||||
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
|
||||
include $(APPDIR)/Make.defs
|
||||
CSRCS += adapter_lora.c
|
||||
include $(APPDIR)/Application.mk
|
||||
|
||||
ifeq ($(CONFIG_ADAPTER_SX1278),y)
|
||||
SRC_DIR += sx1278
|
||||
endif
|
||||
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
|
||||
SRC_FILES := adapter_lora.c
|
||||
ifeq ($(CONFIG_ADAPTER_SX1278),y)
|
||||
SRC_DIR += sx1278
|
||||
endif
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
|
||||
endif
|
||||
|
|
|
@ -27,6 +27,7 @@ extern AdapterProductInfoType Sx1278Attach(struct Adapter *adapter);
|
|||
#define ADAPTER_LORA_NAME "lora"
|
||||
#define ADAPTER_LORA_CLIENT_NUM 6
|
||||
#define ADAPTER_LORA_DATA_LENGTH 128
|
||||
#define ADAPTER_LORA_RECV_DATA_LENGTH 256
|
||||
|
||||
#define ADAPTER_LORA_DATA_HEAD 0x3C
|
||||
#define ADAPTER_LORA_NET_PANID 0x0102
|
||||
|
@ -96,12 +97,13 @@ struct LoraClientParam
|
|||
struct LoraDataFormat
|
||||
{
|
||||
uint8 flame_head;
|
||||
uint8 reserved[3];
|
||||
uint32 length;
|
||||
uint16 panid;
|
||||
uint8 client_id;
|
||||
uint8 gateway_id;
|
||||
|
||||
uint8 data_type;
|
||||
uint16 data_type;
|
||||
uint8 data[ADAPTER_LORA_DATA_LENGTH];
|
||||
|
||||
uint16 crc16;
|
||||
|
@ -150,6 +152,35 @@ static int LoraCrc16Check(uint8 *data, uint16 length)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Lora receive data check
|
||||
* @param data receive data buffer
|
||||
* @param length receive data length
|
||||
* @param recv_data LoraDataFormat data
|
||||
*/
|
||||
static int LoraReceiveDataCheck(uint8 *data, uint16 length, struct LoraDataFormat *recv_data)
|
||||
{
|
||||
int i;
|
||||
uint32 recv_data_length = 0;
|
||||
for ( i = 0; i < length; i ++) {
|
||||
if (ADAPTER_LORA_DATA_HEAD == data[i]) {
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
/*Big-Endian*/
|
||||
recv_data_length = (data[i + 4] & 0xFF) | ((data[i + 5] & 0xFF) << 8) | ((data[i + 6] & 0xFF) << 16) | ((data[i + 7] & 0xFF) << 24);
|
||||
#else
|
||||
/*Little-Endian*/
|
||||
recv_data_length = ((data[i + 4] & 0xFF) << 24) | ((data[i + 5] & 0xFF) << 16) | ((data[i + 6] & 0xFF) << 8) | (data[i + 7] & 0xFF);
|
||||
#endif
|
||||
if (sizeof(struct LoraDataFormat) == recv_data_length) {
|
||||
memcpy(recv_data, (uint8 *)(data + i), sizeof(struct LoraDataFormat));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Lora Gateway reply connect request to Client
|
||||
* @param adapter Lora adapter pointer
|
||||
|
@ -338,6 +369,10 @@ static int LoraClientSendData(struct Adapter *adapter, void *send_buf, int lengt
|
|||
static int LoraGateWayDataAnalyze(struct Adapter *adapter, struct LoraDataFormat *gateway_recv_data)
|
||||
{
|
||||
int ret = 0;
|
||||
printf("%s:gateway_recv_data\n",__func__);
|
||||
printf("head 0x%x length %d panid 0x%x data_type 0x%x client_id 0x%x gateway_id 0x%x crc 0x%x\n",
|
||||
gateway_recv_data->flame_head, gateway_recv_data->length, gateway_recv_data->panid, gateway_recv_data->data_type,
|
||||
gateway_recv_data->client_id, gateway_recv_data->gateway_id, gateway_recv_data->crc16);
|
||||
|
||||
if (LoraCrc16Check((uint8 *)gateway_recv_data, sizeof(struct LoraDataFormat)) < 0) {
|
||||
printf("LoraGateWayDataAnalyze CRC check error\n");
|
||||
|
@ -372,19 +407,22 @@ static int LoraGateWayDataAnalyze(struct Adapter *adapter, struct LoraDataFormat
|
|||
static int LoraClientDataAnalyze(struct Adapter *adapter, void *send_buf, int length)
|
||||
{
|
||||
int ret = 0;
|
||||
uint8 lora_recv_data[ADAPTER_LORA_RECV_DATA_LENGTH] = {0};
|
||||
|
||||
struct LoraDataFormat *client_recv_data = PrivMalloc(sizeof(struct LoraDataFormat));
|
||||
|
||||
memset(client_recv_data, 0, sizeof(struct LoraDataFormat));
|
||||
|
||||
ret = AdapterDeviceRecv(adapter, client_recv_data, sizeof(struct LoraDataFormat));
|
||||
if (0 == ret) {
|
||||
ret = AdapterDeviceRecv(adapter, lora_recv_data, ADAPTER_LORA_RECV_DATA_LENGTH);
|
||||
if (ret <= 0) {
|
||||
printf("LoraClientDataAnalyze recv error.Just return\n");
|
||||
PrivFree(client_recv_data);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("client_recv_data\n");
|
||||
LoraReceiveDataCheck(lora_recv_data, ADAPTER_LORA_RECV_DATA_LENGTH, client_recv_data);
|
||||
|
||||
printf("%s:client_recv_data\n",__func__);
|
||||
printf("head 0x%x length %d panid 0x%x data_type 0x%x client_id 0x%x gateway_id 0x%x crc 0x%x\n",
|
||||
client_recv_data->flame_head, client_recv_data->length, client_recv_data->panid, client_recv_data->data_type,
|
||||
client_recv_data->client_id, client_recv_data->gateway_id, client_recv_data->crc16);
|
||||
|
@ -437,6 +475,11 @@ static int LoraClientJoinNet(struct Adapter *adapter, unsigned short panid)
|
|||
client_join_data.data_type = ADAPTER_LORA_DATA_TYPE_JOIN;
|
||||
client_join_data.client_id = adapter->net_role_id;
|
||||
client_join_data.crc16 = LoraCrc16((uint8 *)&client_join_data, sizeof(struct LoraDataFormat) - 2);
|
||||
|
||||
printf("%s:client_join_data\n",__func__);
|
||||
printf("head 0x%x length %d panid 0x%x data_type 0x%x client_id 0x%x gateway_id 0x%x crc 0x%x\n",
|
||||
client_join_data.flame_head, client_join_data.length, client_join_data.panid, client_join_data.data_type,
|
||||
client_join_data.client_id, client_join_data.gateway_id, client_join_data.crc16);
|
||||
|
||||
if (AdapterDeviceJoin(adapter, (uint8 *)&client_join_data) < 0) {
|
||||
return -1;
|
||||
|
@ -479,15 +522,20 @@ static int LoraClientQuitNet(struct Adapter *adapter, unsigned short panid)
|
|||
int LoraGatewayProcess(struct Adapter *lora_adapter, struct LoraGatewayParam *gateway, struct LoraDataFormat *gateway_recv_data)
|
||||
{
|
||||
int i, ret = 0;
|
||||
uint8 lora_recv_data[ADAPTER_LORA_RECV_DATA_LENGTH];
|
||||
switch (LoraGatewayState)
|
||||
{
|
||||
case LORA_STATE_IDLE:
|
||||
ret = AdapterDeviceRecv(lora_adapter, gateway_recv_data, sizeof(struct LoraDataFormat));
|
||||
if (0 == ret) {
|
||||
memset(lora_recv_data, 0, ADAPTER_LORA_RECV_DATA_LENGTH);
|
||||
|
||||
ret = AdapterDeviceRecv(lora_adapter, lora_recv_data, ADAPTER_LORA_RECV_DATA_LENGTH);
|
||||
if (ret <= 0) {
|
||||
printf("LoraGatewayProcess IDLE recv error.Just return\n");
|
||||
break;
|
||||
}
|
||||
|
||||
LoraReceiveDataCheck(lora_recv_data, ADAPTER_LORA_RECV_DATA_LENGTH, gateway_recv_data);
|
||||
|
||||
if (ADAPTER_LORA_DATA_TYPE_JOIN == gateway_recv_data->data_type) {
|
||||
LoraGatewayState = LORA_JOIN_NET;
|
||||
} else if (ADAPTER_LORA_DATA_TYPE_QUIT == gateway_recv_data->data_type) {
|
||||
|
@ -516,12 +564,15 @@ int LoraGatewayProcess(struct Adapter *lora_adapter, struct LoraGatewayParam *ga
|
|||
continue;
|
||||
}
|
||||
|
||||
ret = AdapterDeviceRecv(lora_adapter, gateway_recv_data, sizeof(struct LoraDataFormat));
|
||||
if (0 == ret) {
|
||||
memset(lora_recv_data, 0, ADAPTER_LORA_RECV_DATA_LENGTH);
|
||||
ret = AdapterDeviceRecv(lora_adapter, lora_recv_data, ADAPTER_LORA_RECV_DATA_LENGTH);
|
||||
if (ret <= 0) {
|
||||
printf("LoraGatewayProcess recv error.Just return\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
LoraReceiveDataCheck(lora_recv_data, ADAPTER_LORA_RECV_DATA_LENGTH, gateway_recv_data);
|
||||
|
||||
if (ADAPTER_LORA_DATA_TYPE_JOIN == gateway_recv_data->data_type) {
|
||||
LoraGatewayState = LORA_JOIN_NET;
|
||||
} else if (ADAPTER_LORA_DATA_TYPE_QUIT == gateway_recv_data->data_type) {
|
||||
|
@ -754,19 +805,30 @@ int AdapterLoraTest(void)
|
|||
|
||||
//create lora gateway task
|
||||
#ifdef AS_LORA_GATEWAY_ROLE
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
pthread_attr_t lora_gateway_attr = PTHREAD_ATTR_INITIALIZER;
|
||||
lora_gateway_attr.priority = 20;
|
||||
lora_gateway_attr.stacksize = 2048;
|
||||
#else
|
||||
pthread_attr_t lora_gateway_attr;
|
||||
lora_gateway_attr.schedparam.sched_priority = 20;
|
||||
lora_gateway_attr.stacksize = 2048;
|
||||
#endif
|
||||
|
||||
PrivTaskCreate(&lora_gateway_task, &lora_gateway_attr, &LoraGatewayTask, (void *)adapter);
|
||||
PrivTaskStartup(&lora_gateway_task);
|
||||
|
||||
#else //AS_LORA_CLIENT_ROLE
|
||||
//create lora client task
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
pthread_attr_t lora_client_attr = PTHREAD_ATTR_INITIALIZER;
|
||||
lora_client_attr.priority = 20;
|
||||
lora_client_attr.stacksize = 2048;
|
||||
#else
|
||||
pthread_attr_t lora_client_attr;
|
||||
lora_client_attr.schedparam.sched_priority = 20;
|
||||
lora_client_attr.stacksize = 2048;
|
||||
|
||||
#endif
|
||||
//create lora client task
|
||||
PrivTaskCreate(&lora_client_data_task, &lora_client_attr, &LoraClientDataTask, (void *)adapter);
|
||||
PrivTaskStartup(&lora_client_data_task);
|
||||
|
||||
|
@ -778,4 +840,7 @@ int AdapterLoraTest(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, AdapterLoraTest, AdapterLoraTest, show adapter lora information);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ if ADD_XIZI_FETURES
|
|||
endif
|
||||
|
||||
if ADD_NUTTX_FETURES
|
||||
config ADAPTER_SX1278_DRIVER
|
||||
string "SX1278 device spi driver path"
|
||||
default "/dev/spi2_lora"
|
||||
|
||||
endif
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
############################################################################
|
||||
# APP_Framework/Framework/connection/lora/sx1278/Make.defs
|
||||
############################################################################
|
||||
ifneq ($(CONFIG_ADAPTER_LORA_SX1278),)
|
||||
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/connection/lora/sx1278
|
||||
endif
|
|
@ -1,3 +1,13 @@
|
|||
SRC_FILES := sx1278.c
|
||||
include $(KERNEL_ROOT)/.config
|
||||
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
|
||||
include $(APPDIR)/Make.defs
|
||||
CSRCS += sx1278.c
|
||||
include $(APPDIR)/Application.mk
|
||||
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
|
||||
SRC_FILES := sx1278.c
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
|
||||
endif
|
||||
|
|
|
@ -20,6 +20,32 @@
|
|||
|
||||
#include <adapter.h>
|
||||
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
/**
|
||||
* @description: Sx127x_Nuttx_Write function for nuttx
|
||||
* @param fd - file descriptor to write to
|
||||
* @param buf - Data to write
|
||||
* @param buf - Length of data to write
|
||||
* @return On success, the number of bytes written are returned (zero indicates nothing was written). On error, -1 is returned.
|
||||
*/
|
||||
static int Sx127x_Nuttx_Write(int fd, const void *buf, size_t len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
unsigned char *buffer = (unsigned char*)PrivMalloc(256);
|
||||
if (!buffer)
|
||||
{
|
||||
printf("failed to allocate buffer\n");
|
||||
}
|
||||
memset(buffer, 0, 256);
|
||||
memcpy(buffer,(unsigned char *)buf,len);
|
||||
|
||||
ret = PrivWrite(fd, buffer, len);
|
||||
PrivFree(buffer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* @description: Open SX1278 spi function
|
||||
* @param adapter - Lora device pointer
|
||||
|
@ -47,9 +73,14 @@ static int Sx1278Open(struct Adapter *adapter)
|
|||
static int Sx1278Close(struct Adapter *adapter)
|
||||
{
|
||||
/*step1: close sx1278 spi port*/
|
||||
PrivClose(adapter->fd);
|
||||
int ret;
|
||||
ret = PrivClose(adapter->fd);
|
||||
if(ret < 0){
|
||||
printf("Sx1278 close failed: %d!\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ADAPTER_DEBUG("Sx1278Close done\n");
|
||||
ADAPTER_DEBUG("Sx1278 Close done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -73,13 +104,30 @@ static int Sx1278Ioctl(struct Adapter *adapter, int cmd, void *args)
|
|||
* @param priv_net_group - priv_net_group params
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
static int Sx1278Join(struct Adapter *adapter, unsigned char *priv_net_group)
|
||||
{
|
||||
int ret;
|
||||
ret = Sx127x_Nuttx_Write(adapter->fd, (void *)priv_net_group, 144);
|
||||
if(ret < 0){
|
||||
printf("Sx1278 Join net group failed: %d!\n", ret);
|
||||
}
|
||||
|
||||
PrivWrite(adapter->fd, (void *)priv_net_group, 144);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static int Sx1278Join(struct Adapter *adapter, unsigned char *priv_net_group)
|
||||
{
|
||||
int ret;
|
||||
ret = PrivWrite(adapter->fd, (void *)priv_net_group, 144);
|
||||
if(ret < 0){
|
||||
printf("Sx1278 Join net group failed: %d!\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @description: SX1278 send data function
|
||||
|
@ -88,11 +136,28 @@ static int Sx1278Join(struct Adapter *adapter, unsigned char *priv_net_group)
|
|||
* @param len - data len
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
static int Sx1278Send(struct Adapter *adapter, const void *buf, size_t len)
|
||||
{
|
||||
PrivWrite(adapter->fd, buf, len);
|
||||
return 0;
|
||||
int ret;
|
||||
ret = Sx127x_Nuttx_Write(adapter->fd, buf, len);
|
||||
if(ret < 0){
|
||||
printf("send failed %d!\n", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static int Sx1278Send(struct Adapter *adapter, const void *buf, size_t len)
|
||||
{
|
||||
int ret;
|
||||
ret = PrivWrite(adapter->fd, buf, len);
|
||||
if(ret < 0){
|
||||
printf("send failed %d!\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @description: SX1278 receive data function
|
||||
|
@ -101,10 +166,25 @@ static int Sx1278Send(struct Adapter *adapter, const void *buf, size_t len)
|
|||
* @param len - data len
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
static int Sx1278Recv(struct Adapter *adapter, void *buf, size_t len)
|
||||
{
|
||||
int ret;
|
||||
struct sx127x_read_hdr_s recv_data;
|
||||
ret = read(adapter->fd, &recv_data, sizeof(struct sx127x_read_hdr_s));
|
||||
if (ret <= 0){
|
||||
printf("Read failed %d!\n", ret);
|
||||
return ret;
|
||||
}
|
||||
memcpy((uint8 *)buf, (uint8 *)(&recv_data), len);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static int Sx1278Recv(struct Adapter *adapter, void *buf, size_t len)
|
||||
{
|
||||
return PrivRead(adapter->fd, buf, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @description: SX1278 quit lora net group function
|
||||
|
@ -112,12 +192,30 @@ static int Sx1278Recv(struct Adapter *adapter, void *buf, size_t len)
|
|||
* @param priv_net_group - priv_net_group params
|
||||
* @return success: 0, failure: -1
|
||||
*/
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
static int Sx1278Quit(struct Adapter *adapter, unsigned char *priv_net_group)
|
||||
{
|
||||
PrivWrite(adapter->fd, (void *)priv_net_group, 144);
|
||||
int ret;
|
||||
ret = Sx127x_Nuttx_Write(adapter->fd, (void *)priv_net_group, 144);
|
||||
if(ret < 0){
|
||||
printf("Sx1278 quit net group failed %d!\n", ret);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static int Sx1278Quit(struct Adapter *adapter, unsigned char *priv_net_group)
|
||||
{
|
||||
int ret;
|
||||
ret = PrivWrite(adapter->fd, (void *)priv_net_group, 144);
|
||||
if(ret < 0){
|
||||
printf("Sx1278 quit net group failed %d!\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static const struct PrivProtocolDone sx1278_done =
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file xiuos.c
|
||||
* @file transform.c
|
||||
* @brief Converts the framework interface to an operating system interface
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <nuttx/time.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/wireless/lpwan/sx127x.h>
|
||||
|
||||
typedef uint8_t uint8;
|
||||
typedef uint16_t uint16;
|
||||
|
@ -108,7 +109,7 @@ struct PinDevIrq
|
|||
struct PinParam
|
||||
{
|
||||
int cmd;//< cmd:GPIO_CONFIG_MODE/GPIO_IRQ_REGISTER/GPIO_IRQ_FREE/GPIO_IRQ_DISABLE/GPIO_IRQ_ENABLE
|
||||
long pin;//< pin number
|
||||
long pin;//< pin number
|
||||
int mode;//< pin mode: input/output
|
||||
struct PinDevIrq irq_set;//< pin irq set
|
||||
uint64 arg;
|
||||
|
@ -171,6 +172,9 @@ int PrivMutexDelete(pthread_mutex_t *p_mutex);
|
|||
int PrivMutexObtain(pthread_mutex_t *p_mutex);
|
||||
int PrivMutexAbandon(pthread_mutex_t *p_mutex);
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************semaphore**********************/
|
||||
|
||||
int PrivSemaphoreCreate(sem_t *sem, int pshared, unsigned int value);
|
||||
|
|
|
@ -73,14 +73,14 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
|
|||
CONFIG_STM32_OTGFS=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI2=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_ADBD=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_SYMTAB=y
|
||||
CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME="g_symtab"
|
||||
CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME="g_nsymbols"
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USBADB=y
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_USERMAIN_STACKSIZE=3072
|
||||
|
|
|
@ -67,13 +67,13 @@ CONFIG_STM32_PWR=y
|
|||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_SPI3=y
|
||||
CONFIG_STM32_SPI_DMA=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_STM32_USBHOST=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NXPLAYER=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USBHOST_ISOC_DISABLE=y
|
||||
CONFIG_USBHOST_MSC=y
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -48,10 +48,10 @@ CONFIG_STM32_CAN1_BAUD=500000
|
|||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_TIME64=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -35,11 +35,11 @@ CONFIG_START_DAY=2
|
|||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2012
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_TESTING_CXXTEST=y
|
||||
CONFIG_UCLIBCXX=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="cxxtest_main"
|
||||
|
|
|
@ -41,8 +41,8 @@ CONFIG_START_DAY=26
|
|||
CONFIG_START_MONTH=10
|
||||
CONFIG_START_YEAR=2012
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USERMAIN_STACKSIZE=4096
|
||||
CONFIG_USER_ENTRYPOINT="elf_main"
|
||||
|
|
|
@ -38,13 +38,14 @@ CONFIG_START_DAY=22
|
|||
CONFIG_START_MONTH=3
|
||||
CONFIG_START_YEAR=2013
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_SPI2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYS_RESERVED=9
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TESTING_OSTEST_NBARRIER_THREADS=3
|
||||
CONFIG_TESTING_OSTEST_STACKSIZE=2048
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="ostest_main"
|
||||
|
|
|
@ -50,9 +50,9 @@ CONFIG_STM32_I2C1=y
|
|||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -48,9 +48,9 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
|
|||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_SPI2=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -78,9 +78,9 @@ CONFIG_START_MONTH=4
|
|||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -65,10 +65,10 @@ CONFIG_STM32_DMA2=y
|
|||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI2=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -54,12 +54,12 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
|
|||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART1_BAUD=38400
|
||||
CONFIG_USART1_PARITY=2
|
||||
CONFIG_USART1_RS485=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -47,9 +47,9 @@ CONFIG_START_YEAR=2011
|
|||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -45,10 +45,10 @@ CONFIG_START_MONTH=12
|
|||
CONFIG_START_YEAR=2011
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_SPI2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -66,9 +66,9 @@ CONFIG_STM32_FSMC=y
|
|||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nxlines_main"
|
||||
|
|
|
@ -49,9 +49,9 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
|
|||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_RTC=y
|
||||
CONFIG_STM32_TIM1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -43,9 +43,9 @@ CONFIG_START_DAY=26
|
|||
CONFIG_START_MONTH=10
|
||||
CONFIG_START_YEAR=2012
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="posix_spawn_main"
|
||||
|
|
|
@ -46,10 +46,10 @@ CONFIG_START_YEAR=2011
|
|||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_STM32_USART3=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -57,9 +57,9 @@ CONFIG_STM32_TIM3=y
|
|||
CONFIG_STM32_TIM3_CH3OUT=y
|
||||
CONFIG_STM32_TIM3_CHANNEL=3
|
||||
CONFIG_STM32_TIM3_PWM=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="rgbled_main"
|
||||
|
|
|
@ -88,14 +88,14 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
|
|||
CONFIG_STM32_OTGFS=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_SYMTAB=y
|
||||
CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME="g_symtab"
|
||||
CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME="g_nsymbols"
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_USERMAIN_STACKSIZE=3072
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -59,10 +59,10 @@ CONFIG_START_YEAR=2011
|
|||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
CONFIG_VIDEO_FB=y
|
||||
|
|
|
@ -44,10 +44,10 @@ CONFIG_START_DAY=2
|
|||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2012
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -47,14 +47,14 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
|
|||
CONFIG_STM32_OTGFS=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSLOG_CHAR=y
|
||||
CONFIG_SYSLOG_DEVPATH="/dev/ttyS0"
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_USBMSC=y
|
||||
CONFIG_SYSTEM_USBMSC_DEVPATH1="/dev/ram0"
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_USBMSC=y
|
||||
CONFIG_USBMSC_REMOVABLE=y
|
||||
|
|
|
@ -54,7 +54,7 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
|
|||
CONFIG_STM32_OTGFS=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -92,7 +92,7 @@ CONFIG_STM32_SPI2_DMA=y
|
|||
CONFIG_STM32_SPI3=y
|
||||
CONFIG_STM32_SPI3_DMA=y
|
||||
CONFIG_STM32_SPI_DMA=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
|
@ -102,9 +102,9 @@ CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME="g_nsymbols"
|
|||
CONFIG_SYSTEM_NTPC=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TESTING_OSTEST_FPUSIZE=132
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
CONFIG_WIRELESS_GS2200M=y
|
||||
CONFIG_WL_GS2200M=y
|
||||
|
|
|
@ -32,13 +32,13 @@ CONFIG_START_DAY=21
|
|||
CONFIG_START_MONTH=9
|
||||
CONFIG_START_YEAR=2009
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TESTING_OSTEST_NBARRIER_THREADS=3
|
||||
CONFIG_TESTING_OSTEST_STACKSIZE=2048
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="ostest_main"
|
||||
CONFIG_WINDOWS_NATIVE=y
|
||||
|
|
|
@ -50,9 +50,9 @@ CONFIG_STM32_SPI1=y
|
|||
CONFIG_STM32_TIM1=y
|
||||
CONFIG_STM32_TIM1_CH1OUT=y
|
||||
CONFIG_STM32_TIM1_PWM=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_USART2_RXBUFSIZE=128
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART2_TXBUFSIZE=128
|
||||
CONFIG_USART1_RXBUFSIZE=128
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=128
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file board.h
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32_STM32F4AIIT_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_STM32_STM32F4AIIT_INCLUDE_BOARD_H
|
||||
|
||||
|
@ -336,7 +345,7 @@
|
|||
#define DMACHAN_SPI1_RX DMAMAP_SPI1_RX_1
|
||||
#define DMACHAN_SPI1_TX DMAMAP_SPI1_TX_1
|
||||
|
||||
/* SPI2 - Test MAX31855 on SPI2 PB10 = SCK, PB14 = MISO */
|
||||
/* SPI2 - Test sx127x on SPI2 PB13 = SCK, PC2 = MISO PC3 MOSI*/
|
||||
|
||||
#define GPIO_SPI2_MISO GPIO_SPI2_MISO_2
|
||||
#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_2
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_userspace.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file aiit-arm32-board.h
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32_STM32F4AIIT_SRC_STM32F4AIIT_H
|
||||
#define __BOARDS_ARM_STM32_STM32F4AIIT_SRC_STM32F4AIIT_H
|
||||
|
||||
|
@ -229,10 +238,9 @@
|
|||
|
||||
/* LoRa SX127x */
|
||||
|
||||
#define GPIO_SX127X_DIO0 (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTD|GPIO_PIN0)
|
||||
#define GPIO_SX127X_DIO0 (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTC|GPIO_PIN1)
|
||||
|
||||
#define GPIO_SX127X_RESET (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_OUTPUT_CLEAR|\
|
||||
GPIO_SPEED_50MHz|GPIO_PORTD|GPIO_PIN4)
|
||||
#define GPIO_SX127X_RESET (GPIO_PORTF|GPIO_PIN11)
|
||||
|
||||
/* PWM
|
||||
*
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_appinit.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_autoleds.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_boot.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_bringup.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_buttons.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_can.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_critmon.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_cs43l22.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_ds1307.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_enc28j60.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/* 2MBit SPI FLASH OR ENC28J60
|
||||
*
|
||||
* -- ---- ------------ -----------------------------------------------------
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_ethernet.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_extmem.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_gs2200m.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_hciuart.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_idle.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_max7219.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_max7219_leds.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_mmcsd.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_netinit.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_ostest.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_pca9635.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_pm.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_pmbuttons.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_pwm.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_reset.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_rgbled.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -33,6 +33,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_romfs.h
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32_STM32F4AIIT_SRC_STM32_ROMFS_H
|
||||
#define __BOARDS_ARM_STM32_STM32F4AIIT_SRC_STM32_ROMFS_H
|
||||
|
||||
|
|
|
@ -34,6 +34,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_romfs_initialize.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_sdio.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -17,6 +17,14 @@
|
|||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
/**
|
||||
* @file stm32_spi.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
|
@ -71,6 +79,7 @@ void weak_function stm32_spidev_initialize(void)
|
|||
stm32_configgpio(GPIO_MAX7219_CS); /* MAX7219 chip select */
|
||||
#endif
|
||||
#ifdef CONFIG_LPWAN_SX127X
|
||||
spiinfo("Configure GPIO for SX127X SPI2/CS\n");
|
||||
stm32_configgpio(GPIO_SX127X_CS); /* SX127x chip select */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_ssd1289.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,16 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_ssd1351.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_st7032.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_st7567.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_st7789.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_sx127x.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
@ -103,7 +112,7 @@ static void sx127x_chip_reset(void)
|
|||
|
||||
/* Configure reset as output */
|
||||
|
||||
stm32_configgpio(GPIO_SX127X_RESET);
|
||||
stm32_configgpio(GPIO_SX127X_RESET | GPIO_OUTPUT | GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR);
|
||||
|
||||
/* Set pin to zero */
|
||||
|
||||
|
@ -143,7 +152,7 @@ static int sx127x_freq_select(uint32_t freq)
|
|||
|
||||
/* Only HF supported (BAND3 - 860-930 MHz) */
|
||||
|
||||
if (freq < SX127X_HFBAND_THR)
|
||||
if (freq > SX127X_HFBAND_THR)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
wlerr("LF band not supported\n");
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_timer.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_ug2864ambag01.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_ug2864hsweg01.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -33,6 +33,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_uid.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_usb.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_usbmsc.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_userleds.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file board.h
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
#ifndef __BOARDS_K210_AIIT_RISCV64_INCLUDE_BOARD_H
|
||||
#define __BOARDS_K210_AIIT_RISCV64_INCLUDE_BOARD_H
|
||||
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file k210_userspace.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,16 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* @file aiit-riscv64-board.h
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
#ifndef __AIIT_RISCV64_BOARDS_K210_H
|
||||
#define __AIIT_RISCV64_BOARDS_K210_H
|
||||
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file k210_appinit.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file k210_boot.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file k210_bringup.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file k210_gpio.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file k210_leds.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* boards/risc-v/k210/aiit-riscv64-board/src/c906_ostest.c
|
||||
* boards/risc-v/k210/aiit-riscv64-board/src/k210_ostest.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file k210_ostest.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -0,0 +1,608 @@
|
|||
/****************************************************************************
|
||||
* apps/examples/sx127x_demo/sx127x_demo.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file sx127x_demo.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx-apps
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <poll.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <nuttx/wireless/lpwan/sx127x.h>
|
||||
#include <nuttx/input/buttons.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADAPTER_SX1278_DRIVER
|
||||
# define DEV_NAME CONFIG_ADAPTER_SX1278_DRIVER
|
||||
#else
|
||||
# define DEV_NAME "/dev/sx127x"
|
||||
#endif
|
||||
|
||||
#define TX_BUFFER_MAX 255
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
enum app_mode_e
|
||||
{
|
||||
APP_MODE_RX = 0,
|
||||
APP_MODE_TX = 1,
|
||||
APP_MODE_RXTX = 2,
|
||||
APP_MODE_SCAN = 3
|
||||
};
|
||||
|
||||
enum app_modulation_e
|
||||
{
|
||||
APP_MODULATION_LORA = 0,
|
||||
APP_MODULATION_FSK = 1,
|
||||
APP_MODULATION_OOK = 2,
|
||||
};
|
||||
|
||||
/* Application arguments */
|
||||
|
||||
struct args_s
|
||||
{
|
||||
uint32_t frequency;
|
||||
int16_t interval;
|
||||
int16_t time;
|
||||
uint8_t app_mode;
|
||||
uint8_t modulation;
|
||||
uint8_t datalen;
|
||||
int8_t power;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
struct args_s g_args;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sx127x_help
|
||||
****************************************************************************/
|
||||
|
||||
static void sx127x_help(FAR struct args_s *args)
|
||||
{
|
||||
printf("Usage: sx127x [OPTIONS]\n\n");
|
||||
printf(" [-m modulation] modulation scheme (default=0)\n");
|
||||
printf(" 0 - LORA\n");
|
||||
printf(" 1 - FSK\n");
|
||||
printf(" 2 - OOK\n");
|
||||
printf(" [-f frequency Hz] RF frequency (default=%d)\n",
|
||||
CONFIG_EXAMPLES_SX127X_RFFREQ);
|
||||
printf(" [-i interval sec] radio access time interval (default=%d)\n",
|
||||
CONFIG_EXAMPLES_SX127X_INTERVAL);
|
||||
printf(" [-l datalen] data length for TX (default=%d)\n",
|
||||
CONFIG_EXAMPLES_SX127X_TXDATA);
|
||||
printf(" [-d time sec] demo time, 0 if infinity (default=%d)\n",
|
||||
CONFIG_EXAMPLES_SX127X_TIME);
|
||||
printf(" [-r/-t/-x/-s] select app mode (default=r)\n");
|
||||
printf(" r - RX\n");
|
||||
printf(" t - TX\n");
|
||||
printf(" x - RX/TX (not supported yet)\n");
|
||||
printf(" s - SCAN\n");
|
||||
printf(" [-p power dBm] TX power (default=%d)\n",
|
||||
CONFIG_EXAMPLES_SX127X_TXPOWER);
|
||||
printf(" [-h] print this message\n");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arg_string
|
||||
****************************************************************************/
|
||||
|
||||
static int arg_string(FAR char **arg, FAR char **value)
|
||||
{
|
||||
FAR char *ptr = *arg;
|
||||
|
||||
if (ptr[2] == '\0')
|
||||
{
|
||||
*value = arg[1];
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
*value = &ptr[2];
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arg_decimal
|
||||
****************************************************************************/
|
||||
|
||||
static int arg_decimal(FAR char **arg, FAR int *value)
|
||||
{
|
||||
FAR char *string;
|
||||
int ret;
|
||||
|
||||
ret = arg_string(arg, &string);
|
||||
*value = atoi(string);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: parse_args
|
||||
****************************************************************************/
|
||||
|
||||
static void parse_args(FAR struct args_s *args, int argc, FAR char **argv)
|
||||
{
|
||||
FAR char *ptr;
|
||||
int index;
|
||||
int nargs;
|
||||
int i_value;
|
||||
|
||||
for (index = 1; index < argc; )
|
||||
{
|
||||
ptr = argv[index];
|
||||
if (ptr[0] != '-')
|
||||
{
|
||||
printf("Invalid options format: %s\n", ptr);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
switch (ptr[1])
|
||||
{
|
||||
/* Interval between RX/TX operations */
|
||||
|
||||
case 'i':
|
||||
{
|
||||
nargs = arg_decimal(&argv[index], &i_value);
|
||||
index += nargs;
|
||||
|
||||
args->interval = i_value;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Demo time */
|
||||
|
||||
case 'd':
|
||||
{
|
||||
nargs = arg_decimal(&argv[index], &i_value);
|
||||
index += nargs;
|
||||
|
||||
args->time = i_value;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Data length for TX */
|
||||
|
||||
case 'l':
|
||||
{
|
||||
nargs = arg_decimal(&argv[index], &i_value);
|
||||
index += nargs;
|
||||
|
||||
args->datalen = i_value;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Modem RF frequency */
|
||||
|
||||
case 'f':
|
||||
{
|
||||
nargs = arg_decimal(&argv[index], &i_value);
|
||||
index += nargs;
|
||||
|
||||
args->frequency = i_value;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Modem modulation scheme */
|
||||
|
||||
case 'm':
|
||||
{
|
||||
nargs = arg_decimal(&argv[index], &i_value);
|
||||
index += nargs;
|
||||
|
||||
args->modulation = i_value;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Modem TX power */
|
||||
|
||||
case 'p':
|
||||
{
|
||||
nargs = arg_decimal(&argv[index], &i_value);
|
||||
index += nargs;
|
||||
|
||||
args->power = i_value;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* RX mode */
|
||||
|
||||
case 'r':
|
||||
{
|
||||
args->app_mode = APP_MODE_RX;
|
||||
index += 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* TX mode */
|
||||
|
||||
case 't':
|
||||
{
|
||||
args->app_mode = APP_MODE_TX;
|
||||
index += 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* RX-TX mode */
|
||||
|
||||
case 'x':
|
||||
{
|
||||
args->app_mode = APP_MODE_RXTX;
|
||||
index += 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Scan mode */
|
||||
|
||||
case 's':
|
||||
{
|
||||
args->app_mode = APP_MODE_SCAN;
|
||||
index += 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Print help message */
|
||||
|
||||
case 'h':
|
||||
{
|
||||
sx127x_help(args);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Unsupported option */
|
||||
|
||||
default:
|
||||
{
|
||||
printf("Unsupported option: %s\n", ptr);
|
||||
sx127x_help(args);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: validate_args
|
||||
****************************************************************************/
|
||||
|
||||
static int validate_args(FAR struct args_s *args)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
/* TODO */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: print_hex
|
||||
****************************************************************************/
|
||||
|
||||
static void print_hex(uint8_t *data, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
printf("empty buffer!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0 ; i < len ; i += 1)
|
||||
{
|
||||
printf("0x%02x ", data[i]);
|
||||
|
||||
if ((i + 1) % 10 == 0)
|
||||
{
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modulation_set
|
||||
****************************************************************************/
|
||||
|
||||
static int modulation_set(int fd, uint8_t modulation)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
switch (modulation)
|
||||
{
|
||||
case APP_MODULATION_LORA:
|
||||
{
|
||||
printf("LORA modulation\n");
|
||||
|
||||
modulation = SX127X_MODULATION_LORA;
|
||||
ret = ioctl(fd, SX127XIOC_MODULATIONSET,
|
||||
(unsigned long)&modulation);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("failed change modulation %d!\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case APP_MODULATION_FSK:
|
||||
{
|
||||
printf("FSK modulation\n");
|
||||
|
||||
modulation = SX127X_MODULATION_FSK;
|
||||
ret = ioctl(fd, SX127XIOC_MODULATIONSET,
|
||||
(unsigned long)&modulation);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("failed change modulation %d!\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case APP_MODULATION_OOK:
|
||||
{
|
||||
printf("OOK modulation\n");
|
||||
|
||||
modulation = SX127X_MODULATION_OOK;
|
||||
ret = ioctl(fd, SX127XIOC_MODULATIONSET,
|
||||
(unsigned long)&modulation);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("failed change modulation %d!\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
printf("Unsupported app modulation %d!\n", modulation);
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
errout:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
#ifdef CONFIG_LPWAN_SX127X_RXSUPPORT
|
||||
struct sx127x_read_hdr_s data;
|
||||
#endif
|
||||
struct sx127x_chanscan_ioc_s chanscan;
|
||||
struct args_s *args;
|
||||
struct timespec tstart;
|
||||
struct timespec tnow;
|
||||
uint8_t buffer[TX_BUFFER_MAX];
|
||||
uint8_t opmode;
|
||||
uint8_t i;
|
||||
int ret;
|
||||
int fd;
|
||||
|
||||
/* Initialize buffer with data */
|
||||
|
||||
for (i = 0; i < TX_BUFFER_MAX; i += 1)
|
||||
{
|
||||
buffer[i] = i;
|
||||
}
|
||||
|
||||
/* Initialize variables */
|
||||
|
||||
args = &g_args;
|
||||
args->app_mode = APP_MODE_RX;
|
||||
args->modulation = APP_MODULATION_LORA;
|
||||
args->frequency = CONFIG_EXAMPLES_SX127X_RFFREQ;
|
||||
args->power = CONFIG_EXAMPLES_SX127X_TXPOWER;
|
||||
args->interval = CONFIG_EXAMPLES_SX127X_INTERVAL;
|
||||
args->time = CONFIG_EXAMPLES_SX127X_TIME;
|
||||
args->datalen = CONFIG_EXAMPLES_SX127X_TXDATA;
|
||||
|
||||
/* Parse the command line */
|
||||
|
||||
parse_args(args, argc, argv);
|
||||
|
||||
/* Validate arguments */
|
||||
|
||||
ret = validate_args(args);
|
||||
if (ret != OK)
|
||||
{
|
||||
printf("sx127x_main: validate arguments failed!\n");
|
||||
goto errout;
|
||||
}
|
||||
|
||||
printf("Start sx127x_demo\n");
|
||||
|
||||
/* Open device */
|
||||
|
||||
fd = open(DEV_NAME, O_RDWR);
|
||||
if (fd < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
printf("ERROR: Failed to open device %s: %d\n", DEV_NAME, errcode);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Get start time */
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &tstart);
|
||||
|
||||
while (1)
|
||||
{
|
||||
switch (args->app_mode)
|
||||
{
|
||||
#ifdef CONFIG_LPWAN_SX127X_TXSUPPORT
|
||||
/* Transmit some data */
|
||||
|
||||
case APP_MODE_TX:
|
||||
{
|
||||
printf("\nSend %d bytes\n", args->datalen);
|
||||
|
||||
ret = write(fd, buffer, args->datalen);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("write failed %d!\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPWAN_SX127X_RXSUPPORT
|
||||
/* Receive data */
|
||||
|
||||
case APP_MODE_RX:
|
||||
{
|
||||
printf("Waiting for data\n");
|
||||
|
||||
ret = read(fd, &data, sizeof(struct sx127x_read_hdr_s));
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("Read failed %d!\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
printf("\nReceived:\n");
|
||||
printf("SNR = %d\n", data.snr);
|
||||
printf("RSSI = %d\n", data.rssi);
|
||||
printf("len = %d\n", data.datalen);
|
||||
print_hex(data.data, data.datalen);
|
||||
printf("\n");
|
||||
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Send some data and wait for response */
|
||||
|
||||
case APP_MODE_RXTX:
|
||||
{
|
||||
printf("TODO: APP RXTX\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Scan channel */
|
||||
|
||||
case APP_MODE_SCAN:
|
||||
{
|
||||
/* TODO: Configure this from command line */
|
||||
|
||||
chanscan.freq = args->frequency;
|
||||
chanscan.rssi_thr = -30;
|
||||
chanscan.stime = 2;
|
||||
chanscan.free = false;
|
||||
chanscan.rssi_max = 0;
|
||||
|
||||
ret = ioctl(fd, SX127XIOC_CHANSCAN, (unsigned long)&chanscan);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("failed chanscan %d!\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
printf("freq = %" PRId32 " max = %d min = %d free = %d\n",
|
||||
chanscan.freq,
|
||||
chanscan.rssi_max, chanscan.rssi_min, chanscan.free);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
printf("Unsupported app mode!\n");
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
printf("wait %d sec ...\n", args->interval);
|
||||
sleep(args->interval);
|
||||
|
||||
if (args->time > 0)
|
||||
{
|
||||
/* Get time now */
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &tnow);
|
||||
|
||||
if (tnow.tv_sec - tstart.tv_sec >= args->time)
|
||||
{
|
||||
printf("Timeout - force exit!\n");
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
errout:
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file nsh.h
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx-apps
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
#ifndef __APPS_NSHLIB_NSH_H
|
||||
#define __APPS_NSHLIB_NSH_H
|
||||
|
||||
|
|
|
@ -1,37 +1,22 @@
|
|||
/****************************************************************************
|
||||
* apps/nshlib/nsh_Applicationscmd.c
|
||||
*
|
||||
* Copyright (C) 2016 Alan Carvalho de Assis. All rights reserved.
|
||||
* Author: Alan Carvalho de Assis <acassis@gmail.com>
|
||||
*
|
||||
* 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 NuttX 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file nsh_Applicationscmd.c
|
||||
* @brief nsh cmd function support
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022.03.17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file nsh_command.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx-apps
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file stm32_serial.c
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file riscv_internal.h
|
||||
* @brief nuttx source code
|
||||
* https://github.com/apache/incubator-nuttx.git
|
||||
* @version 10.2.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_RISCV_SRC_COMMON_UP_INTERNAL_H
|
||||
#define __ARCH_RISCV_SRC_COMMON_UP_INTERNAL_H
|
||||
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apu.c
|
||||
* @brief kendryte k210 source code
|
||||
* https://github.com/kendryte/kendryte-standalone-sdk.git
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-03-17
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue