Lines Matching +full:i2c +full:- +full:speed

4  * SPDX-License-Identifier: Apache-2.0
7 #include <zephyr/drivers/i2c.h>
30 length -= 1; in get_bytes_count_for_hex()
37 * This sends I2C messages without any data (i.e. stop condition after
41 * WARNING: As there is no standard I2C detection command, this code
44 * your I2C bus, cause data loss, and is known to corrupt the Atmel
47 * https://manpages.debian.org/buster/i2c-tools/i2cdetect.8.en.html
49 /* i2c scan <device> */
59 shell_error(shell_ctx, "I2C: Device driver %s not found.", in cmd_i2c_scan()
61 return -ENODEV; in cmd_i2c_scan()
86 shell_fprintf(shell_ctx, SHELL_NORMAL, "-- "); in cmd_i2c_scan()
98 /* i2c recover <device> */
107 shell_error(shell_ctx, "I2C: Device driver %s not found.", in cmd_i2c_recover()
109 return -ENODEV; in cmd_i2c_recover()
114 shell_error(shell_ctx, "I2C: Bus recovery failed (err %d)", in cmd_i2c_recover()
130 uint8_t buf[MAX_I2C_BYTES + MAX_BYTES_FOR_REGISTER_INDEX - 1]; in i2c_write_from_buffer()
140 shell_error(shell_ctx, "I2C: Device driver %s not found.", in i2c_write_from_buffer()
142 return -ENODEV; in i2c_write_from_buffer()
152 data_length = MAX_I2C_BYTES - reg_addr_bytes; in i2c_write_from_buffer()
154 MAX_I2C_BYTES - reg_addr_bytes); in i2c_write_from_buffer()
163 buf + MAX_BYTES_FOR_REGISTER_INDEX - reg_addr_bytes, in i2c_write_from_buffer()
168 return -EIO; in i2c_write_from_buffer()
174 /* i2c write <device> <dev_addr> <reg_addr> [<byte1>, ...] */
180 &argv[4], argc - 4); in cmd_i2c_write()
183 /* i2c write_byte <device> <dev_addr> <reg_addr> <value> */
203 shell_error(shell_ctx, "I2C: Device driver %s not found.", in i2c_read_to_buffer()
205 return -ENODEV; in i2c_read_to_buffer()
220 reg_addr_buf + MAX_BYTES_FOR_REGISTER_INDEX - reg_addr_bytes, in i2c_read_to_buffer()
229 return -EIO; in i2c_read_to_buffer()
235 /* i2c read_byte <device> <dev_addr> <reg_addr> */
252 /* i2c read <device> <dev_addr> <reg_addr> [<numbytes>] */
278 /* i2c direct_read <device> <dev_addr> [<numbytes>] */
302 /* i2c speed <device> <speed>
303 * For: speed see constants like I2C_SPEED_STANDARD
310 uint32_t speed; in cmd_i2c_speed() local
315 shell_error(shell_ctx, "I2C: Device driver %s not found.", in cmd_i2c_speed()
317 return -ENODEV; in cmd_i2c_speed()
320 speed = strtol(argv[ARGV_DEV + 1], NULL, 10); in cmd_i2c_speed()
324 dev_config |= I2C_SPEED_SET(speed); in cmd_i2c_speed()
327 dev_config = I2C_MODE_CONTROLLER | I2C_SPEED_SET(speed); in cmd_i2c_speed()
332 shell_error(shell_ctx, "I2C: Failed to configure device: %s", in cmd_i2c_speed()
334 return -EIO; in cmd_i2c_speed()
343 entry->syntax = (dev != NULL) ? dev->name : NULL; in device_name_get()
344 entry->handler = NULL; in device_name_get()
345 entry->help = NULL; in device_name_get()
346 entry->subcmd = NULL; in device_name_get()
353 "Scan I2C devices\n"
357 "Recover I2C bus\n"
361 "Read bytes from an I2C device\n"
365 "Read a byte from an I2C device\n"
369 "Read byte stream directly from an I2C device without "
374 "Write bytes to an I2C device\n"
378 "Write a byte to an I2C device\n"
381 SHELL_CMD_ARG(speed, &dsub_device_name,
382 "Configure I2C bus speed\n"
383 "Usage: speed <device> <speed>",
388 SHELL_CMD_REGISTER(i2c, &sub_i2c_cmds, "I2C commands", NULL);