moved i2c driver init

This commit is contained in:
leo 2022-11-19 15:43:58 +01:00
parent 723a07d87b
commit a243ec441e
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB
2 changed files with 4 additions and 16 deletions

View File

@ -54,7 +54,7 @@ int16_t sensirion_i2c_hal_select_bus(uint8_t bus_idx);
* Initialize all hard- and software components that are needed for the I2C
* communication.
*/
void sensirion_i2c_hal_init(int SDA, int SCL);
void sensirion_i2c_hal_init();
/**
* Release all resources initialized by sensirion_i2c_hal_init().

View File

@ -65,27 +65,15 @@ int16_t sensirion_i2c_hal_select_bus(uint8_t bus_idx) {
* Initialize all hard- and software components that are needed for the I2C
* communication.
*/
void sensirion_i2c_hal_init(int SDA, int SCL) {
int i2c_master_port = I2C_NUM_0;
i2c_config_t conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = SDA, // select GPIO specific to your project
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_io_num = SCL, // select GPIO specific to your project
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master.clk_speed = 10000, // select frequency specific to your project
// .clk_flags = 0, /*!< Optional, you can use I2C_SCLK_SRC_FLAG_* flags to choose i2c source clock here. */
};
i2c_param_config(i2c_master_port, &conf);
i2c_driver_install(i2c_master_port, I2C_MODE_MASTER, 0, 0, 0);
void sensirion_i2c_hal_init() {
}
/**
* Release all resources initialized by sensirion_i2c_hal_init().
*/
void sensirion_i2c_hal_free(void) {
i2c_driver_delete(I2C_NUM_0); /* TODO:non const port */
}
/**