+ brightness
This commit is contained in:
parent
3865c1928d
commit
938611ff84
17
.config
17
.config
|
@ -810,11 +810,7 @@ CONFIG_PKG_CJSON_VER="v1.7.17"
|
|||
# CONFIG_PKG_USING_DHRYSTONE is not set
|
||||
# CONFIG_PKG_USING_MEMORYPERF is not set
|
||||
# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
|
||||
CONFIG_PKG_USING_CHINESE_FONT_LIBRARY=y
|
||||
CONFIG_PKG_CHINESE_FONT_LIBRARY_PATH="/packages/tools/ChineseFontLibrary"
|
||||
# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY_V100 is not set
|
||||
CONFIG_PKG_USING_CHINESE_FONT_LIBRARY_LATEST_VERSION=y
|
||||
CONFIG_PKG_CHINESE_FONT_LIBRARY_VER="latest"
|
||||
# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
|
||||
# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
|
||||
# CONFIG_PKG_USING_BS8116A is not set
|
||||
# CONFIG_PKG_USING_GPS_RMC is not set
|
||||
|
@ -1038,7 +1034,14 @@ CONFIG_PKG_USING_AHT10_LATEST_VERSION=y
|
|||
# CONFIG_PKG_USING_AHT10_V300 is not set
|
||||
# CONFIG_PKG_USING_AHT10_V210 is not set
|
||||
CONFIG_PKG_AHT10_VER="latest"
|
||||
# CONFIG_PKG_USING_AP3216C is not set
|
||||
CONFIG_PKG_USING_AP3216C=y
|
||||
CONFIG_PKG_AP3216C_PATH="/packages/peripherals/sensors/ap3216c"
|
||||
# CONFIG_AP3216C_USING_SENSOR_DEVICE is not set
|
||||
# CONFIG_AP3216C_USING_HW_INT is not set
|
||||
CONFIG_PKG_USING_AP3216C_LATEST_VERSION=y
|
||||
# CONFIG_PKG_USING_AP3216C_V200 is not set
|
||||
# CONFIG_PKG_USING_AP3216C_V100 is not set
|
||||
CONFIG_PKG_AP3216C_VER="latest"
|
||||
# CONFIG_PKG_USING_TSL4531 is not set
|
||||
# CONFIG_PKG_USING_DS18B20 is not set
|
||||
# CONFIG_PKG_USING_DHT11 is not set
|
||||
|
@ -1575,7 +1578,7 @@ CONFIG_BSP_USING_FAL=y
|
|||
# CONFIG_BSP_USING_EASYFLASH is not set
|
||||
CONFIG_BSP_USING_RW007_WLAN=y
|
||||
CONFIG_BSP_USING_AHT21=y
|
||||
# CONFIG_BSP_USING_AP3216C is not set
|
||||
CONFIG_BSP_USING_AP3216C=y
|
||||
CONFIG_BSP_USING_ICM20608=y
|
||||
# CONFIG_BSP_USING_USB_MOUSE is not set
|
||||
# CONFIG_BSP_USING_CAN is not set
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <wlan_mgnt.h>
|
||||
#include <wlan_cfg.h>
|
||||
#include <wlan_prot.h>
|
||||
#include <ap3216c.h>
|
||||
|
||||
static int board_init(void)
|
||||
{
|
||||
|
@ -20,7 +21,7 @@ INIT_PREV_EXPORT(prev_init);
|
|||
|
||||
static int device_init(void)
|
||||
{
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(device_init);
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "aht10.h"
|
||||
#include <ap3216c.h>
|
||||
#include <dfs_posix.h>
|
||||
#include <drv_lcd.h>
|
||||
|
||||
|
||||
char DEMO_PRODUCT_KEY[IOTX_PRODUCT_KEY_LEN + 1] = {0};
|
||||
char DEMO_DEVICE_NAME[IOTX_DEVICE_NAME_LEN + 1] = {0};
|
||||
char DEMO_DEVICE_SECRET[IOTX_DEVICE_SECRET_LEN + 1] = {0};
|
||||
|
@ -32,14 +34,20 @@ char tmp[1026];
|
|||
// AHT挂载的总线名字
|
||||
#define AHT10_I2C_BUS "i2c3"
|
||||
|
||||
// AHT设备指针
|
||||
|
||||
// AHT,ap3216c设备指针
|
||||
aht10_device_t Dev = RT_NULL;
|
||||
ap3216c_device_t dev;
|
||||
|
||||
// Humi:湿度值,Temp:温度值
|
||||
float Humi, Temp;
|
||||
rt_uint16_t ps_data;
|
||||
float brightness;
|
||||
int lcd_y;
|
||||
|
||||
void ath_init(void);
|
||||
void mqt_init(void);
|
||||
int ap3_init(void);
|
||||
|
||||
#define EXAMPLE_TRACE(fmt, ...) \
|
||||
do { \
|
||||
|
@ -103,15 +111,25 @@ static int example_subscribe(void *handle)
|
|||
HAL_Free(topic);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int plus_lcd_y(int pls)
|
||||
{
|
||||
lcd_y+=pls;
|
||||
return lcd_y;
|
||||
}
|
||||
void show_lcd()
|
||||
{
|
||||
lcd_show_string(10, 10, 24, "Temperature:");
|
||||
lcd_y = 0;
|
||||
lcd_show_string(10, plus_lcd_y(10), 24, "Temperature:");
|
||||
sprintf(tmp, "%f", Temp);
|
||||
lcd_show_string(10, 10+24, 32, tmp);
|
||||
lcd_show_string(10, 10+24+32, 24, "Humidity:");
|
||||
lcd_show_string(10, plus_lcd_y(24), 32, tmp);
|
||||
|
||||
lcd_show_string(10, plus_lcd_y(32), 24, "Humidity:");
|
||||
sprintf(tmp, "%f", Humi);
|
||||
lcd_show_string(10, 10+24+32+24, 32, tmp);
|
||||
lcd_show_string(10, plus_lcd_y(24), 32, tmp);
|
||||
|
||||
lcd_show_string(10, plus_lcd_y(32), 24, "Brightness:");
|
||||
sprintf(tmp, "%f(lux)", brightness);
|
||||
lcd_show_string(10, plus_lcd_y(24), 32, tmp);
|
||||
}
|
||||
|
||||
void make_file()
|
||||
|
@ -147,6 +165,8 @@ void tmp_payload(void)
|
|||
// 读取温湿度值
|
||||
Humi = aht10_read_humidity(Dev);
|
||||
Temp = aht10_read_temperature(Dev);
|
||||
brightness = ap3216c_read_ambient_light(dev);
|
||||
ps_data = ap3216c_read_ps_data(dev);
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
sprintf(tmp, "Temp: %.1f;Humi: %.1f;Count: %d\n", Temp, Humi,++cnt);
|
||||
// rt_kprintf("\n%f %f tmp:%s\n",Humi,Temp,tmp);
|
||||
|
@ -159,6 +179,7 @@ void test_lcd()
|
|||
{
|
||||
// show_str(10, 10+24+32+24+32, 100, 32, "你好", 32);
|
||||
ath_init();
|
||||
ap3_init();
|
||||
while(1)
|
||||
{
|
||||
tmp_payload();
|
||||
|
@ -277,11 +298,20 @@ void mqt_init(void)
|
|||
rt_kprintf("MQTT Thread Create Failed!\n");
|
||||
}
|
||||
}
|
||||
int ap3_init(void){
|
||||
const char* i2c_bus_name = "i2c2";
|
||||
rt_thread_t tid;
|
||||
|
||||
dev = ap3216c_init(i2c_bus_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
void my_project(void)
|
||||
{
|
||||
ath_init();
|
||||
|
||||
mqt_init();
|
||||
|
||||
ap3_init();
|
||||
}
|
||||
MSH_CMD_EXPORT_ALIAS(my_project,myproject, run my project);
|
|
@ -415,8 +415,6 @@
|
|||
|
||||
/* tools packages */
|
||||
|
||||
#define PKG_USING_CHINESE_FONT_LIBRARY
|
||||
#define PKG_USING_CHINESE_FONT_LIBRARY_LATEST_VERSION
|
||||
/* end of tools packages */
|
||||
|
||||
/* system packages */
|
||||
|
@ -472,6 +470,8 @@
|
|||
|
||||
#define PKG_USING_AHT10
|
||||
#define PKG_USING_AHT10_LATEST_VERSION
|
||||
#define PKG_USING_AP3216C
|
||||
#define PKG_USING_AP3216C_LATEST_VERSION
|
||||
#define PKG_USING_ICM20608
|
||||
#define PKG_USING_ICM20608_LATEST_VERSION
|
||||
/* end of sensors drivers */
|
||||
|
@ -578,6 +578,7 @@
|
|||
#define BSP_USING_FAL
|
||||
#define BSP_USING_RW007_WLAN
|
||||
#define BSP_USING_AHT21
|
||||
#define BSP_USING_AP3216C
|
||||
#define BSP_USING_ICM20608
|
||||
/* end of Onboard Peripheral Drivers */
|
||||
|
||||
|
|
Loading…
Reference in New Issue