当前位置:网站首页>[development tutorial 8] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - triaxial meter pace
[development tutorial 8] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - triaxial meter pace
2022-07-26 16:49:00 【efans_ Mike】
Bluetooth heart rate waterproof SPORTS BRACELET
—— Crazy shell · Intelligent wearable development series
Three axis meter step
Three axis step recording
1 Related introduction
This time , We will use DA14580 The hardware I2C Read the steps of the three-axis Sensor .
I2C Bus is a programmable control bus that provides support for circuit communication in the system , It is a software defined two-wire communication protocol .
Two lines I2C The serial interface includes a serial data line (SDA) And a serial clock line (SCL);
Support two traffic speeds , The standard model (0~100Kb/s) And fast mode ( Less than or equal to 400Kb/s);
Clock synchronization ;
32 Send and receive bytes FIFO;
Host send and receive operations ;
7 or 10 Bit address ,7 or 10 Bit mixed format sending ;
Block sending mode ;
The default slave address is 0x055;
Interrupt or poll operation mode ;
Programmable data line hold time ;
The three-axis sensor used this time is LIS2DS12.LIS2DS12 It is an ultra-low power high-performance three-axis linear accelerometer , With user selectable size 2G/4G/8G/16G, Be able to measure the output data rate from 1Hz To 6400Hz Acceleration . And it has integrated 256 First in first out (FIFO) Buffer , Let users store data , Limit host processor intervention .LIS2DS12 Support SPI and I2C Two interfaces , What we use here is I2C Interface .
2 Hardware design
LIS2DS12 Altogether 12 Pin .1 foot SCL It's a clock signal .2 foot CS yes SPI/I2C Enable pin . The first 3 The pin is SPI Data output of , Because of the I2C, This pin is free . Pin SDA yes I2C Used to transmit data . There are two broken legs INT1、INT2, After the open , When LIS2DS12 Steps detected , Can generate interrupt level .
chart 1
3 software design
First , Complete system initialization , call system_init(), You can refer to the previous electricity detection . Pick up Next Come on Just yes I2C Of send use 了 . The first One Step I People with Set up I2C Of phase Turn off lead foot .
GPIO_ConfigurePin(I2C_GPIO_PORT, I2C_SCL_PIN, INPUT, PID_I2C_SCL, false);
GPIO_ConfigurePin(I2C_GPIO_PORT, I2C_SDA_PIN, INPUT, PID_I2C_SDA, false);
The second step , It is initialized through the following function I2C.
Code 1
complete I2C After the initialization of , We can go through i2c_eeprom_read_byte(uint32_taddress, uint8_t *byte) Yes LIS2DS12 Into the That's ok read fuck do , through too
i2c_eeprom_write_byte(uint32_t address, uint8_t byte) Yes LIS2DS12 Write operation .
adopt I2C Read write function of , Yes LIS2DS12 Register for reading and writing , Can use LIS2DS12. Details can be inquired LIS2DS12 Of datasheet.
First , We are calling functions status_t LIS2DS12_ACC_R_WHO_AM_I_BIT(u8_t *value) read take set up To prepare ID , sentence set yes no by just indeed Of set up To prepare . however after , I People transfer use LIS2DS12_ACC_W_SOFT_RESET(LIS2DS12_ACC_SOFT_RESET_t newValue), Software initialization LIS2DS12 equipment . If the reading device is wrong or the software initialization is unsuccessful ,DA14580 Will enter an empty loop . Last , We will enter Loop_Test_Pedometer(), Step test .
Code 2
4 Experimental phenomena
First , Plug it in Jlink and USB To serial port , Then open the serial port debugging assistant .
(1) Select serial port number , In our picture is COM1, This is selected according to the actual situation .
(2) Configure serial port parameters , The baud rate is 115200, Data bits 8, Stop bit 1, There is no check bit and control flow , Consistent with the figure below .
(3) Click to open the serial port .
chart 2
After configuring the serial port , Open the code we provided .
(1) Click the simulation button .
chart 3
(2) Click Run code .
chart 4
Complete the above , You will see the serial port debugging assistant area 4 The number of steps will be displayed in , We shake the SCM , You will find that the serial port debugging assistant prints out the new number of steps , And the number of steps is increasing .
chart 5
边栏推荐
- The difference between anonymous methods and lambda expressions
- "Green is better than blue". Why is TPC the last white lotus to earn interest with money
- Tcpdump命令详解
- Current limiting comparison: how to choose sentinel vs hystrix?
- 搭建typora图床
- 我的sql没问题为什么还是这么慢|MySQL加锁规则
- Sharing of 40 completed projects of high-quality information management specialty [source code + Thesis] (VI)
- TDengine 落地协鑫能科,数百亿数据压缩至 600GB
- Differences between the use of structs and classes
- 什么是分布式定时任务框架?
猜你喜欢

Docker install redis? How to configure persistence policy?

Use verdaccio to build your own NPM private library

40个高质量信息管理专业毕设项目分享【源码+论文】(六)

Win11系统如何一键进行重装?

抓包与发流软件与网络诊断

Marxan模型保护区优化与保护空缺甄选技术、InVEST生态系统中的应用

guetzli简单使用

Current limiting comparison: how to choose sentinel vs hystrix?

结构体和类使用的区别

PXE efficient batch network installation
随机推荐
2022软件测试技能 Postman+newman+jenkins 持续集成 实战教程
It turns out that cappuccino information security association does this. Let's have a look.
How to implement Devops with automation tools | including low code and Devops application practice
Nacos win10 安装配置教程
中金证券vip账户找谁开安全啊?
【开发教程8】疯壳·开源蓝牙心率防水运动手环-三轴计步伐
操作系统迁移实战之在openEuler上部署MySQL数据库
Packet capturing and streaming software and network diagnosis
Want the clouds in the picture to float? Video editing services can be achieved in three steps with one click
[arm learning (9) ARM compiler understanding learning (armcc/armclang)]
营销指南 | 几种常见的微博营销打法
Operating system migration practice: deploying MySQL database on openeuler
Win11怎么自动清理回收站?
抓包与发流软件与网络诊断
Docker install redis? How to configure persistence policy?
Wechat applet - network data request
Tcpdump命令详解
Alibaba Cloud Toolkit —— 项目一键部署工具
Thinkphp历史漏洞复现
TensorFlow Lite源码解析