forked from xuos/xiuos
fix two big : fix aiit_board spi_lora bug;fix sensor/voice Kconfig bug
it is OK
This commit is contained in:
commit
869e69097f
|
@ -9,7 +9,7 @@ config SENSOR_D124
|
||||||
default "d124_1"
|
default "d124_1"
|
||||||
|
|
||||||
config SENSOR_QUANTITY_D124_VOICE
|
config SENSOR_QUANTITY_D124_VOICE
|
||||||
string "D124 quantity PM1.0 name"
|
string "D124 quantity voice name"
|
||||||
default "voice_1"
|
default "voice_1"
|
||||||
|
|
||||||
if ADD_XIUOS_FETURES
|
if ADD_XIUOS_FETURES
|
||||||
|
|
|
@ -1,31 +1,22 @@
|
||||||
/*
|
/*
|
||||||
* Original Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2020 AIIT XUOS Lab
|
||||||
* Modified 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.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
* you may not use this file except in compliance with the License.
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
* You may obtain a copy of the License at
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
/**
|
||||||
|
* @file connect_lora_spi.c
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* @brief support to register spi lora pointer and function
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* @version 1.0
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* @author AIIT XUOS Lab
|
||||||
* See the License for the specific language governing permissions and
|
* @date 2021-05-17
|
||||||
* limitations under the License.
|
*/
|
||||||
*
|
|
||||||
* Change Logs:
|
|
||||||
* Date Author Notes
|
|
||||||
* 2019-02-20 XiaojieFan the first version
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Modified by: AIIT XUOS Lab
|
|
||||||
* Modified date: 2020-09-01
|
|
||||||
* Description: replace original macro and basic date type with AIIT XUOS Lab's own defination
|
|
||||||
* start using AIIT XUOS Lab's own functional interfaces
|
|
||||||
* change some header files
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <connect_spi_lora.h>
|
#include <connect_spi_lora.h>
|
||||||
|
|
||||||
|
@ -319,6 +310,11 @@ static uint32 SpiLoraOpen(void *dev)
|
||||||
KPrintf("SpiLoraOpen start\n");
|
KPrintf("SpiLoraOpen start\n");
|
||||||
|
|
||||||
x_err_t ret = EOK;
|
x_err_t ret = EOK;
|
||||||
|
static x_bool lora_init_status = RET_FALSE;
|
||||||
|
|
||||||
|
if (RET_TRUE == lora_init_status) {
|
||||||
|
return EOK;
|
||||||
|
}
|
||||||
|
|
||||||
struct HardwareDev *haldev = (struct HardwareDev *)dev;
|
struct HardwareDev *haldev = (struct HardwareDev *)dev;
|
||||||
|
|
||||||
|
@ -361,13 +357,22 @@ static uint32 SpiLoraOpen(void *dev)
|
||||||
KPrintf("LoRa check ok!\nNote: The length of the message that can be sent in a single time is 120 characters\n");
|
KPrintf("LoRa check ok!\nNote: The length of the message that can be sent in a single time is 120 characters\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lora_init_status = RET_TRUE;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32 SpiLoraClose(void *dev)
|
||||||
|
{
|
||||||
|
NULL_PARAM_CHECK(dev);
|
||||||
|
|
||||||
|
return EOK;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct LoraDevDone lora_done =
|
static const struct LoraDevDone lora_done =
|
||||||
{
|
{
|
||||||
.open = SpiLoraOpen,
|
.open = SpiLoraOpen,
|
||||||
.close = NONE,
|
.close = SpiLoraClose,
|
||||||
.write = SpiLoraWrite,
|
.write = SpiLoraWrite,
|
||||||
.read = SpiLoraRead,
|
.read = SpiLoraRead,
|
||||||
};
|
};
|
||||||
|
@ -475,7 +480,7 @@ int LoraSx12xxSpiDeviceInit(void)
|
||||||
return EOK;
|
return EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LORA_TEST
|
||||||
/*Just for lora test*/
|
/*Just for lora test*/
|
||||||
static struct Bus *bus;
|
static struct Bus *bus;
|
||||||
static struct HardwareDev *dev;
|
static struct HardwareDev *dev;
|
||||||
|
@ -540,4 +545,4 @@ static void LoraSend(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
|
||||||
LoraSend, LoraSend, lora send message );
|
LoraSend, LoraSend, lora send message );
|
||||||
|
#endif
|
||||||
|
|
|
@ -62,7 +62,6 @@ void SX1276Init( void )
|
||||||
SX1276Reset( );
|
SX1276Reset( );
|
||||||
|
|
||||||
SX1276Read(0x06, &TempReg);
|
SX1276Read(0x06, &TempReg);
|
||||||
KPrintf("SX1276 Read 0x%x\n", &TempReg);
|
|
||||||
|
|
||||||
if(TempReg != 0x6C)
|
if(TempReg != 0x6C)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,31 +1,22 @@
|
||||||
/*
|
/*
|
||||||
* Original Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2020 AIIT XUOS Lab
|
||||||
* Modified 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.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
* you may not use this file except in compliance with the License.
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
* You may obtain a copy of the License at
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
/**
|
||||||
|
* @file connect_lora_spi.c
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* @brief support to register spi lora pointer and function
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* @version 1.0
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* @author AIIT XUOS Lab
|
||||||
* See the License for the specific language governing permissions and
|
* @date 2021-05-17
|
||||||
* limitations under the License.
|
*/
|
||||||
*
|
|
||||||
* Change Logs:
|
|
||||||
* Date Author Notes
|
|
||||||
* 2019-02-20 XiaojieFan the first version
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Modified by: AIIT XUOS Lab
|
|
||||||
* Modified date: 2020-09-01
|
|
||||||
* Description: replace original macro and basic date type with AIIT XUOS Lab's own defination
|
|
||||||
* start using AIIT XUOS Lab's own functional interfaces
|
|
||||||
* change some header files
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <connect_spi_lora.h>
|
#include <connect_spi_lora.h>
|
||||||
|
|
||||||
|
@ -136,14 +127,7 @@ inline uint8_t SX1276ReadDio5(void)
|
||||||
|
|
||||||
inline void SX1276WriteRxTx(uint8_t txEnable)
|
inline void SX1276WriteRxTx(uint8_t txEnable)
|
||||||
{
|
{
|
||||||
if (txEnable != 0)
|
return;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SX1276SetReset(uint8_t state)
|
void SX1276SetReset(uint8_t state)
|
||||||
|
@ -319,6 +303,11 @@ static uint32 SpiLoraOpen(void *dev)
|
||||||
KPrintf("SpiLoraOpen start\n");
|
KPrintf("SpiLoraOpen start\n");
|
||||||
|
|
||||||
x_err_t ret = EOK;
|
x_err_t ret = EOK;
|
||||||
|
static x_bool lora_init_status = RET_FALSE;
|
||||||
|
|
||||||
|
if (RET_TRUE == lora_init_status) {
|
||||||
|
return EOK;
|
||||||
|
}
|
||||||
|
|
||||||
struct HardwareDev *haldev = (struct HardwareDev *)dev;
|
struct HardwareDev *haldev = (struct HardwareDev *)dev;
|
||||||
|
|
||||||
|
@ -361,13 +350,22 @@ static uint32 SpiLoraOpen(void *dev)
|
||||||
KPrintf("LoRa check ok!\nNote: The length of the message that can be sent in a single time is 120 characters\n");
|
KPrintf("LoRa check ok!\nNote: The length of the message that can be sent in a single time is 120 characters\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lora_init_status = RET_TRUE;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32 SpiLoraClose(void *dev)
|
||||||
|
{
|
||||||
|
NULL_PARAM_CHECK(dev);
|
||||||
|
|
||||||
|
return EOK;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct LoraDevDone lora_done =
|
static const struct LoraDevDone lora_done =
|
||||||
{
|
{
|
||||||
.open = SpiLoraOpen,
|
.open = SpiLoraOpen,
|
||||||
.close = NONE,
|
.close = SpiLoraClose,
|
||||||
.write = SpiLoraWrite,
|
.write = SpiLoraWrite,
|
||||||
.read = SpiLoraRead,
|
.read = SpiLoraRead,
|
||||||
};
|
};
|
||||||
|
@ -467,7 +465,7 @@ int LoraSx12xxSpiDeviceInit(void)
|
||||||
return EOK;
|
return EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LORA_TEST
|
||||||
/*Just for lora test*/
|
/*Just for lora test*/
|
||||||
static struct Bus *bus;
|
static struct Bus *bus;
|
||||||
static struct HardwareDev *dev;
|
static struct HardwareDev *dev;
|
||||||
|
@ -532,4 +530,4 @@ static void LoraSend(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
|
||||||
LoraSend, LoraSend, lora send message );
|
LoraSend, LoraSend, lora send message );
|
||||||
|
#endif
|
||||||
|
|
|
@ -62,7 +62,6 @@ void SX1276Init( void )
|
||||||
SX1276Reset( );
|
SX1276Reset( );
|
||||||
|
|
||||||
SX1276Read(0x06, &TempReg);
|
SX1276Read(0x06, &TempReg);
|
||||||
KPrintf("SX1276 Read 0x%x\n", &TempReg);
|
|
||||||
|
|
||||||
if(TempReg != 0x6C)
|
if(TempReg != 0x6C)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue