简体   繁体   English

在Raspberry Pi上为C设置i2c?

[英]Setting up i2c on Raspberry Pi for C?

I'm setting up i2c for an Application written in C, but I've not been able to find any how-to's for it. 我正在为用C编写的应用程序设置i2c,但我无法找到任何方法。 I'm running a model-b Raspberry Pi on Debian 6 with LXDE. 我正在使用LXDE在Debian 6上运行模型-b Raspberry Pi。 Can anybody show me how to set up i2c so I can use it in a C Application? 任何人都可以告诉我如何设置i2c,以便我可以在C应用程序中使用它吗?

Thanks for any help in advance 在此先感谢您的帮助

I've been looking for similar information and I found a couple of i2c tutorials, one in adafruit tutorials and the other in Guy Carpenter's Gaugette blog . 我一直在寻找类似的信息,我发现了一些i2c教程,一个是adafruit教程 ,另一个是Guy Carpenter的Gaugette博客 I'm not yet at the stage of actually using it so I can't vouch for their completeness but they seem to be a good start. 我还没有达到实际使用它的阶段,所以我不能保证它们的完整性,但它们似乎是一个良好的开端。

try this : 试试这个 :

C GPIO Interface library for the Raspberry Pi 用于Raspberry Pi的C GPIO接口库

It offers API for handling GPIO port on Raspberry, including dedicated functions for I2C interface. 它提供了用于处理Raspberry上GPIO端口的API,包括用于I2C接口的专用功能。 I've been using this to read measurements from temperature sensor and it works perfect (STCN75 connected to RPi rev. B). 我一直用这个来读取温度传感器的测量数据并且工作正常(STCN75连接到RPi rev.B)。

You can find examples and instructions on author's website. 您可以在作者的网站上找到示例和说明。 Project is maintained and updated frequently on public Git repo. 项目在公共Git仓库中经常维护和更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM