公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Translation_Bot
Community Manager
Community Manager
Community Manager
我需要所需的PSoC™ 6 I2C 以及与 BMP 280 温度EVAL_PASCO2_SENSOR示例代码的接口。

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-6/I2C-BMP-280-temperature-sensor-sample-code/td-p/689529

0 点赞
4 回复数
Translation_Bot
Community Manager
Community Manager
Community Manager

你好@Helloo_world123,

你可以试试这个主题
中的BMP280库,并将 I2C 初始化到库中。

例如

 

cy_stc_scb_i2c_context_t i2cContext;

extern bmp280_obj bmp280;
uint32_t bmp_write_bytes(uint8_t addr, uint8_t *data, uint8_t dataLen, uint32_t timeout)
{
	cy_en_scb_i2c_status_t status=0;
	if( Cy_SCB_I2C_MasterSendStart(i2c_HW, (uint32_t)addr, CY_SCB_I2C_WRITE_XFER, timeout, &i2cContext) == CY_SCB_I2C_SUCCESS )
	{
		for(uint8_t i = 0; i

 


热烈的问候
Andri

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-6/I2C-BMP-280-temperature-sensor-sample-code/m-p/689752

0 点赞
Translation_Bot
Community Manager
Community Manager
Community Manager

嗨,

 

PSOC6- 不提供这些功能。

Cy_SCB_I2C_MasterSendStart(i2c_HW, (uint32_t)addr, CY_SCB_I2C_WRITE_XFER, timeout, &i2cContext)

我能否像下面这样更改上述函数?

uint32_t bmp_write_bytes(uint8_t addr, uint8_t *data, uint8_t dataLen, uint32_t timeout)
{
cy_en_scb_i2c_status_t status;
status=cyhal_i2c_master_write(mI2C,(uint16_t) addr, data,(uint16_t) dataLen, timeout, true);
return (uint32_t)status;
}

我在 PSOC6 中使用了 cyhal_i2c_master_write 和 cyhal_i2c_master_read 函数

请为我指点迷津。

谢谢

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-6/I2C-BMP-280-temperature-sensor-sample-code/m-p/691813

0 点赞
Translation_Bot
Community Manager
Community Manager
Community Manager

你好@Helloo_world123

Cy_SCB_I2C_MasterSendStart(i2c_HW, (uint32_t)addr, CY_SCB_I2C_WRITE_XFER, timeout, &i2cContext)

这些功能使用 PDL,需要通过设备配置器配置外设。

您也可以使用 HAL。
这对你来说会更容易。

热烈问候
Andri

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-6/I2C-BMP-280-temperature-sensor-sample-code/m-p/693333

0 点赞
Translation_Bot
Community Manager
Community Manager
Community Manager

嗨,

曾经,我在www.electromaker.io上发布了以下示例代码

由于ModusToolbox™项目太大,无法在此处发布。

https://www.electromaker.io/project/view/a-simple-sensor-server-using-cy8ckit-062-wifi-bt

摩托

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-6/I2C-BMP-280-temperature-sensor-sample-code/m-p/692033

0 点赞