1628|2

14

帖子

0

TA的资源

一粒金砂(中级)

楼主
 

【平头哥RVB2601创意应用开发】超声波压感sensor调试和LED/OLED显示 [复制链接]

 

1. 时间过得真快啊,转眼两周了,今年的五一很特别,继续封控,哈哈,希望早日解封吧。

 

2. 继上次I2C可以正常读取超声波压感sensor数据后,我又很顺利的调试校准了sensor,并通过LED和OLED做了显示。

 

3. Sensor校准后通过串口抓到的数据如下:

1)初始化


Welcome boot2.0!
build: Mar  5 2021 15:34:41

load img & jump to [prim]
load&jump 0x18017000,0x18017000,152628
xip...
j 0x18017044
[   0.020]<I>INIT Build:Apr  7 2022,17:03:34

===main, 138
===main, 139
[charon] usp+zforce driver version:1.0.0

[charon] dev0(0X27) toggle via fd reg

[charon] bd read dev0(0X27) whoami (rc:0 ,whoami:0X1 ,is_otp_part:1)

[charon] fd read dev0(0X27) whoami successfully (whoami:0X62)

[charon] read dev0(0X27) si rev failed! (si_rev:0XFF)

[charon] set dev0(0X27) high power mode

[charon] dev0(0X27) read tx freq:0X8

[charon] dev0(0X27) write misc regs ok!

[charon] dev0(0X27) write zforce regs ok!

[charon] dev0(0X27) write zforce gain(0x1844=0X55, rc:0)

[charon] set dev0(0X27) i2c clk src: 4MHz

[charon] dev0(0X27) fw dl start...(fw size:3397 bytes)

[charon] dev0(0X27) fw dl completed

[charon] set dev0(0X27) high power mode

[charon] dev0(0X27) cali stage 0

[charon] dev0(0X27) zforce_offset 1172

[charon] dev0(0X27) zforce_offset 1102

[charon] dev0(0X27) zforce_offset 1074

[charon] dev0(0X27) zforce_offset 1078

[charon] dev0(0X27) zforce_offset 1075

[charon] dev0(0X27) offset_middle 14 ,offset_up 15 ,offset_down 13

[charon] dev0(0X27) cali stage 1

[charon] dev0(0X27) zforce_offset 1072

[charon] dev0(0X27) zforce_offset 1072

[charon] dev0(0X27) zforce_offset 1068

[charon] dev0(0X27) zforce_offset 1064

[charon] dev0(0X27) zforce_offset 1068

[charon] dev0(0X27) offset_middle 14 ,offset_up 15 ,offset_down 13

[charon] dev0(0X27) set 0x1880=0x08

[charon] dev0(0X27) set 0x1881=0x06

[charon] dev0(0X27) set 0x1882=0xa0

[charon] dev0(0X27) set 0x1883=0x00

[charon] dev0(0X27) set 0x1884=0x03

[charon] dev0(0X27) set 0x1885=0xff

[charon] dev0(0X27) set 0x1886=0x00

[charon] dev0(0X27) set 0x1887=0x00

[charon] dev0(0X27) set 0x1888=0x05

[charon] dev0(0X27) set 0x1889=0x01

[charon] dev0(0X27) set 0x188a=0x00

[charon] dev0(0X27) set 0x188b=0xac

[charon] dev0(0X27) set 0x188c=0x07

[charon] dev0(0X27) set 0x188d=0xa8

[charon] dev0(0X27) set 0x188e=0x19

[charon] dev0(0X27) set 0x188f=0x00

[charon] dev0(0X27) set 0x1890=0x33

[charon] dev0(0X27) set 0x1891=0x03

[charon] dev0(0X27) set 0x1892=0x56

[charon] dev0(0X27) set 0x1893=0x05

[charon] dev0(0X27) set usp max contrast 0x1154=0xff

[charon] dev0(0X27) set usp noise rms 0x1157=0x0d

[charon] dev0(0X27) set zforce gain 0x1844=0x55

[charon] dev0(0X27) set zforce contrast 0x115c=0x19

[charon] dev0(0X27) set zforce noise 0x115e=0x06

[charon] dev0(0X27) set sensitivity level to 3

[charon] dev0(0X27) set algo mode(2[USP+ZForce])

[charon] dev0(0X27) init done(rc:0)!

2)正常polling数据:


[charon] dev0(0X27) ,adc 924 ,1072, key 1[released][charon] 

[charon] dev0(0X27) ,adc 933 ,1072, key 1[released][charon] 

[charon] dev0(0X27) ,adc 924 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 939 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 928 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 933 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 935 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 906 ,1072, key 1[released][charon] 

[charon] dev0(0X27) ,adc 936 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 926 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 928 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 938 ,1080, key 1[released][charon] 

[charon] dev0(0X27) ,adc 901 ,1096, key 1[released][charon] 

[charon] dev0(0X27) ,adc 872 ,1144, key 1[released][charon] 

[charon] dev0(0X27) ,adc 868 ,1216, key 1[released][charon] 

[charon] dev0(0X27) ,adc 852 ,1304, key 1[released][charon] 

[charon] dev0(0X27) ,adc 848 ,1376, key 1[released][charon] 

[charon] dev0(0X27) ,adc 831 ,1432, key 1[released][charon] 

[charon] dev0(0X27) ,adc 826 ,1472, key 1[released][charon] 

[charon] dev0(0X27) ,adc 818 ,1496, key 1[released][charon] 

[charon] dev0(0X27) ,adc 813 ,1528, key 1[released][charon] 

[charon] dev0(0X27) ,adc 800 ,1568, key 1[released][charon] 

[charon] dev0(0X27) ,adc 802 ,1624, key 1[released][charon] 

[charon] dev0(0X27) ,adc 810 ,1704, key 1[released][charon] 

[charon] dev0(0X27) ,adc 763 ,1784, key 1[released][charon] 

[charon] dev0(0X27) ,adc 777 ,1864, key 1[released][charon] 

[charon] dev0(0X27) ,adc 744 ,1968, key 1[released][charon] 

[charon] dev0(0X27) ,adc 751 ,2000, key 1[released][charon] 

[charon] dev0(0X27) ,adc 752 ,2008, key 1[released][charon] 

[charon] dev0(0X27) ,adc 727 ,2024, key 1[released][charon] 

[charon] dev0(0X27) ,adc 721 ,2032, key 1[released][charon] 

[charon] dev0(0X27) ,adc 723 ,2032, key 1[released][charon] 

[charon] dev0(0X27) ,adc 719 ,2032, key 1[released][charon] 

[charon] dev0(0X27) ,adc 703 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 709 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 700 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 707 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 688 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 683 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 688 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 680 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 679 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 674 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 672 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 670 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 672 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 654 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 674 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 662 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 676 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 664 ,2040, key 1[released][charon] 

[charon] dev0(0X27) ,adc 656 ,2032, key 1[released][charon] 

[charon] dev0(0X27) ,adc 658 ,2024, key 1[released][charon] 

[charon] dev0(0X27) ,adc 657 ,2000, key 1[released][charon] 

[charon] dev0(0X27) ,adc 655 ,1976, key 2[pressed][charon] 

[charon] dev0(0X27) ,adc 667 ,1944, key 2[pressed][charon] 

[charon] dev0(0X27) ,adc 679 ,1872, key 2[pressed][charon] 

[charon] dev0(0X27) ,adc 671 ,1832, key 2[pressed][charon] 

[charon] dev0(0X27) ,adc 657 ,1800, key 2[pressed][charon] 

从log可以看到按压时key会从1变成2,在代码里加入如下片段,

	while (1) {

		lv_task_handler();	
        for (i = 0; i < BUTTON_NUM; i++) {
			ccl_tp_dev_t *dev = &ccl_tp_dev[i];

			ccl_tp_if_get_adc(dev);
			ccl_tp_if_get_btn_status(dev);
			
            debug_info("dev%d(%#X) ,adc %d ,%d, key %d[%s]",
					dev->dev_idx,
					dev->i2c_addr,
					dev->info.usp_adc,
                    dev->info.zforce_adc,
					dev->info.btn_status,
					(dev->info.btn_status == 2) ? "pressed" : "released");  
			if(dev->info.btn_status == 2){
				csi_gpio_pin_write(&r, GPIO_PIN_HIGH);
				csi_gpio_pin_write(&g, GPIO_PIN_HIGH);
				csi_gpio_pin_write(&b, GPIO_PIN_LOW);
				lable_press();
			} else {
				csi_gpio_pin_write(&r, GPIO_PIN_HIGH);
				csi_gpio_pin_write(&g, GPIO_PIN_HIGH);
				csi_gpio_pin_write(&b, GPIO_PIN_HIGH);	
				lable_release();
			}
		}
        	debug_info("\r\n");
			aos_msleep(10);
			lv_tick_inc(1);	
			
	}
	...

即https://bbs.eeworld.com.cn/thread-1198665-1-1.html里关于LED的控制,可以看到如下视频的效果:

4. 为了进一步加强交互体验,我还加入了OLED的显示,代码如下:

lv_obj_t *p;
static void lable_test(void)
{
    p = lv_label_create(lv_scr_act(), NULL);
    lv_label_set_long_mode(p, LV_LABEL_LONG_BREAK);
    lv_label_set_align(p, LV_LABEL_ALIGN_CENTER);
    lv_obj_set_pos(p, 0, 4);
    lv_obj_set_size(p, 128, 60);
    lv_label_set_text(p, "THEAD\nMARQUEE\nDEMO");
}
static void lable_press(void)
{
	lv_label_set_text(p, "");
    lv_label_set_text(p, "Press");
}
static void lable_release(void)
{
	lv_label_set_text(p, "");
    lv_label_set_text(p, "Release");
}

最终的视频效果如下:


5. 以上就是我计划完成的作品:基于RISC-V处理器的超声波压感按键,最后再次感谢EEWORLD和平头哥提供的这次机会。

最新回复

最后的那个最终的视频效果好像确实有点状况   详情 回复 发表于 2022-5-1 22:46
点赞 关注
 
 

回复
举报

6802

帖子

0

TA的资源

五彩晶圆(高级)

沙发
 

最后的那个最终的视频效果好像确实有点状况

点评

您是指?这个效果正常的  详情 回复 发表于 2022-5-3 10:59
 
 
 

回复

14

帖子

0

TA的资源

一粒金砂(中级)

板凳
 
Jacktang 发表于 2022-5-1 22:46 最后的那个最终的视频效果好像确实有点状况

您是指?这个效果正常的

 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表