moved i2c driver init
This commit is contained in:
parent
723a07d87b
commit
a243ec441e
@ -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
|
* Initialize all hard- and software components that are needed for the I2C
|
||||||
* communication.
|
* communication.
|
||||||
*/
|
*/
|
||||||
void sensirion_i2c_hal_init(int SDA, int SCL);
|
void sensirion_i2c_hal_init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release all resources initialized by sensirion_i2c_hal_init().
|
* Release all resources initialized by sensirion_i2c_hal_init().
|
||||||
|
@ -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
|
* Initialize all hard- and software components that are needed for the I2C
|
||||||
* communication.
|
* communication.
|
||||||
*/
|
*/
|
||||||
void sensirion_i2c_hal_init(int SDA, int SCL) {
|
void sensirion_i2c_hal_init() {
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release all resources initialized by sensirion_i2c_hal_init().
|
* Release all resources initialized by sensirion_i2c_hal_init().
|
||||||
*/
|
*/
|
||||||
void sensirion_i2c_hal_free(void) {
|
void sensirion_i2c_hal_free(void) {
|
||||||
i2c_driver_delete(I2C_NUM_0); /* TODO:non const port */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user