thewesdev/i2c

0.0.2

Latest
uploaded 4 hours ago
Simple I2C component for ESP32

Readme

# Simple I2C Wrapper

## Features

- i2c master init and device management
- pin/port configuration with menuconfig
- optional c++ wrapper

## Menuconfig

```bash
idf.py menuconfig
```

### Path

Component config -> I2C

### Default Configs

| I2C     | Type         | Macro              | Values   |
| ------- | ------------ | ------------------ | -------- |
| SCL     | GPIO_NUM     | CONFIG_I2C_SCL_PIN | 20       |
| SDA     | GPIO_NUM     | CONFIG_I2C_SDA_PIN | 21       |
| Port    | I2C_PORT_NUM | CONFIG_I2C_PORT    | 0        |

## Installation

### IDF Component Registry

```bash
idf.py add-dependency thewesdev/i2c
```

### Github

```bash
git clone https://github.com/thewesdev/i2c components/i2c
```

## Code Examples

### C

```c
#include "i2c.h"

void app_main() {
	i2c_master_init();
	void *dev_handle = i2c_master_add_device(0x57, 100000);

	...
}
```

### Cpp

```cpp
extern "C" void app_main() {
	i2c::master::init();
	void *dev_handle = i2c::master::add_device(0x57, 100000);
}
```

Links

Supports all targets

To add this component to your project, run:

idf.py add-dependency "thewesdev/i2c^0.0.2"

download archive

Stats

  • Archive size
    Archive size ~ 3.45 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

thewesdev/i2c version: 0.0.2
|