|
HF-Core Platform 0.1.0-dev
Hardware-Agnostic Handler Layer & RTOS Utilities for HardFOC
|
Shared ESP32 bus initialization for hf-core handler tests. More...
#include "esp32_test_config.hpp"#include "mcu/esp32/EspAdc.h"#include "mcu/esp32/EspGpio.h"#include "mcu/esp32/EspI2c.h"#include "mcu/esp32/EspSpi.h"#include <memory>#include "esp_log.h"Go to the source code of this file.
Functions | |
| EspI2cBus * | get_shared_i2c_bus () noexcept |
| Create and initialize the shared I2C bus. | |
| BaseI2c * | get_i2c_device (uint8_t address) noexcept |
| Get an I2C device handle for a specific address on the shared bus. | |
| EspSpiBus * | get_shared_spi_bus () noexcept |
| Create and initialize the shared SPI bus. | |
| std::unique_ptr< EspGpio > | create_gpio (int pin_num, hf_gpio_direction_t direction=hf_gpio_direction_t::HF_GPIO_DIRECTION_INPUT, hf_gpio_active_state_t active_state=hf_gpio_active_state_t::HF_GPIO_ACTIVE_HIGH) noexcept |
| Create an EspGpio for a specific pin. | |
| EspAdc * | get_shared_adc () noexcept |
| Create and initialize the shared ADC instance. | |
| int | scan_i2c_bus (EspI2cBus *bus) noexcept |
| Scan the I2C bus for responding devices. | |
Variables | |
| static const char * | BUS_TAG = "BusSetup" |
Shared ESP32 bus initialization for hf-core handler tests.
Provides factory functions to create and configure ESP32 I2C, SPI, GPIO, and ADC peripherals using the internal interface wrap (EspI2c, EspSpi, EspGpio, EspAdc). These are shared across all handler tests.
Each factory returns a unique_ptr or a reference to a static instance. Bus objects persist for the lifetime of the application.
|
inlinenoexcept |
Create an EspGpio for a specific pin.
| pin_num | GPIO pin number. |
| direction | Initial direction (input/output). |
| active_state | Active-high or active-low. |
|
inlinenoexcept |
Get an I2C device handle for a specific address on the shared bus.
| address | 7-bit I2C device address. |
|
inlinenoexcept |
Create and initialize the shared ADC instance.
|
inlinenoexcept |
Create and initialize the shared I2C bus.
Returns an EspI2cBus configured for the pins and speed in esp32_test_config. Multiple I2C devices can be attached to this bus.
|
inlinenoexcept |
Create and initialize the shared SPI bus.
|
inlinenoexcept |
Scan the I2C bus for responding devices.
Probes addresses 0x08–0x77 and logs a grid of found devices. Useful for verifying hardware connections before running handler tests.
| bus | Pointer to initialized EspI2cBus. |
|
static |