diff --git a/doc/Doxyfile b/doc/Doxyfile index 6f8b04fd6..315fcd517 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -135,6 +135,7 @@ INPUT += $(PROJECT_PATH)/components/hid-rp/include/hid-rp.hpp INPUT += $(PROJECT_PATH)/components/hid-rp/include/hid-rp-gamepad.hpp INPUT += $(PROJECT_PATH)/components/hid_service/include/hid_service.hpp INPUT += $(PROJECT_PATH)/components/i2c/include/i2c.hpp +INPUT += $(PROJECT_PATH)/components/i2c/include/i2c_menu.hpp INPUT += $(PROJECT_PATH)/components/interrupt/include/interrupt.hpp INPUT += $(PROJECT_PATH)/components/input_drivers/include/encoder_input.hpp INPUT += $(PROJECT_PATH)/components/input_drivers/include/keypad_input.hpp diff --git a/doc/en/i2c.rst b/doc/en/i2c.rst index 73b87d011..67e499449 100644 --- a/doc/en/i2c.rst +++ b/doc/en/i2c.rst @@ -4,9 +4,13 @@ I2C The `I2C` class provides a simple interface to the I2C bus. It is a wrapper around the esp-idf I2C driver. +A helper `I2cMenu` is also provided which can be used to interactively test +I2C buses - scanning the bus, probing devices, reading and writing to devices. + .. ---------------------------- API Reference ---------------------------------- API Reference ------------- .. include-build-file:: inc/i2c.inc +.. include-build-file:: inc/i2c_menu.inc diff --git a/docs/_sources/i2c.rst.txt b/docs/_sources/i2c.rst.txt index 73b87d011..67e499449 100644 --- a/docs/_sources/i2c.rst.txt +++ b/docs/_sources/i2c.rst.txt @@ -4,9 +4,13 @@ I2C The `I2C` class provides a simple interface to the I2C bus. It is a wrapper around the esp-idf I2C driver. +A helper `I2cMenu` is also provided which can be used to interactively test +I2C buses - scanning the bus, probing devices, reading and writing to devices. + .. ---------------------------- API Reference ---------------------------------- API Reference ------------- .. include-build-file:: inc/i2c.inc +.. include-build-file:: inc/i2c_menu.inc diff --git a/docs/adc/adc_types.html b/docs/adc/adc_types.html index 217920bf4..41986c01b 100644 --- a/docs/adc/adc_types.html +++ b/docs/adc/adc_types.html @@ -151,7 +151,7 @@
The I2C class provides a simple interface to the I2C bus. It is a wrapper around the esp-idf I2C driver.
+A helper I2cMenu is also provided which can be used to interactively test +I2C buses - scanning the bus, probing devices, reading and writing to devices.
A CLI menu for interacting with an I2c bus.
+This class provides a CLI menu for interacting with an I2c bus. It provides options for setting the log verbosity, scanning the bus for devices, probing for a device at a specific address, reading from a device, and writing to a device.
+ espp::I2c i2c({
+ .port = I2C_NUM_0,
+ .sda_io_num = (gpio_num_t)CONFIG_EXAMPLE_I2C_SDA_GPIO,
+ .scl_io_num = (gpio_num_t)CONFIG_EXAMPLE_I2C_SCL_GPIO,
+ .sda_pullup_en = GPIO_PULLUP_ENABLE,
+ .scl_pullup_en = GPIO_PULLUP_ENABLE,
+ .log_level = espp::Logger::Verbosity::INFO,
+ });
+ // now make a menu for the auth object
+ espp::I2cMenu i2c_menu(i2c);
+ cli::Cli cli(i2c_menu.get());
+ cli::SetColor();
+ cli.ExitAction([](auto &out) { out << "Goodbye and thanks for all the fish.\n"; });
+ espp::Cli input(cli);
+ input.SetInputHistorySize(10);
+
+ input.Start(); // As this is in the primary thread, we hold here until cli
+ // is complete. This is a blocking call and will not return until
+ // the user enters the `exit` command.
+
Public Functions
+Construct a new I2cMenu object.
+i2c – A reference to the I2c bus to interact with.
+Get the I2c menu.
+name – The name of the menu.
description – The description of the menu.
A unique pointer to the I2c menu that you can use to add to a CLI.
+