亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码
標題:
MAX30102+stm32測心率血氧源碼
[打印本頁]
作者:
qinyu10
時間:
2018-4-16 12:55
標題:
MAX30102+stm32測心率血氧源碼
MAX30102+stm32測心率血氧
只留下MAX30102、main、I2C、算法、四個文件就行,在I2C中改一下IO
單片機源程序如下:
/** \file max30102.cpp ******************************************************
*
* Project: MAXREFDES117#
* Filename: max30102.cpp
* Description: This module is an embedded controller driver for the MAX30102
*
* Revision History:
*\n 1-18-2016 Rev 01.00 GL Initial release.
*\n
*/
#include "max30102.h"
#include "myiic.h"
#define max30102_WR_address 0xAE
bool maxim_max30102_write_reg(uint8_t uch_addr, uint8_t uch_data)
/**
* \brief Write a value to a MAX30102 register
* \par Details
* This function writes a value to a MAX30102 register
*
* \param[in] uch_addr - register address
* \param[in] uch_data - register data
*
* \retval true on success
*/
{
/* 第1步:發起I2C總線啟動信號 */
i2c_Start();
/* 第2步:發起控制字節,高7bit是地址,bit0是讀寫控制位,0表示寫,1表示讀 */
i2c_SendByte(max30102_WR_address | I2C_WR); /* 此處是寫指令 */
/* 第3步:發送ACK */
if (i2c_WaitAck() != 0)
{
goto cmd_fail; /* EEPROM器件無應答 */
}
/* 第4步:發送字節地址 */
i2c_SendByte(uch_addr);
if (i2c_WaitAck() != 0)
{
goto cmd_fail; /* EEPROM器件無應答 */
}
/* 第5步:開始寫入數據 */
i2c_SendByte(uch_data);
/* 第6步:發送ACK */
if (i2c_WaitAck() != 0)
{
goto cmd_fail; /* EEPROM器件無應答 */
}
/* 發送I2C總線停止信號 */
i2c_Stop();
return true; /* 執行成功 */
cmd_fail: /* 命令執行失敗后,切記發送停止信號,避免影響I2C總線上其他設備 */
/* 發送I2C總線停止信號 */
i2c_Stop();
return false;
}
bool maxim_max30102_read_reg(uint8_t uch_addr, uint8_t *puch_data)
/**
* \brief Read a MAX30102 register
* \par Details
* This function reads a MAX30102 register
*
* \param[in] uch_addr - register address
* \param[out] puch_data - pointer that stores the register data
*
* \retval true on success
*/
{
/* 第1步:發起I2C總線啟動信號 */
i2c_Start();
/* 第2步:發起控制字節,高7bit是地址,bit0是讀寫控制位,0表示寫,1表示讀 */
i2c_SendByte(max30102_WR_address | I2C_WR); /* 此處是寫指令 */
/* 第3步:發送ACK */
if (i2c_WaitAck() != 0)
{
goto cmd_fail; /* EEPROM器件無應答 */
}
/* 第4步:發送字節地址, */
i2c_SendByte((uint8_t)uch_addr);
if (i2c_WaitAck() != 0)
{
goto cmd_fail; /* EEPROM器件無應答 */
}
/* 第6步:重新啟動I2C總線。下面開始讀取數據 */
i2c_Start();
/* 第7步:發起控制字節,高7bit是地址,bit0是讀寫控制位,0表示寫,1表示讀 */
i2c_SendByte(max30102_WR_address | I2C_RD); /* 此處是讀指令 */
/* 第8步:發送ACK */
if (i2c_WaitAck() != 0)
{
goto cmd_fail; /* EEPROM器件無應答 */
}
/* 第9步:讀取數據 */
{
*puch_data = i2c_ReadByte(); /* 讀1個字節 */
i2c_NAck(); /* 最后1個字節讀完后,CPU產生NACK信號(驅動SDA = 1) */
}
/* 發送I2C總線停止信號 */
i2c_Stop();
return true; /* 執行成功 返回data值 */
cmd_fail: /* 命令執行失敗后,切記發送停止信號,避免影響I2C總線上其他設備 */
/* 發送I2C總線停止信號 */
i2c_Stop();
return false;
}
bool maxim_max30102_init(void)
/**
* \brief Initialize the MAX30102
* \par Details
* This function initializes the MAX30102
*
* \param None
*
* \retval true on success
*/
{
if(!maxim_max30102_write_reg(REG_INTR_ENABLE_1, 0xc0)) // INTR setting
return false;
if(!maxim_max30102_write_reg(REG_INTR_ENABLE_2, 0x00))
return false;
if(!maxim_max30102_write_reg(REG_FIFO_WR_PTR, 0x00)) //FIFO_WR_PTR[4:0]
return false;
if(!maxim_max30102_write_reg(REG_OVF_COUNTER, 0x00)) //OVF_COUNTER[4:0]
return false;
if(!maxim_max30102_write_reg(REG_FIFO_RD_PTR, 0x00)) //FIFO_RD_PTR[4:0]
return false;
if(!maxim_max30102_write_reg(REG_FIFO_CONFIG, 0x6f)) //sample avg = 8, fifo rollover=false, fifo almost full = 17
return false;
if(!maxim_max30102_write_reg(REG_MODE_CONFIG, 0x03)) //0x02 for Red only, 0x03 for SpO2 mode 0x07 multimode LED
return false;
if(!maxim_max30102_write_reg(REG_SPO2_CONFIG, 0x2F)) // SPO2_ADC range = 4096nA, SPO2 sample rate (400 Hz), LED pulseWidth (411uS)
return false;
if(!maxim_max30102_write_reg(REG_LED1_PA, 0x17)) //Choose value for ~ 4.5mA for LED1
return false;
if(!maxim_max30102_write_reg(REG_LED2_PA, 0x17)) // Choose value for ~ 4.5mA for LED2
return false;
if(!maxim_max30102_write_reg(REG_PILOT_PA, 0x7f)) // Choose value for ~ 25mA for Pilot LED
return false;
return true;
}
bool maxim_max30102_read_fifo(uint32_t *pun_red_led, uint32_t *pun_ir_led)
/**
* \brief Read a set of samples from the MAX30102 FIFO register
* \par Details
* This function reads a set of samples from the MAX30102 FIFO register
*
* \param[out] *pun_red_led - pointer that stores the red LED reading data
* \param[out] *pun_ir_led - pointer that stores the IR LED reading data
*
* \retval true on success
*/
{
uint32_t un_temp;
uint8_t uch_temp;
*pun_ir_led = 0;
*pun_red_led = 0;
maxim_max30102_read_reg(REG_INTR_STATUS_1, &uch_temp);
maxim_max30102_read_reg(REG_INTR_STATUS_2, &uch_temp);
/* 第1步:發起I2C總線啟動信號 */
i2c_Start();
/* 第2步:發起控制字節,高7bit是地址,bit0是讀寫控制位,0表示寫,1表示讀 */
i2c_SendByte(max30102_WR_address | I2C_WR); /* 此處是寫指令 */
/* 第3步:發送ACK */
if (i2c_WaitAck() != 0)
{
printf("read fifo failed");
goto cmd_fail; /* EEPROM器件無應答 */
}
/* 第4步:發送字節地址, */
i2c_SendByte((uint8_t)REG_FIFO_DATA);
if (i2c_WaitAck() != 0)
{
goto cmd_fail; /* EEPROM器件無應答 */
}
/* 第6步:重新啟動I2C總線。下面開始讀取數據 */
i2c_Start();
/* 第7步:發起控制字節,高7bit是地址,bit0是讀寫控制位,0表示寫,1表示讀 */
i2c_SendByte(max30102_WR_address | I2C_RD); /* 此處是讀指令 */
/* 第8步:發送ACK */
if (i2c_WaitAck() != 0)
{
goto cmd_fail; /* EEPROM器件無應答 */
}
un_temp = i2c_ReadByte();
i2c_Ack();
un_temp <<= 16;
*pun_red_led += un_temp;
un_temp = i2c_ReadByte();
i2c_Ack();
un_temp <<= 8;
*pun_red_led += un_temp;
un_temp = i2c_ReadByte();
i2c_Ack();
*pun_red_led += un_temp;
un_temp = i2c_ReadByte();
i2c_Ack();
un_temp <<= 16;
*pun_ir_led += un_temp;
un_temp = i2c_ReadByte();
i2c_Ack();
un_temp <<= 8;
*pun_ir_led += un_temp;
un_temp = i2c_ReadByte();
i2c_Ack();
*pun_ir_led += un_temp;
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
stm32 max30102上傳整數型數據.zip
(366.15 KB, 下載次數: 820)
2018-4-16 12:54 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
if巴黎不缺氧
時間:
2018-5-10 21:23
全是導航車?,用導航車的文件改的嗎?
作者:
qmby919
時間:
2018-10-11 21:02
感謝樓主分享
作者:
新富翁
時間:
2018-10-11 22:10
好東西!
作者:
迪西
時間:
2019-1-2 13:52
課程設計需要
作者:
唯愛Yoga
時間:
2019-2-18 10:23
感謝分享~~~
作者:
qtys
時間:
2019-3-1 17:31
我想問一下,在algorithm.c中an_x[k]引發#68整數轉換引發符號更改的的警告是否會對程序有影響
作者:
hujj
時間:
2019-3-1 21:27
正需要這方面的資料,但我的芯片型號不一樣,不知道有參考作用么。
作者:
quyuan
時間:
2019-3-1 22:25
謝謝,學習一下
作者:
willigohee
時間:
2019-3-15 10:04
哈哈,導航車改編,學習學習
作者:
Abc_zh
時間:
2019-4-18 09:53
為什么Spo2全是-999,好奇怪
作者:
探路
時間:
2019-5-16 12:27
Abc_zh 發表于 2019-4-18 09:53
為什么Spo2全是-999,好奇怪
請問你解決這個問題了ma?
作者:
探路
時間:
2019-5-16 14:21
Abc_zh 發表于 2019-4-18 09:53
為什么Spo2全是-999,好奇怪
解決了嗎?
作者:
rxlu
時間:
2019-6-17 15:52
學習一下
作者:
的官方回復
時間:
2019-8-15 16:27
根本用不了,這個算法不知道怎么回事,一直弄不對
作者:
的官方回復
時間:
2019-8-15 16:34
有穩定的值但是算法后出來是不行的red=107909, ir=94091
作者:
962543988
時間:
2019-11-11 14:49
有元器件清單和原理圖嗎
作者:
user2402163
時間:
2020-3-21 20:40
下載一次扣一次嗎?謝謝樓主共享
作者:
esmember
時間:
2020-4-15 16:25
這個支持,我這里只有c
作者:
esmember
時間:
2020-4-15 16:26
堅決支持,我這里只有c++,暈乎著呢。
作者:
mos_su77
時間:
2020-5-29 16:10
很好,謝謝
歡迎光臨 (http://www.denmoz.com/bbs/)
Powered by Discuz! X3.1