# SPL06-001 **Repository Path**: Oxidatio/spl06-001 ## Basic Information - **Project Name**: SPL06-001 - **Description**: 气体压力传感器 - **Primary Language**: C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-11 - **Last Updated**: 2026-01-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SPL06-001 #### 介绍 **停产** 气体压力传感器 SPL06-001 气压测量范围为 300hPa 至 1100hPa(30kPa 至 110kPa),温度测量范围为 - 40°C 至 + 85°C。可匹配多数户外与工业场景需求。 ```C // SPL06 I2C读函数 HAL库适配 int i2c_read(uint8_t slave_addr, uint8_t reg_addr, uint32_t nbytes, uint8_t* p_data) { // HAL_I2C_Mem_Read( I2C句柄, 从机地址, 寄存器地址, 地址长度, 数据缓存区, 数据长度, 超时时间 ) if (HAL_I2C_Mem_Read(&hi2c1, (slave_addr << 1), reg_addr, I2C_MEMADD_SIZE_8BIT, p_data, nbytes, 100) == HAL_OK) { return 0; // 读取成功返回0 } return -1; // 读取失败返回-1 } // SPL06 I2C写函数 HAL库适配 int i2c_write(uint8_t slave_addr, uint8_t reg_addr, uint32_t nbytes, uint8_t* p_data) { // HAL_I2C_Mem_Write( I2C句柄, 从机地址, 寄存器地址, 地址长度, 数据缓存区, 数据长度, 超时时间 ) if (HAL_I2C_Mem_Write(&hi2c1, (slave_addr << 1), reg_addr, I2C_MEMADD_SIZE_8BIT, p_data, nbytes, 100) == HAL_OK) { return 0; // 写入成功返回0 } return -1; // 写入失败返回-1 } spl06_result_t spl06_result; spl06_init(i2c_read, i2c_write); while (1) { spl06_get_result(&spl06_result); HAL_Delay(125); /* 配置了气压计检测频率为8次/秒 */ } ```