Lines Matching +full:bitrate +full:- +full:data
5 * SPDX-License-Identifier: Apache-2.0
18 * suitable flags, i.e. the SDA pin as open-collector/open-drain with a pull-up
37 #include "i2c-priv.h"
44 uint32_t bitrate; member
47 /* Driver instance data */
49 struct i2c_bitbang bitbang; /* Bit-bang library data */
57 gpio_pin_set_dt(&config->scl_gpio, state); in i2c_gpio_set_scl()
64 gpio_pin_set_dt(&config->sda_gpio, state); in i2c_gpio_set_sda()
70 int rc = gpio_pin_get_dt(&config->sda_gpio); in i2c_gpio_get_sda()
84 struct i2c_gpio_context *context = dev->data; in i2c_gpio_configure()
87 k_mutex_lock(&context->mutex, K_FOREVER); in i2c_gpio_configure()
89 rc = i2c_bitbang_configure(&context->bitbang, dev_config); in i2c_gpio_configure()
91 k_mutex_unlock(&context->mutex); in i2c_gpio_configure()
98 struct i2c_gpio_context *context = dev->data; in i2c_gpio_get_config()
101 k_mutex_lock(&context->mutex, K_FOREVER); in i2c_gpio_get_config()
103 rc = i2c_bitbang_get_config(&context->bitbang, config); in i2c_gpio_get_config()
108 k_mutex_unlock(&context->mutex); in i2c_gpio_get_config()
116 struct i2c_gpio_context *context = dev->data; in i2c_gpio_transfer()
119 k_mutex_lock(&context->mutex, K_FOREVER); in i2c_gpio_transfer()
121 rc = i2c_bitbang_transfer(&context->bitbang, msgs, num_msgs, in i2c_gpio_transfer()
124 k_mutex_unlock(&context->mutex); in i2c_gpio_transfer()
131 struct i2c_gpio_context *context = dev->data; in i2c_gpio_recover_bus()
134 k_mutex_lock(&context->mutex, K_FOREVER); in i2c_gpio_recover_bus()
136 rc = i2c_bitbang_recover_bus(&context->bitbang); in i2c_gpio_recover_bus()
138 k_mutex_unlock(&context->mutex); in i2c_gpio_recover_bus()
155 struct i2c_gpio_context *context = dev->data; in i2c_gpio_init()
156 const struct i2c_gpio_config *config = dev->config; in i2c_gpio_init()
160 if (!gpio_is_ready_dt(&config->scl_gpio)) { in i2c_gpio_init()
162 return -ENODEV; in i2c_gpio_init()
165 err = gpio_pin_configure_dt(&config->scl_gpio, GPIO_OUTPUT_HIGH); in i2c_gpio_init()
171 if (!gpio_is_ready_dt(&config->sda_gpio)) { in i2c_gpio_init()
173 return -ENODEV; in i2c_gpio_init()
176 err = gpio_pin_configure_dt(&config->sda_gpio, in i2c_gpio_init()
178 if (err == -ENOTSUP) { in i2c_gpio_init()
179 err = gpio_pin_configure_dt(&config->sda_gpio, in i2c_gpio_init()
187 i2c_bitbang_init(&context->bitbang, &io_fns, (void *)config); in i2c_gpio_init()
189 bitrate_cfg = i2c_map_dt_bitrate(config->bitrate); in i2c_gpio_init()
190 err = i2c_bitbang_configure(&context->bitbang, in i2c_gpio_init()
197 err = k_mutex_init(&context->mutex); in i2c_gpio_init()
213 .bitrate = DT_INST_PROP(_num, clock_frequency), \