mirror of
https://github.com/pine64/bl_iot_sdk.git
synced 2024-10-06 06:50:19 +00:00
huawei cloud
This commit is contained in:
parent
44ee34a9bf
commit
9493d9f95b
@ -31,7 +31,7 @@
|
||||
* Import, export and usage of Huawei LiteOS in any manner by you shall be in compliance with such
|
||||
* applicable export control laws and regulations.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#if 1
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
@ -89,12 +89,9 @@ static const char s_server_ca[] =
|
||||
"CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=\r\n"
|
||||
"-----END CERTIFICATE-----\r\n";
|
||||
|
||||
#define CN_EP_DEVICEID "60056c19aaafca02dbd25786_bl602_mqtt_12345678" // watermeter水表模型
|
||||
#define CN_EP_PASSWD "12345678" //
|
||||
char CN_EP_DEVICEID[128]={0};
|
||||
char CN_EP_PASSWD[32]={0};
|
||||
|
||||
///< the client use the cert mode SHA-256
|
||||
//72DC0E75D88CEC38A025E9C48C79D222F608B039D080BCEFC0007DAD1AFFAD00
|
||||
//#define CN_EP_DEVICEID "5d0c76788a48f95ac41bcb9c_ca002"
|
||||
|
||||
#define CN_BOOT_MODE 0
|
||||
#define CN_LIFE_TIME 60 ///< the platform need more
|
||||
@ -283,6 +280,8 @@ static int oc_cmd_normal(oc_mqtt_profile_msgrcv_t *demo_msg)
|
||||
}
|
||||
|
||||
/*数据上报处理函数*/
|
||||
int hw_sensoremperature=0;
|
||||
int hw_sensorhumidity=0;
|
||||
static void oc_report_normal(void)
|
||||
{
|
||||
static int times = 1;
|
||||
@ -301,46 +300,42 @@ static void oc_report_normal(void)
|
||||
}
|
||||
else if(times == EN_OC_MQTT_PROFILE_MSG_TYPE_UP_PROPERTYREPORT)
|
||||
{
|
||||
// 用于拼装JSON数据的变量
|
||||
oc_mqtt_profile_kv_t dailyActivityTime_List;
|
||||
|
||||
// 添加初始化服务代码
|
||||
///< initialize the service
|
||||
s_device_service.event_time = NULL;
|
||||
s_device_service.service_id = "Connectivity";
|
||||
s_device_service.service_property = &dailyActivityTime_List;
|
||||
s_device_service.nxt = NULL;
|
||||
|
||||
// 添加数据所需要的变量
|
||||
int dailyActivityTime = 66;
|
||||
|
||||
while(1)
|
||||
oc_mqtt_profile_service_t service;
|
||||
oc_mqtt_profile_kv_t temperature;
|
||||
oc_mqtt_profile_kv_t humidity;
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
service.event_time = NULL;
|
||||
service.service_id = "Agriculture";
|
||||
service.service_property = &temperature;
|
||||
service.nxt = NULL;
|
||||
|
||||
temperature.key = "Temperature";
|
||||
temperature.value =&hw_sensoremperature;
|
||||
temperature.type = EN_OC_MQTT_PROFILE_VALUE_INT;
|
||||
temperature.nxt = &humidity;
|
||||
|
||||
humidity.key = "Humidity";
|
||||
humidity.value =&hw_sensorhumidity;
|
||||
humidity.type = EN_OC_MQTT_PROFILE_VALUE_INT;
|
||||
humidity.nxt =NULL;
|
||||
osal_task_sleep(10000);
|
||||
if(1)//默认有效 //
|
||||
// 添加数据上报代码
|
||||
ret = oc_mqtt_profile_propertyreport(NULL,&service);
|
||||
if(!ret)
|
||||
{
|
||||
|
||||
/*组装JSON数据*/
|
||||
dailyActivityTime = rand()%10;
|
||||
dailyActivityTime_List.key = "dailyActivityTime";
|
||||
dailyActivityTime_List.value = (char *)&dailyActivityTime;
|
||||
dailyActivityTime_List.type = EN_OC_MQTT_PROFILE_VALUE_INT;
|
||||
dailyActivityTime_List.nxt = NULL;
|
||||
|
||||
// 添加数据上报代码
|
||||
ret = oc_mqtt_profile_propertyreport(NULL,&s_device_service);
|
||||
if(!ret)
|
||||
{
|
||||
printf("%s\r\n","max.su -> My report success");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("max.su -> error code %d\r\n", ret);
|
||||
}
|
||||
|
||||
|
||||
printf("%s\r\n","max.su -> My report success");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("max.su -> error code %d\r\n", ret);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -429,3 +424,5 @@ int standard_app_demo_main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -49,8 +49,8 @@
|
||||
#include <wifi_mgmr_ext.h>
|
||||
#include <hal_wifi.h>
|
||||
|
||||
#define HWCLOUD_SSID "BouffaloLab"
|
||||
#define HWCLOUD_PWD "bouffalo"
|
||||
char HWCLOUD_SSID[33]={0};
|
||||
char HWCLOUD_PWD[32]={0};
|
||||
static int wifi_state_hw = WIFI_STATE_UNKNOWN;
|
||||
|
||||
static void hwcloud_wifi_sta_connect(char *ssid, char *password) //
|
||||
|
@ -34,14 +34,16 @@
|
||||
#include <looprt.h>
|
||||
#include <loopset.h>
|
||||
#include <loopset_i2c.h>
|
||||
|
||||
#include <libfdt.h>
|
||||
#include <bl602.h>
|
||||
#include <bl_i2c.h>
|
||||
#include <bl602_i2c.h>
|
||||
#include <bl_irq.h>
|
||||
#include <hal_i2c.h>
|
||||
#include <blog.h>
|
||||
|
||||
#include <bl_gpio.h>
|
||||
#include <bl602.h>
|
||||
#include <bl602_glb.h>
|
||||
i2c_msg_t *gpstmsg;
|
||||
SemaphoreHandle_t i2c_hd_handle = NULL;
|
||||
SemaphoreHandle_t i2c_msgs_handle = NULL;
|
||||
@ -268,10 +270,65 @@ int i2c_transfer_onemsg_no_block(i2c_msg_t *pstmsg)
|
||||
i2c_transfer_no_block(pstmsg);
|
||||
return 0;
|
||||
}
|
||||
#define BL_FDT32_TO_U8(addr, byte_offset) ((uint8_t)fdt32_to_cpu(*(uint32_t *)((uint8_t *)addr + byte_offset)))
|
||||
int hal_i2c_gpio_form_dts(const void *fdt, uint32_t dtb_offset)
|
||||
{
|
||||
const char *i2c_node[1] = {"i2c@40011000"};
|
||||
int offset1 = 0;
|
||||
int offset2 = 0;
|
||||
uint8_t gpiopins[2];
|
||||
|
||||
const uint32_t *addr_prop = 0;
|
||||
int lentmp = 0;
|
||||
const char *result = 0;
|
||||
int countindex = 0;
|
||||
offset1 = fdt_subnode_offset(fdt, dtb_offset, i2c_node[0]);
|
||||
if (0 >= offset1) {
|
||||
blog_info("i2c node is NULL.\r\n");
|
||||
return 1;
|
||||
|
||||
}
|
||||
countindex = fdt_stringlist_count(fdt, offset1, "status");
|
||||
if (countindex != 1) {
|
||||
blog_info("i2c status_countindex = NULL.\r\n");
|
||||
return 1;
|
||||
}
|
||||
result = fdt_stringlist_get(fdt, offset1, "status", 0, &lentmp);
|
||||
if ((lentmp != 4) || (memcmp("okay", result, 4) != 0)) {
|
||||
blog_info("i2c status = %s\r\n", result);
|
||||
|
||||
return 1;
|
||||
}
|
||||
offset2 = fdt_subnode_offset(fdt, offset1, "pin");
|
||||
if (0 >= offset2) {
|
||||
blog_info("i2c pin NULL.\r\n");
|
||||
return 1;
|
||||
}
|
||||
addr_prop = fdt_getprop(fdt, offset2,"scl", &lentmp);
|
||||
if (addr_prop == NULL) {
|
||||
blog_info("i2c scl pin is NULL.\r\n");
|
||||
return 1;
|
||||
}else{
|
||||
|
||||
gpiopins[0]=BL_FDT32_TO_U8(addr_prop, 0);
|
||||
}
|
||||
addr_prop = fdt_getprop(fdt, offset2,"sda", &lentmp);
|
||||
if (addr_prop == NULL) {
|
||||
blog_info("i2c sda pin is NULL.\r\n");
|
||||
return 1;
|
||||
}else{
|
||||
|
||||
gpiopins[1]=BL_FDT32_TO_U8(addr_prop, 0);
|
||||
}
|
||||
|
||||
GLB_GPIO_Func_Init(GPIO_FUN_I2C, gpiopins, sizeof(gpiopins) / sizeof(gpiopins[0]));
|
||||
return 0;
|
||||
}
|
||||
int hal_i2c_init(int i2cx, int freq)
|
||||
{
|
||||
#if 0
|
||||
i2c_gpio_init(i2cx);
|
||||
#endif
|
||||
i2c_set_freq(freq, i2cx);
|
||||
I2C_Disable(i2cx);
|
||||
bl_irq_enable(I2C_IRQn);
|
||||
|
@ -45,7 +45,7 @@ int hal_i2c_read_block(int address, char *data, int length, int subaddr_len, int
|
||||
int hal_i2c_write_block(int address, const char *data, int length, int subaddr_len, int subaddr);
|
||||
int hal_i2c_write_no_block(int address, const char *data, int length, int subaddr_len, int subaddr);
|
||||
int hal_i2c_read_no_block(int address, const char *data, int length, int subaddr_len, int subaddr);
|
||||
|
||||
int hal_i2c_gpio_form_dts(const void *fdt, uint32_t dtb_offset);
|
||||
int i2c_transfer_msgs_block(i2c_msg_t *pstmsg, int num, int support_ins);
|
||||
void i2c_msgs_process(i2c_msg_t *pstmsg);
|
||||
void i2c_insert_msgs_process(i2c_msg_t *pstmsg);
|
||||
|
BIN
customer_app/bl602_huawei_cloud/607f9d67ba4b2702c05eb41b.zip
Normal file
BIN
customer_app/bl602_huawei_cloud/607f9d67ba4b2702c05eb41b.zip
Normal file
Binary file not shown.
@ -1,10 +0,0 @@
|
||||
# BL602 connect to Huawei Cloud
|
||||
|
||||
This demo can connect to Huawei Cloud with MQTT. There have three network protocol to connect Huawei Cloud : MQTT 、Coap、LwM2M,please reference below guide to connect Huawei Cloud.
|
||||
|
||||
MQTT Guide :[mqtt](wifi_BL602(RISC-V)_MQTT.mhtml)
|
||||
|
||||
Coap Guide :[coap](wifi_BL602(RISC-V)_CoAP.mhtml)
|
||||
|
||||
LwM2M Guide:[lwm2m](wifi_BL602(RISC-V)_LwM2M.mhtml)
|
||||
|
@ -82,6 +82,14 @@
|
||||
#include <libfdt.h>
|
||||
#include <blog.h>
|
||||
|
||||
#include <looprt.h>
|
||||
#include <loopset.h>
|
||||
#include <loopset_i2c.h>
|
||||
#include <hal_i2c.h>
|
||||
#include <bl_i2c.h>
|
||||
#include <semphr.h>
|
||||
#include <hal_hwtimer.h>
|
||||
|
||||
#ifdef CONFIG_HWCLOUD_IOT_LINK
|
||||
#include <example_hwcloud_iot_link.h>
|
||||
#endif
|
||||
@ -155,14 +163,90 @@ void vApplicationIdleHook(void)
|
||||
(void)uxTopUsedPriority;
|
||||
#endif
|
||||
}
|
||||
extern int hw_sensoremperature;
|
||||
extern int hw_sensorhumidity;
|
||||
static hw_timer_t *sensor_timer = NULL;
|
||||
int GXHT3X_test(void)
|
||||
{
|
||||
|
||||
i2c_msg_t init_msg[2];
|
||||
uint8_t init_buf[2];
|
||||
uint8_t sensor_buf[6];
|
||||
|
||||
uint16_t tem;
|
||||
uint16_t hum;
|
||||
|
||||
memset(sensor_buf, 0, 6);
|
||||
init_buf[0]=0x2C;
|
||||
init_buf[1]=0x10;
|
||||
|
||||
|
||||
init_msg[0].addr = 0x45;
|
||||
init_msg[0].subflag = 0;
|
||||
init_msg[0].subaddr = 0;
|
||||
init_msg[0].buf = init_buf;
|
||||
init_msg[0].direct = I2C_M_WRITE;
|
||||
init_msg[0].block = I2C_M_NO_BLOCK;
|
||||
init_msg[0].len = 2;
|
||||
init_msg[0].idex = 0;
|
||||
init_msg[0].sublen = 0;
|
||||
init_msg[0].i2cx = 0;
|
||||
i2c_transfer_msgs_block(init_msg, 1, 0);
|
||||
|
||||
vTaskDelay(500);
|
||||
|
||||
init_msg[0].addr = 0x45;
|
||||
init_msg[0].subflag = 0;
|
||||
init_msg[0].subaddr = 0;
|
||||
init_msg[0].buf = sensor_buf;
|
||||
init_msg[0].direct = I2C_M_READ;
|
||||
init_msg[0].block = I2C_M_NO_BLOCK;
|
||||
init_msg[0].len = 6;
|
||||
init_msg[0].idex = 0;
|
||||
init_msg[0].sublen = 0;
|
||||
init_msg[0].i2cx = 0;
|
||||
i2c_transfer_msgs_block(init_msg, 1, 0);
|
||||
|
||||
tem = ((sensor_buf[0]<<8) | sensor_buf[1]);//温度拼接
|
||||
hum = ((sensor_buf[3]<<8) | sensor_buf[4]);//湿度拼接
|
||||
|
||||
printf("recv data = %x ,%x %x ,%x\n",sensor_buf[0],sensor_buf[1],sensor_buf[3],sensor_buf[4]);
|
||||
hw_sensoremperature= (((175.0*(float)tem)/65535.0)-45.0) ;// T = -45 + 175 * tem / (2^16-1)
|
||||
hw_sensorhumidity= ((100.0*(float)hum)/65535.0);// RH = hum*100 / (2^16-1)
|
||||
|
||||
|
||||
if((hw_sensoremperature>=-20)&&(hw_sensoremperature<=125)&&(hw_sensorhumidity>=0)&&(hw_sensorhumidity<=100))//过滤错误数据
|
||||
{
|
||||
printf("sensor data ok\n");
|
||||
|
||||
printf("Temperature:%d*C Humidity%d %% \n",hw_sensoremperature,hw_sensorhumidity);
|
||||
return 0;
|
||||
|
||||
}else{
|
||||
|
||||
hw_sensoremperature=0;
|
||||
hw_sensorhumidity=0;
|
||||
printf("sensor data error\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static void sensor_timer_handle(void)
|
||||
{
|
||||
GXHT3X_test();
|
||||
}
|
||||
|
||||
|
||||
static void proc_hellow_entry(void *pvParameters)
|
||||
{
|
||||
vTaskDelay(500);
|
||||
|
||||
sensor_timer = hal_hwtimer_create(1000, sensor_timer_handle, 0);
|
||||
while (1) {
|
||||
printf("%s: RISC-V rv32imafc\r\n", __func__);
|
||||
vTaskDelay(10000);
|
||||
|
||||
}
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
@ -515,11 +599,10 @@ static void event_cb_wifi_event(input_event_t *event, void *private_data)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 //
|
||||
static void __attribute__((unused)) cmd_aws(char *buf, int len, int argc, char **argv)
|
||||
#if 1
|
||||
static void cmd_sensor_data(char *buf, int len, int argc, char **argv)
|
||||
{
|
||||
void aws_main_entry(void *arg);
|
||||
xTaskCreate(aws_main_entry, (char*)"aws_iot", 4096, NULL, 10, NULL);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -753,7 +836,7 @@ static void cmd_stack_wifi(char *buf, int len, int argc, char **argv)
|
||||
}
|
||||
|
||||
const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = {
|
||||
// { "aws", "aws iot demo", cmd_aws}, //
|
||||
{ "cmd_sensor_data", "cmd_sensor_data", cmd_sensor_data}, //
|
||||
{ "pka", "pka iot demo", cmd_pka},
|
||||
{ "wifi", "wifi", cmd_wifi},
|
||||
{ "sha", "sha iot demo", cmd_sha},
|
||||
@ -821,6 +904,120 @@ static void __opt_feature_init(void)
|
||||
romfs_register();
|
||||
#endif
|
||||
}
|
||||
static void event_cb_i2c_event(input_event_t *event, void *private_data)
|
||||
{
|
||||
switch (event->code) {
|
||||
case CODE_I2C_END:
|
||||
{
|
||||
printf("TRANS FINISH %lld\r\n", aos_now_ms());
|
||||
}
|
||||
break;
|
||||
case CODE_I2C_ARB:
|
||||
{
|
||||
printf("TRANS ERROR ARB %lld\r\n", aos_now_ms());
|
||||
}
|
||||
break;
|
||||
case CODE_I2C_NAK:
|
||||
{
|
||||
printf("TRANS ERROR NAK %lld\r\n", aos_now_ms());
|
||||
}
|
||||
break;
|
||||
case CODE_I2C_FER:
|
||||
{
|
||||
printf("TRANS ERROR FER %lld\r\n", aos_now_ms());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
printf("[I2C] [EVT] Unknown code %u, %lld\r\n", event->code, aos_now_ms());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
extern char CN_EP_DEVICEID[128];
|
||||
extern char CN_EP_PASSWD[32];
|
||||
extern char HWCLOUD_SSID[33];
|
||||
extern char HWCLOUD_PWD[32];
|
||||
static int fdt_huawei_module_init(const void *fdt, int huawei_offset)
|
||||
{
|
||||
const uint32_t *result = NULL;
|
||||
int lentmp = 0;
|
||||
|
||||
result = fdt_getprop(fdt, huawei_offset, "ssid", &lentmp);
|
||||
if (result!=NULL) {
|
||||
printf("get ssid value = %s,%d\r\n", result,lentmp);
|
||||
memset(HWCLOUD_SSID,0,sizeof(HWCLOUD_SSID));
|
||||
memcpy(HWCLOUD_SSID,result,lentmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("get ssid value fail\r\n");
|
||||
return 1;
|
||||
}
|
||||
result = NULL;
|
||||
result = fdt_getprop(fdt, huawei_offset, "psk", &lentmp);
|
||||
if (result!=NULL) {
|
||||
printf("get ssid psk = %s,%d\r\n", result,lentmp);
|
||||
memset(HWCLOUD_PWD,0,sizeof(HWCLOUD_PWD));
|
||||
memcpy(HWCLOUD_PWD,result,lentmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("get ssid psk fail\r\n");
|
||||
return 1;
|
||||
}
|
||||
result = NULL;
|
||||
result = fdt_getprop(fdt, huawei_offset, "devid", &lentmp);
|
||||
if (result!=NULL) {
|
||||
printf("get ssid devid = %s,%d\r\n", result,lentmp);
|
||||
memset(CN_EP_DEVICEID,0,sizeof(CN_EP_DEVICEID));
|
||||
memcpy(CN_EP_DEVICEID,result,lentmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("get ssid devid fail\r\n");
|
||||
return 1;
|
||||
}
|
||||
result = NULL;
|
||||
result = fdt_getprop(fdt, huawei_offset, "devpsw", &lentmp);
|
||||
if (result!=NULL) {
|
||||
printf("get ssid devpsw = %s,%d\r\n", result,lentmp);
|
||||
memset(CN_EP_PASSWD,0,sizeof(CN_EP_PASSWD));
|
||||
memcpy(CN_EP_PASSWD,result,lentmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("get ssid devpsw fail\r\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void get_huawei_para(uint32_t fdt, uint32_t dtb_offset)
|
||||
{
|
||||
if(0==fdt_huawei_module_init((const void *)fdt, (int)dtb_offset)){
|
||||
|
||||
#ifdef CONFIG_HWCLOUD_IOT_LINK
|
||||
example_hwcloud_iot_link();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
static void i2c_init_form_dts(uint32_t fdt, uint32_t dtb_offset)
|
||||
{
|
||||
if( 0== hal_i2c_gpio_form_dts((const void *)fdt, (int)dtb_offset)){
|
||||
|
||||
printf("hal_i2c_gpio_form_dts ok\r\n");
|
||||
hal_i2c_init(0, 500);
|
||||
}
|
||||
}
|
||||
static void start_huawei_cloud(void)
|
||||
{
|
||||
uint32_t fdt = 0, offset = 0;
|
||||
if (0 == get_dts_addr("huawei", &fdt, &offset)) {
|
||||
get_huawei_para(fdt, offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void aos_loop_proc(void *pvParameters)
|
||||
{
|
||||
@ -832,7 +1029,7 @@ static void aos_loop_proc(void *pvParameters)
|
||||
/*Init bloop stuff*/
|
||||
looprt_start(proc_stack_looprt, 512, &proc_task_looprt);
|
||||
loopset_led_hook_on_looprt();
|
||||
|
||||
loopset_i2c_hook_on_looprt();
|
||||
easyflash_init();
|
||||
vfs_init();
|
||||
vfs_device_init();
|
||||
@ -848,6 +1045,10 @@ static void aos_loop_proc(void *pvParameters)
|
||||
if (0 == get_dts_addr("gpio", &fdt, &offset)) {
|
||||
hal_gpio_init_from_dts(fdt, offset);
|
||||
}
|
||||
if (0 == get_dts_addr("i2c", &fdt, &offset)) {
|
||||
i2c_init_form_dts(fdt, offset);
|
||||
}
|
||||
|
||||
|
||||
__opt_feature_init();
|
||||
aos_loop_init();
|
||||
@ -862,7 +1063,7 @@ static void aos_loop_proc(void *pvParameters)
|
||||
|
||||
aos_register_event_filter(EV_WIFI, event_cb_wifi_event, NULL);
|
||||
cmd_stack_wifi(NULL, 0, 0, NULL);
|
||||
|
||||
aos_register_event_filter(EV_I2C, event_cb_i2c_event, NULL);
|
||||
aos_loop_run();
|
||||
|
||||
puts("------------------------------------------\r\n");
|
||||
@ -1013,10 +1214,9 @@ void bfl_main()
|
||||
|
||||
puts("[OS] Starting proc_hellow_entry task...\r\n");
|
||||
xTaskCreateStatic(proc_hellow_entry, (char*)"hellow", 512, NULL, 15, proc_hellow_stack, &proc_hellow_task);
|
||||
|
||||
start_huawei_cloud();
|
||||
|
||||
#ifdef CONFIG_HWCLOUD_IOT_LINK
|
||||
example_hwcloud_iot_link();
|
||||
#endif
|
||||
|
||||
puts("[OS] Starting aos_loop_proc task...\r\n");
|
||||
xTaskCreateStatic(aos_loop_proc, (char*)"event_loop", 1024, NULL, 15, aos_loop_proc_stack, &aos_loop_proc_task);
|
||||
|
BIN
customer_app/bl602_huawei_cloud/bl602_hw_cloud.pdf
Normal file
BIN
customer_app/bl602_huawei_cloud/bl602_hw_cloud.pdf
Normal file
Binary file not shown.
BIN
customer_app/bl602_huawei_cloud/接入说明.pdf
Normal file
BIN
customer_app/bl602_huawei_cloud/接入说明.pdf
Normal file
Binary file not shown.
@ -9,78 +9,15 @@
|
||||
compatible = "bl,bl602-sample", "bl,bl602-common";
|
||||
#address-cells = <0x1>;
|
||||
#size-cells = <0x1>;
|
||||
gpio {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
max_num = <40>;
|
||||
gpio0 {
|
||||
status = "okay";
|
||||
pin = <5>;
|
||||
feature = "led";
|
||||
active = "Hi"; //Hi or Lo
|
||||
mode = "blink"; //blink or hearbeat
|
||||
time = <100>; //duration for this mode
|
||||
};
|
||||
gpio1 {
|
||||
status = "disable";
|
||||
pin = <6>;
|
||||
feature = "led";
|
||||
active = "Hi"; //Hi or Lo
|
||||
mode = "blink"; //blink or hearbeat
|
||||
time = <100>; //duration for this mode
|
||||
};
|
||||
gpio2 {
|
||||
status = "okay";
|
||||
pin = <2>;
|
||||
feature = "button";
|
||||
active = "Hi";
|
||||
mode = "multipress";
|
||||
button {
|
||||
debounce = <10>;
|
||||
short_press_ms {
|
||||
start = <100>;
|
||||
end = <3000>;
|
||||
kevent = <2>;
|
||||
};
|
||||
long_press_ms {
|
||||
start = <6000>;
|
||||
end = <10000>;
|
||||
kevent = <3>;
|
||||
};
|
||||
longlong_press_ms {
|
||||
start = <15000>;
|
||||
kevent = <4>;
|
||||
};
|
||||
trig_level = "Hi";
|
||||
};
|
||||
hbn_use = "disable";
|
||||
};
|
||||
};
|
||||
i2s {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
i2s@40017000 {
|
||||
status = "okay";
|
||||
compatible = "bl602_i2s";
|
||||
reg = <0x40017000 0x100>;
|
||||
mclk_only = "okay";
|
||||
pin {
|
||||
mclk = <11>;
|
||||
};
|
||||
};
|
||||
i2s@40017100 {
|
||||
status = "okay";
|
||||
compatible = "bl602_i2s";
|
||||
reg = <0x40017100 0x100>;
|
||||
mclk_only = "disable";
|
||||
pin {
|
||||
bclk = <12>;
|
||||
fs = <29>;
|
||||
do = <30>;
|
||||
di = <31>;
|
||||
};
|
||||
};
|
||||
};
|
||||
huawei {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
ssid = "BouffaloLab";
|
||||
psk = "bouffalo";
|
||||
devid ="6080bf90f4b59002c0d9c955_bl602";
|
||||
devpsw="12345678";
|
||||
};
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
@ -89,20 +26,8 @@
|
||||
compatible = "bl602_i2c";
|
||||
reg = <0x40011000 0x100>;
|
||||
pin {
|
||||
scl = <32>;
|
||||
sda = <13>;
|
||||
};
|
||||
devices {
|
||||
list_addr = <0x18 0x21>;
|
||||
list_driver = "i2c_es8311", "i2c_gc0308>";
|
||||
};
|
||||
};
|
||||
i2c@40011100 {
|
||||
status = "disable";
|
||||
compatible = "bl602_i2c";
|
||||
reg = <0x40011100 0x100>;
|
||||
pin {
|
||||
/*empty here*/
|
||||
scl = <12>;
|
||||
sda = <11>;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -169,26 +94,7 @@
|
||||
freq = <5000>;
|
||||
duty = <50>;
|
||||
};
|
||||
};
|
||||
ir {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ctrltype = <0>;
|
||||
tx {
|
||||
status = "disable";
|
||||
pin = <11>; // only support 11
|
||||
mode = "NEC"; // NEC、ExtenedNEC、RC5、SWM
|
||||
interval = <100>; // ms
|
||||
active_mode = "Hi"; //Hi、Lo
|
||||
};
|
||||
rx {
|
||||
status = "okay";
|
||||
pin = <12>; // only support 12 13
|
||||
mode = "NEC"; // NEC、ExtenedNEC、RC5、SWM
|
||||
active_mode = "Hi"; //Hi、Lo
|
||||
data_check = <2>; //bit 0:check cmd, bit 1:check addr
|
||||
};
|
||||
};
|
||||
};
|
||||
uart {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
@ -214,14 +120,14 @@
|
||||
};
|
||||
};
|
||||
uart@4000A100 {
|
||||
status = "okay";
|
||||
status = "disable";
|
||||
id = <1>;
|
||||
compatible = "bl602_uart";
|
||||
path = "/dev/ttyS1";
|
||||
baudrate = <115200>;
|
||||
pin {
|
||||
rx = <3>;
|
||||
tx = <4>;
|
||||
rx = <11>;
|
||||
tx = <12>;
|
||||
};
|
||||
buf_size {
|
||||
rx_size = <512>;
|
||||
@ -258,19 +164,6 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
gpip {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
adc_key {
|
||||
status = "disable";
|
||||
pin = <9>;
|
||||
interrupt = <3>;
|
||||
key_vol = <0 100 400 300 500>;
|
||||
key_pcb = "SW1", "SW2", "SW3", "SW4","SW5";
|
||||
key_event = "Usr1", "Usr2", "Start", "Up", "Down";
|
||||
key_raw = <1 2 3 4 5>;
|
||||
};
|
||||
};
|
||||
qspi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
@ -348,4 +241,5 @@
|
||||
pwr_table_ble = <13>; //range:-3~15dbm; if set -3, please set 253 here
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user