diff --git a/README.md b/README.md
index 21e4b4d5516ffc60c4ef94084c73d18545f326b2..eba70db6dc280bb6e7ec0a0f9258ab5aa0e18656 100644
--- a/README.md
+++ b/README.md
@@ -113,7 +113,7 @@ ECBMCU201MPC、ECBMCU105H、ECBMCU301M提供了以下Demo供开发参考:
单次触发ADC实现连续采样案例 |
|
- |
+ 使用ADC的HX711压力传感器适配案例 |
|
|
@@ -376,6 +376,7 @@ ECBMOTORA是电机驱动扩展板,支持一个 BLDC 或 PMSM 电机控制。
| sample_adc_sync_sample | ADC同步采样。 |
| sample_adc_sync_sample_dma | ADC同步采样带DMA。 |
| sample_adc_sync_sample_it | ADC同步采样带中断。 |
+| sample_adc_sync_sample_yali | HX711压力传感器称重。 |
**表 4 apt目录结构说明**
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/BUILD.gn b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..46bb29958a1a91b1ae4bfed311d45369650595cc
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/BUILD.gn
@@ -0,0 +1,14 @@
+static_library("sample_adc_sync_sample_yali") {
+ sources = [
+ "HX711.c",
+ "oled/oled_ssd1306.c",
+ "main.c"
+ ]
+
+ include_dirs = [
+ "./oled",
+ "//utils/native/lite/include",
+ "//kernel/liteos_m/kal/cmsis",
+ "//base/iot_hardware/peripheral/interfaces/kits",
+ ]
+}
\ No newline at end of file
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/HX711.c b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/HX711.c
new file mode 100644
index 0000000000000000000000000000000000000000..08948f9c6c631b4d4b2e6faf90deeacb2b12a4f9
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/HX711.c
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+
+#include "ohos_init.h"
+#include "cmsis_os2.h"
+#include "iot_gpio.h"
+#include "hi_io.h"
+#include "HX711.h"
+#include "hi_time.h"
+
+long HX711_Buffer = 0;
+long Weight_Maopi = 0,Weight_Shiwu = 0;
+
+#define GapValue 430
+
+//****************************************************
+//初始化HX711
+//****************************************************
+void Init_Hx711()
+{
+ hi_io_set_func(GPIO_8, GPIO_FUNC);
+ IoTGpioSetDir(GPIO_8, IOT_GPIO_DIR_IN);
+ IoTGpioSetDir(HX711_SCK, IOT_GPIO_DIR_OUT);
+
+}
+
+
+//****************************************************
+//获取毛皮重量
+//****************************************************
+void Get_Maopi()
+{
+ Weight_Maopi = HX711_Read();
+}
+
+//****************************************************
+//称重
+//****************************************************
+long Get_Weight()
+{
+ HX711_Buffer = HX711_Read();
+ Weight_Shiwu = HX711_Buffer;
+ Weight_Shiwu = Weight_Shiwu - Weight_Maopi; //获取实物的AD采样数值。
+ Weight_Shiwu = (long)((float)Weight_Shiwu/GapValue);
+ return Weight_Shiwu;
+}
+
+//****************************************************
+//读取HX711
+//****************************************************
+unsigned long HX711_Read(void) //增益128
+{
+ unsigned long count;
+ unsigned long data;
+ unsigned char i;
+ bool Flag = 0;
+ IotGpioValue value = IOT_GPIO_VALUE0;
+ IoTGpioSetOutputVal(HX711_DT, IOT_GPIO_VALUE1);
+ hi_udelay(1);
+ IoTGpioGetInputVal(HX711_DT, &value);
+ // printf("value is %f\r\n",value);
+ IoTGpioSetOutputVal(GPIO_7, IOT_GPIO_VALUE0);
+ hi_udelay(1);
+ count=0;
+ data = IoTGpioGetInputVal(HX711_DT, &value);
+ // printf("value2 is %f\r\n",value);
+ while(data);
+
+ for(i=0;i<24;i++)
+ {
+ IoTGpioSetOutputVal(HX711_SCK, IOT_GPIO_VALUE1);
+ hi_udelay(1);
+ count=count<<1;
+ IoTGpioSetOutputVal(HX711_SCK, IOT_GPIO_VALUE0);
+ hi_udelay(1);
+ IoTGpioGetInputVal(HX711_DT, &value);
+ if(value)
+ count++;
+ hi_udelay(1);
+ }
+ IoTGpioSetOutputVal(HX711_SCK, IOT_GPIO_VALUE1);
+ count ^= 0x800000;
+ hi_udelay(1);
+ IoTGpioSetOutputVal(HX711_SCK, IOT_GPIO_VALUE0);
+ // printf("count is %d\r\n",count);
+ return(count);
+}
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/HX711.h b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/HX711.h
new file mode 100644
index 0000000000000000000000000000000000000000..1f062c52e810b249bbc97b555348b083b7674b00
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/HX711.h
@@ -0,0 +1,17 @@
+#ifndef __HX711__H__
+#define __HX711__H__
+
+#include
+
+#define HX711_SCK 7
+#define HX711_DT 8
+#define GPIO_8 8
+#define GPIO_7 7
+#define GPIO_FUNC 0
+
+extern void Init_Hx711();
+extern unsigned long HX711_Read(void);
+extern long Get_Weight();
+extern void Get_Maopi();
+
+#endif
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/README.md b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..446aa9815ac7f4f1acd082b4369135ce054f1c20
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/README.md
@@ -0,0 +1,43 @@
+
+\#### 介绍
+
+hi3861称重dome文件
+
+
+
+\#### 软件架构
+
+liteOS\_m
+
+
+
+
+
+\#### 开发教程
+
+
+
+1\. 在 OpenHarmony 源代码的 applications/sample/wifi-iot/app/目录下创建压力传感器代码 目录。
+
+2\. 引脚初始化,这里购买的传感器商家只有STM32,51,安卓的单片机,初始化方法不一样,鸿蒙hi3861不需要设置引脚细节的输入输出格式,只需要设置为输入输出方向即可
+
+hi\_io\_set\_func(GPIO\_8, GPIO\_FUNC);
+
+ IoTGpioSetDir(GPIO\_8, IOT\_GPIO\_DIR\_IN);
+
+ IoTGpioSetDir(HX711\_SCK, IOT\_GPIO\_DIR\_OUT);
+
+3.具体细节看代码大家对比观察,大体逻辑按照商家的Arduino例程进行电平设置的函数替换
+
+\#### 使用说明
+
+称重小面包
+
+
+OLED显示
+
+
+串口数据
+
+
+
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/main.c b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..fba4557bf47c71269639156a8fc3b483304bea33
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/main.c
@@ -0,0 +1,49 @@
+#include
+#include
+#include
+
+#include "ohos_init.h"
+#include "cmsis_os2.h"
+#include "iot_gpio.h"
+#include "hi_io.h"
+#include "hi_time.h"
+#include "HX711.h"
+#include "hi_adc.h"
+#include "iot_errno.h"
+#include "oled/oled_ssd1306.h"
+void *RobotCarTestTask(void* param)
+{
+ Init_Hx711();
+ OledInit();
+ OledFillScreen(0);
+ Get_Maopi();
+ static char line[32] = {0};
+ while (1) {
+ float a = Get_Weight();
+
+ printf("yali = %0.2fg\r\n",a/10.0);
+ OledFillScreen(0x00);
+
+ OledShowString(0, 0, "Sensor values:", 1);
+
+ snprintf(line, sizeof(line), "weight: %.2fg", a/10.0);
+ OledShowString(0, 1, line, 1);
+ osDelay(20);
+ }
+}
+void RobotCarDemo(void)
+{
+ osThreadAttr_t attr;
+
+ attr.name = "RobotCarTestTask";
+ attr.attr_bits = 0U;
+ attr.cb_mem = NULL;
+ attr.cb_size = 0U;
+ attr.stack_mem = NULL;
+ attr.stack_size = 10240;
+ attr.priority = 25;
+ if (osThreadNew(RobotCarTestTask, NULL, &attr) == NULL) {
+ printf("[Ssd1306TestDemo] Falied to create RobotCarTestTask!\n");
+ }
+}
+APP_FEATURE_INIT(RobotCarDemo);
\ No newline at end of file
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_fonts.h b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_fonts.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a936cdbbcecf7e6b57b7b5ccdde80854aadb239
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_fonts.h
@@ -0,0 +1,201 @@
+#ifndef OLOED_FONTS_H
+#define OLOED_FONTS_H
+
+/************************************6*8的点阵************************************/
+static unsigned char F6x8[][6] =
+{
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // sp
+ { 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 }, // !
+ { 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 }, // "
+ { 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 }, // #
+ { 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 }, // $
+ { 0x00, 0x62, 0x64, 0x08, 0x13, 0x23 }, // %
+ { 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 }, // &
+ { 0x00, 0x00, 0x05, 0x03, 0x00, 0x00 }, // '
+ { 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 }, // (
+ { 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 }, // )
+ { 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 }, // *
+ { 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 }, // +
+ { 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 }, // ,
+ { 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 }, // -
+ { 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 }, // .
+ { 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 }, // /
+ { 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E }, // 0
+ { 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 }, // 1
+ { 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 }, // 2
+ { 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 }, // 3
+ { 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 }, // 4
+ { 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 }, // 5
+ { 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 }, // 6
+ { 0x00, 0x01, 0x71, 0x09, 0x05, 0x03 }, // 7
+ { 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 }, // 8
+ { 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E }, // 9
+ { 0x00, 0x00, 0x36, 0x36, 0x00, 0x00 }, // :
+ { 0x00, 0x00, 0x56, 0x36, 0x00, 0x00 }, // ;
+ { 0x00, 0x08, 0x14, 0x22, 0x41, 0x00 }, // <
+ { 0x00, 0x14, 0x14, 0x14, 0x14, 0x14 }, // =
+ { 0x00, 0x00, 0x41, 0x22, 0x14, 0x08 }, // >
+ { 0x00, 0x02, 0x01, 0x51, 0x09, 0x06 }, // ?
+ { 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E }, // @
+ { 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C }, // A
+ { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 }, // B
+ { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 }, // C
+ { 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C }, // D
+ { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 }, // E
+ { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 }, // F
+ { 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A }, // G
+ { 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F }, // H
+ { 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 }, // I
+ { 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 }, // J
+ { 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 }, // K
+ { 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 }, // L
+ { 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F }, // M
+ { 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F }, // N
+ { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E }, // O
+ { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 }, // P
+ { 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E }, // Q
+ { 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 }, // R
+ { 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 }, // S
+ { 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01 }, // T
+ { 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F }, // U
+ { 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F }, // V
+ { 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F }, // W
+ { 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 }, // X
+ { 0x00, 0x07, 0x08, 0x70, 0x08, 0x07 }, // Y
+ { 0x00, 0x61, 0x51, 0x49, 0x45, 0x43 }, // Z
+ { 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 }, // [
+ { 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55 }, // 55
+ { 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00 }, // ]
+ { 0x00, 0x04, 0x02, 0x01, 0x02, 0x04 }, // ^
+ { 0x00, 0x40, 0x40, 0x40, 0x40, 0x40 }, // _
+ { 0x00, 0x00, 0x01, 0x02, 0x04, 0x00 }, // '
+ { 0x00, 0x20, 0x54, 0x54, 0x54, 0x78 }, // a
+ { 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 }, // b
+ { 0x00, 0x38, 0x44, 0x44, 0x44, 0x20 }, // c
+ { 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F }, // d
+ { 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 }, // e
+ { 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 }, // f
+ { 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C }, // g
+ { 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 }, // h
+ { 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 }, // i
+ { 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00 }, // j
+ { 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 }, // k
+ { 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 }, // l
+ { 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 }, // m
+ { 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 }, // n
+ { 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 }, // o
+ { 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 }, // p
+ { 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC }, // q
+ { 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 }, // r
+ { 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 }, // s
+ { 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 }, // t
+ { 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C }, // u
+ { 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C }, // v
+ { 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C }, // w
+ { 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 }, // x
+ { 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C }, // y
+ { 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 }, // z
+ { 0x14, 0x14, 0x14, 0x14, 0x14, 0x14 }, // horiz lines
+};
+
+/****************************************8*16的点阵************************************/
+static const unsigned char F8X16[]=
+{
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
+ 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
+ 0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
+ 0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
+ 0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
+ 0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
+ 0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
+ 0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
+ 0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
+ 0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
+ 0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
+ 0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
+ 0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
+ 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
+ 0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
+ 0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
+ 0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
+ 0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
+ 0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
+ 0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
+ 0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
+ 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
+ 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
+ 0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
+ 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
+ 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
+ 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
+ 0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
+ 0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
+ 0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
+ 0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
+ 0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
+ 0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
+ 0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
+ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
+ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
+ 0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
+ 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
+ 0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
+ 0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
+ 0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
+ 0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
+ 0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
+ 0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
+ 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
+ 0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
+ 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
+ 0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
+ 0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
+ 0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
+ 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
+ 0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
+ 0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
+ 0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
+ 0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
+ 0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
+ 0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
+ 0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
+ 0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
+ 0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
+ 0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
+ 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
+ 0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
+ 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
+ 0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
+ 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
+ 0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
+ 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
+ 0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
+ 0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
+ 0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
+ 0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
+ 0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
+ 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
+ 0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
+ 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
+ 0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
+ 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
+ 0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
+ 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
+ 0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
+ 0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
+ 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
+ 0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
+ 0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
+ 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
+ 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
+ 0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
+ 0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
+ 0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
+ 0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
+};
+
+#endif
\ No newline at end of file
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_ssd1306.c b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_ssd1306.c
new file mode 100644
index 0000000000000000000000000000000000000000..0578918ebddafe0400de5211cee82b89f53a5b12
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_ssd1306.c
@@ -0,0 +1,198 @@
+#include
+#include
+#include "oled_ssd1306.h"
+#include "iot_gpio.h"
+#include "iot_i2c.h"
+#include "iot_errno.h"
+#include "oled_fonts.h"
+
+#define ARRAY_SIZE(a) sizeof(a)/sizeof(a[0])
+
+#define OLED_I2C_IDX 0
+
+#define OLED_WIDTH (128)
+#define OLED_I2C_ADDR 0x78 // 默认地址为 0x78
+#define OLED_I2C_CMD 0x00 // 0000 0000 写命令
+#define OLED_I2C_DATA 0x40 // 0100 0000(0x40) 写数据
+#define OLED_I2C_BAUDRATE (400*1000) // 400k
+
+#define DELAY_100_MS (100*1000)
+
+
+// unsigned int I2cSetBaudrate(WifiIotI2cIdx id, unsigned int baudrate);
+typedef struct {
+ /** Pointer to the buffer storing data to send */
+ unsigned char *sendBuf;
+ /** Length of data to send */
+ unsigned int sendLen;
+ /** Pointer to the buffer for storing data to receive */
+ unsigned char *receiveBuf;
+ /** Length of data received */
+ unsigned int receiveLen;
+} IotI2cData;
+
+static uint32_t I2cWiteByte(uint8_t regAddr, uint8_t byte)
+{
+ unsigned int id = OLED_I2C_IDX;
+ uint8_t buffer[] = {regAddr, byte};
+ IotI2cData i2cData = {0};
+
+ i2cData.sendBuf = buffer;
+ i2cData.sendLen = sizeof(buffer)/sizeof(buffer[0]);
+
+ return IoTI2cWrite(id, OLED_I2C_ADDR, i2cData.sendBuf, i2cData.sendLen);
+}
+
+/**
+ * @brief Write a command byte to OLED device.
+ *
+ * @param cmd the commnad byte to be writen.
+ * @return Returns {@link IOT_SUCCESS} if the operation is successful;
+ * returns an error code defined in {@link wifiiot_errno.h} otherwise.
+ */
+static uint32_t WriteCmd(uint8_t cmd)
+{
+ return I2cWiteByte(OLED_I2C_CMD, cmd);
+}
+
+/**
+ * @brief Write a data byte to OLED device.
+ *
+ * @param cmd the data byte to be writen.
+ * @return Returns {@link IOT_SUCCESS} if the operation is successful;
+ * returns an error code defined in {@link wifiiot_errno.h} otherwise.
+ */
+static uint32_t WriteData(uint8_t data)
+{
+ return I2cWiteByte(OLED_I2C_DATA, data);
+}
+
+/**
+ * @brief ssd1306 OLED Initialize.
+ */
+uint32_t OledInit(void)
+{
+ static const uint8_t initCmds[] = {
+ 0xAE, // --display off
+ 0x00, // ---set low column address
+ 0x10, // ---set high column address
+ 0x40, // --set start line address
+ 0xB0, // --set page address
+ 0x81, // contract control
+ 0xFF, // --128
+ 0xA1, // set segment remap
+ 0xA6, // --normal / reverse
+ 0xA8, // --set multiplex ratio(1 to 64)
+ 0x3F, // --1/32 duty
+ 0xC8, // Com scan direction
+ 0xD3, // -set display offset
+ 0x00, //
+ 0xD5, // set osc division
+ 0x80, //
+ 0xD8, // set area color mode off
+ 0x05, //
+ 0xD9, // Set Pre-Charge Period
+ 0xF1, //
+ 0xDA, // set com pin configuartion
+ 0x12, //
+ 0xDB, // set Vcomh
+ 0x30, //
+ 0x8D, // set charge pump enable
+ 0x14, //
+ 0xAF, // --turn on oled panel
+ };
+
+ IoTGpioInit(13);
+ hi_io_set_func(13, 6);
+ IoTGpioInit(14);
+ hi_io_set_func(14, 6);
+
+ IoTI2cInit(0, OLED_I2C_BAUDRATE);
+
+ for (size_t i = 0; i < ARRAY_SIZE(initCmds); i++) {
+ uint32_t status = WriteCmd(initCmds[i]);
+ if (status != IOT_SUCCESS) {
+ return status;
+ }
+ }
+ return IOT_SUCCESS;
+}
+
+void OledSetPosition(uint8_t x, uint8_t y)
+{
+ WriteCmd(0xb0 + y);
+ WriteCmd(((x & 0xf0) >> 4) | 0x10);
+ WriteCmd(x & 0x0f);
+}
+
+/*全屏填充*/
+void OledFillScreen(uint8_t fillData)
+{
+ uint8_t m = 0;
+ uint8_t n = 0;
+
+ for (m=0; m < 8; m++) {
+ WriteCmd(0xb0 + m);
+ WriteCmd(0x00);
+ WriteCmd(0x10);
+
+ for (n=0; n < 128; n++) {
+ WriteData(fillData);
+ }
+ }
+}
+
+/**
+ * @brief 8*16 typeface
+ * @param x: write positon start from x axis
+ * @param y: write positon start from y axis
+ * @param ch: write data
+ * @param font: selected font
+ */
+void OledShowChar(uint8_t x, uint8_t y, uint8_t ch, Font font)
+{
+ uint8_t c = 0;
+ uint8_t i = 0;
+
+ c = ch - ' '; //得到偏移后的值
+ if (x > OLED_WIDTH - 1) {
+ x = 0;
+ y = y + 2;
+ }
+
+ if (font == FONT8x16) {
+ OledSetPosition(x, y);
+ for (i = 0; i < 8; i++){
+ WriteData(F8X16[c*16 + i]);
+ }
+
+ OledSetPosition(x, y+1);
+ for (i = 0; i < 8; i++) {
+ WriteData(F8X16[c*16 + i + 8]);
+ }
+ } else {
+ OledSetPosition(x, y);
+ for (i = 0; i < 6; i++) {
+ WriteData(F6x8[c][i]);
+ }
+ }
+}
+
+void OledShowString(uint8_t x, uint8_t y, const char* str, Font font)
+{
+ uint8_t j = 0;
+ if (str == NULL) {
+ printf("param is NULL,Please check!!!\r\n");
+ return;
+ }
+
+ while (str[j]) {
+ OledShowChar(x, y, str[j], font);
+ x += 8;
+ if (x > 120) {
+ x = 0;
+ y += 2;
+ }
+ j++;
+ }
+}
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_ssd1306.h b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_ssd1306.h
new file mode 100644
index 0000000000000000000000000000000000000000..4dfaaf430c9155a82be5dcdec998902ff99f59cd
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/oled/oled_ssd1306.h
@@ -0,0 +1,32 @@
+#ifndef OLED_SSD1306_H
+#define OLED_SSD1306_H
+
+#include
+
+/**
+ * @brief ssd1306 OLED Initialize.
+ */
+uint32_t OledInit(void);
+
+/**
+ * @brief Set cursor position
+ *
+ * @param x the horizontal posistion of cursor
+ * @param y the vertical position of cursor
+ * @return Returns {@link WIFI_IOT_SUCCESS} if the operation is successful;
+ * returns an error code defined in {@link wifiiot_errno.h} otherwise.
+ */
+void OledSetPosition(uint8_t x, uint8_t y);
+
+void OledFillScreen(uint8_t fillData);
+
+enum Font {
+ FONT6x8 = 1,
+ FONT8x16
+};
+typedef enum Font Font;
+
+void OledShowChar(uint8_t x, uint8_t y, uint8_t ch, Font font);
+void OledShowString(uint8_t x, uint8_t y, const char* str, Font font);
+
+#endif // OLED_SSD1306_H
diff --git a/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/ssd1306_test.c b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/ssd1306_test.c
new file mode 100644
index 0000000000000000000000000000000000000000..68b596d6a17148644246be12d7cc85b92b972652
--- /dev/null
+++ b/src/application/drivers_sample/adc/sample_adc_sync_sample_yali/ssd1306_test.c
@@ -0,0 +1,87 @@
+#include
+#include
+#include
+
+#include "ohos_init.h"
+#include "cmsis_os2.h"
+#include "iot_gpio.h"
+#include "hi_io.h"
+#include "hi_time.h"
+#include "ssd1306.h"
+#include "iot_i2c.h"
+#include "iot_watchdog.h"
+#include "robot_control.h"
+#include "iot_errno.h"
+
+#define OLED_I2C_BAUDRATE 400*1000
+#define GPIO13 13
+#define GPIO14 14
+#define FUNC_SDA 6
+#define FUNC_SCL 6
+extern unsigned char g_car_status;
+extern void HX711_Read(void);
+
+void Ssd1306TestTask(void* arg)
+{
+ (void) arg;
+ hi_io_set_func(GPIO13, FUNC_SDA);
+ hi_io_set_func(GPIO14, FUNC_SCL);
+ IoTI2cInit(0, OLED_I2C_BAUDRATE);
+
+ IoTWatchDogDisable();
+
+ usleep(20*1000);
+ ssd1306_Init();
+ ssd1306_Fill(Black);
+ ssd1306_SetCursor(0, 0);
+ ssd1306_DrawString("Hello OpenHarmony!", Font_7x10, White);
+
+ uint32_t start = HAL_GetTick();
+ ssd1306_UpdateScreen();
+ uint32_t end = HAL_GetTick();
+ printf("ssd1306_UpdateScreen time cost: %d ms.\r\n", end - start);
+ osDelay(100);
+
+ while (1)
+ {
+ printf("g_car_status is %d\r\n",g_car_status);
+ ssd1306_Fill(Black);
+ ssd1306_SetCursor(10, 10);
+ // if(g_car_status == CAR_OBSTACLE_AVOIDANCE_STATUS) {
+
+ // ssd1306_DrawString("ultrasonic", Font_7x10, White);
+
+ // }
+ // else if (g_car_status == CAR_STOP_STATUS)
+ // {
+ // ssd1306_DrawString("Robot Car Stop", Font_7x10, White);
+ // }
+ // else if (g_car_status == CAR_TRACE_STATUS)
+ // {
+ // ssd1306_DrawString("trace", Font_7x10, White);
+ // }
+ int yali = HX711_Read();
+ ssd1306_DrawString("yali:"+yali, Font_7x10, White);
+ ssd1306_UpdateScreen();
+ osDelay(10);
+ }
+
+}
+
+void Ssd1306TestDemo(void)
+{
+ osThreadAttr_t attr;
+
+ attr.name = "Ssd1306Task";
+ attr.attr_bits = 0U;
+ attr.cb_mem = NULL;
+ attr.cb_size = 0U;
+ attr.stack_mem = NULL;
+ attr.stack_size = 10240;
+ attr.priority = 25;
+
+ if (osThreadNew(Ssd1306TestTask, NULL, &attr) == NULL) {
+ printf("[Ssd1306TestDemo] Falied to create Ssd1306TestTask!\n");
+ }
+}
+APP_FEATURE_INIT(Ssd1306TestDemo);