Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace espp {
/// - ES8311 audio codec (+ NS4150B speaker amplifier) over I2S
/// - 10/100 Ethernet (EMAC + IP101 RMII PHY)
/// - microSD card (4-bit SDMMC)
/// - MIPI-CSI camera (SC2336/OV5647) pins wired, capture pipeline is a stub
/// - MIPI-CSI camera (SC2336/OV5647) - pins wired, capture pipeline is a stub
///
/// \note The BOOT button cannot be used simultaneously with the ethernet PHY,
/// since the BOOT button is connected to the PHY's RMII_TXD1 pin. If you
Expand Down Expand Up @@ -380,12 +380,12 @@ class Esp32P4FunctionEvBoard : public BaseComponent {
#endif // CONFIG_ESP_P4_EV_BOARD_ETHERNET || defined(_DOXYGEN_)

/////////////////////////////////////////////////////////////////////////////
// Camera (MIPI-CSI) pins wired, capture pipeline is a stub
// Camera (MIPI-CSI) - pins wired, capture pipeline is a stub
/////////////////////////////////////////////////////////////////////////////

/// Initialize the MIPI-CSI camera (SC2336/OV5647).
/// \return True if successful
/// \note Not yet implemented the camera pins/SCCB are documented in this
/// \note Not yet implemented - the camera pins/SCCB are documented in this
/// BSP but the esp_video capture pipeline is not wired up. This always
/// returns false for now.
bool initialize_camera();
Expand Down Expand Up @@ -482,7 +482,7 @@ class Esp32P4FunctionEvBoard : public BaseComponent {
static constexpr gpio_num_t internal_i2c_sda = GPIO_NUM_7;
static constexpr gpio_num_t internal_i2c_scl = GPIO_NUM_8;

// Touch (GT911) interrupt/reset are NOT connected on this board
// Touch (GT911) - interrupt/reset are NOT connected on this board
static constexpr uint8_t gt911_default_address = 0x5D;
static constexpr uint8_t gt911_backup_address = 0x14;

Expand Down Expand Up @@ -510,7 +510,7 @@ class Esp32P4FunctionEvBoard : public BaseComponent {
static constexpr gpio_num_t sd_d3_io = GPIO_NUM_42;

/////////////////////////////////////////////////////////////////////////////
// Camera (MIPI-CSI) SCCB shares the internal I2C bus; reset/xclk not connected
// Camera (MIPI-CSI) - SCCB shares the internal I2C bus; reset/xclk not connected
/////////////////////////////////////////////////////////////////////////////
static constexpr gpio_num_t camera_reset_io = GPIO_NUM_NC;
static constexpr gpio_num_t camera_xclk_io = GPIO_NUM_NC;
Expand Down
2 changes: 1 addition & 1 deletion components/m5stack-tab5/include/m5stack-tab5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ class M5StackTab5 : public BaseComponent {
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.timeout_ms = 200,
// Standard-mode (100 kHz) shared internal bus. At 400 kHz the
// bus is marginal with this many devices on it the ST7123
// bus is marginal with this many devices on it - the ST7123
// touch reads time out and a hung transaction corrupts a
// concurrent BMI270 read (correlated touch I/O errors + IMU
// vector jumps while dragging). Per-device speed mixing
Expand Down
2 changes: 1 addition & 1 deletion components/rtps/include/rtps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class RtpsParticipant : public BaseComponent {
uint16_t participant_id{0}; ///< RTPS participant ID used for GUID and port derivation.
bool randomize_guid_prefix{true}; ///< When true (default), mix per-instance entropy into the
///< participant GUID so a restarted participant is seen as a
///< new participant DDS/ROS 2 peers then accept its
///< new participant - DDS/ROS 2 peers then accept its
///< republished samples instead of dropping them as
///< already-seen duplicates. Set false for a deterministic
///< GUID derived only from node_name/domain/participant id
Expand Down
2 changes: 1 addition & 1 deletion components/rtsp/include/h264_depacketizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace espp {
/// @brief RTP depacketizer for H.264 video per RFC 6184.
///
/// Reassembles H.264 access units from incoming RTP packets. Supports:
/// - **Single NAL unit** packets (NAL type 123)
/// - **Single NAL unit** packets (NAL type 1-23)
/// - **STAP-A** aggregation packets (NAL type 24)
/// - **FU-A** fragmentation packets (NAL type 28)
///
Expand Down
6 changes: 3 additions & 3 deletions components/rtsp/include/h264_packetizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ namespace espp {
/// of RTP payload chunks suitable for transmission.
///
/// Supports two NAL-unit packetization strategies:
/// - **Single NAL unit mode** NAL fits within max_payload_size.
/// - **FU-A fragmentation** NAL exceeds max_payload_size (packetization_mode >= 1).
/// - **Single NAL unit mode** - NAL fits within max_payload_size.
/// - **FU-A fragmentation** - NAL exceeds max_payload_size (packetization_mode >= 1).
///
/// @note This class does not manage RTP headers (sequence numbers, timestamps,
/// SSRC). The caller wraps each returned chunk into an RtpPacket.
Expand All @@ -29,7 +29,7 @@ class H264Packetizer : public RtpPacketizer {
/// Configuration for the H264Packetizer.
struct Config {
size_t max_payload_size{1400}; ///< Maximum payload bytes per RTP packet
int payload_type{96}; ///< Dynamic RTP payload type (typically 96127).
int payload_type{96}; ///< Dynamic RTP payload type (typically 96-127).
std::string profile_level_id; ///< H.264 profile-level-id hex string, e.g. "42C01E".
int packetization_mode{1}; ///< 0 = single NAL only, 1 = non-interleaved (FU-A allowed).
std::vector<uint8_t> sps; ///< Sequence Parameter Set raw bytes (without start code).
Expand Down
2 changes: 1 addition & 1 deletion components/rtsp/include/rtsp_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class RtspClient : public BaseComponent {
/// Function type for the callback to call when a JPEG frame is received
typedef std::function<void(std::shared_ptr<espp::JpegFrame> jpeg_frame)> jpeg_frame_callback_t;

/// Generic frame callback called for any track/codec with raw frame data
/// Generic frame callback - called for any track/codec with raw frame data
using frame_callback_t = std::function<void(int track_id, std::vector<uint8_t> &&data)>;

/// Callback invoked when the RTSP server disappears after playback starts.
Expand Down
4 changes: 2 additions & 2 deletions components/rtsp/include/rtsp_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class RtspSession : public BaseComponent {
/// @return True if the packet was sent successfully, false otherwise
bool send_rtp_packet(int track_id, std::span<const uint8_t> packet_data);

/// Send an RTP packet to the client (backward compat sends on default track 0)
/// Send an RTP packet to the client (backward compat - sends on default track 0)
/// @param packet The RTP packet to send
/// @return True if the packet was sent successfully, false otherwise
bool send_rtp_packet(const espp::RtpPacket &packet);
Expand All @@ -139,7 +139,7 @@ class RtspSession : public BaseComponent {
/// @return True if the packet was sent successfully, false otherwise
bool send_rtcp_packet(int track_id, const espp::RtcpPacket &packet);

/// Send an RTCP packet to the client (backward compat sends on default track 0)
/// Send an RTCP packet to the client (backward compat - sends on default track 0)
/// @param packet The RTCP packet to send
/// @return True if the packet was sent successfully, false otherwise
bool send_rtcp_packet(const espp::RtcpPacket &packet);
Expand Down
6 changes: 3 additions & 3 deletions components/st7123touch/include/st7123touch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace espp {
/// @note The ST7123's touch engine is gated by the LCD reset (LCD_RST) line,
/// NOT the TP_RST line used by standalone touch controllers such as the
/// GT911. When used in a system that has a separate TP_RST signal
/// (e.g. M5Stack Tab5), do NOT toggle TP_RST for this chip doing so
/// (e.g. M5Stack Tab5), do NOT toggle TP_RST for this chip - doing so
/// may knock the touch I2C endpoint offline.
///
/// Touch data reading sequence (based on ST7123 TDDI Interface Protocol):
Expand Down Expand Up @@ -79,7 +79,7 @@ class St7123Touch : public BasePeripheral<std::uint16_t> {
return false;

if (!(adv_info & ADV_INFO_WITH_COORD)) {
// No coordinate data in this interrupt clear touch state so LVGL sees
// No coordinate data in this interrupt - clear touch state so LVGL sees
// the finger as lifted.
num_touch_points_ = 0;
x_ = 0;
Expand Down Expand Up @@ -155,7 +155,7 @@ class St7123Touch : public BasePeripheral<std::uint16_t> {
}

/// @brief Get the home-button state
/// @return Always false the ST7123 does not expose a home button via I2C
/// @return Always false - the ST7123 does not expose a home button via I2C
bool get_home_button_state() const { return false; }

protected:
Expand Down
17 changes: 10 additions & 7 deletions components/thread_pool/include/thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace espp {
* \snippet thread_pool_example.cpp lifecycle example
* \section thread_pool_ex2 Submit Jobs
* \snippet thread_pool_example.cpp submit example
* \section thread_pool_ex3 try_submit Non-Blocking Rejection When Full
* \section thread_pool_ex3 try_submit - Non-Blocking Rejection When Full
* \snippet thread_pool_example.cpp try_submit example
* \section thread_pool_ex4 Blocking Submit When Full
* \snippet thread_pool_example.cpp blocking submit example
Expand All @@ -52,16 +52,19 @@ class ThreadPool : public espp::BaseComponent {
struct Stats {
std::uint64_t submitted = 0; ///< Total jobs accepted into the queue.
std::uint64_t executed = 0; ///< Total jobs successfully executed.
std::uint64_t rejected = 0; ///< Total jobs rejected (invalid job, stopped/stopping, or queue full) or dropped (due to stop, the enqueued jobs were dropped).
std::uint64_t rejected = 0; ///< Total jobs rejected (invalid job, stopped/stopping, or queue
///< full) or dropped (due to stop, the enqueued jobs were dropped).
};

/// @brief Configuration parameters for constructing a ThreadPool.
struct Config {
std::size_t worker_count = 1; ///< Number of worker threads to spawn.
std::size_t max_queue_size = 0; ///< Maximum pending jobs (0 = unbounded).
bool auto_start = true; ///< Start workers immediately on construction.
bool block_on_submit_when_full = false; ///< If true, submit() blocks when the queue is full instead of rejecting.
espp::Task::BaseConfig worker_task_config = { ///< Base configuration applied to every worker task.
std::size_t worker_count = 1; ///< Number of worker threads to spawn.
std::size_t max_queue_size = 0; ///< Maximum pending jobs (0 = unbounded).
bool auto_start = true; ///< Start workers immediately on construction.
bool block_on_submit_when_full =
false; ///< If true, submit() blocks when the queue is full instead of rejecting.
espp::Task::BaseConfig worker_task_config = {
///< Base configuration applied to every worker task.
.name = "thread_pool_worker",
.stack_size_bytes = 4096,
.priority = 5,
Expand Down
8 changes: 4 additions & 4 deletions components/touch/include/touch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ class ITouchDevice {
/// standard espp touch-driver interface.
///
/// A type T satisfies TouchDriverConcept if it provides:
/// - `bool T::update(std::error_code &)` read new touch data from hardware
/// - `void T::get_touch_point(uint8_t *, uint16_t *, uint16_t *) const` retrieve coordinates
/// - `bool T::get_home_button_state() const` return home-button state
/// - `bool T::update(std::error_code &)` - read new touch data from hardware
/// - `void T::get_touch_point(uint8_t *, uint16_t *, uint16_t *) const` - retrieve coordinates
/// - `bool T::get_home_button_state() const` - return home-button state
///
/// Both `espp::Gt911` and `espp::St7123Touch` satisfy this concept.
template <typename T>
Expand Down Expand Up @@ -174,7 +174,7 @@ template <TouchDriverConcept T> struct TouchDriverAdapter : ITouchDriver {

/// @brief Convenience factory: wrap a shared_ptr to a concrete touch driver in
/// a `TouchDriverAdapter` and return it as `std::shared_ptr<ITouchDriver>`.
/// @tparam T Concrete driver type must satisfy `TouchDriverConcept`.
/// @tparam T Concrete driver type - must satisfy `TouchDriverConcept`.
template <TouchDriverConcept T>
std::shared_ptr<ITouchDriver> make_touch_driver(std::shared_ptr<T> driver) {
return std::make_shared<TouchDriverAdapter<T>>(std::move(driver));
Expand Down
5 changes: 5 additions & 0 deletions lib/autogenerate_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def _code_preprocess(code: str) -> str:
".def(py::init<const espp::Timer::Config &>())\n"
" .def(py::init<const espp::Timer::AdvancedConfig &>())"
),
"pyClassThreadPool": ".def(py::init<const espp::ThreadPool::Config &>())",
"pyClassBezier_espp_Vector2f": (
".def(py::init<const espp::Bezier<espp::Vector2f>::Config &>())\n"
" .def(py::init<const espp::Bezier<espp::Vector2f>::WeightedConfig &>())"
Expand Down Expand Up @@ -246,6 +247,7 @@ def _fix_rtsp_qualifications(code: str) -> str:
],
"espp::RtspServer": ["start", "stop", "send_frame"],
"espp::RtspSession": ["send_rtp_packet", "send_rtcp_packet"],
"espp::ThreadPool": ["start", "stop", "submit"],
}

_GIL_GUARD = "py::call_guard<py::gil_scoped_release>()"
Expand Down Expand Up @@ -457,6 +459,9 @@ def autogenerate() -> None:
include_dir + "task/include/task.hpp",
include_dir + "timer/include/timer.hpp",

# NOTE: this must come after task and base_component since it depends on them
include_dir + "thread_pool/include/thread_pool.hpp",

# NOTE: this must come after vector2d.hpp and range_mapper.hpp since it depends on them!
include_dir + "joystick/include/joystick.hpp",

Expand Down
2 changes: 2 additions & 0 deletions lib/espp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set(ESPP_INCLUDES
${ESPP_COMPONENTS}/serialization/include
${ESPP_COMPONENTS}/tabulate/include
${ESPP_COMPONENTS}/task/include
${ESPP_COMPONENTS}/thread_pool/include
${ESPP_COMPONENTS}/timer/include
${ESPP_COMPONENTS}/socket/include
${ESPP_COMPONENTS}/state_machine/include
Expand Down Expand Up @@ -69,6 +70,7 @@ set(ESPP_SOURCES
${ESPP_COMPONENTS}/rtsp/src/mjpeg_depacketizer.cpp
${ESPP_COMPONENTS}/rtsp/src/mjpeg_packetizer.cpp
${ESPP_COMPONENTS}/task/src/task.cpp
${ESPP_COMPONENTS}/thread_pool/src/thread_pool.cpp
${ESPP_COMPONENTS}/timer/src/timer.cpp
${ESPP_COMPONENTS}/socket/src/socket.cpp
${ESPP_COMPONENTS}/socket/src/tcp_socket.cpp
Expand Down
1 change: 1 addition & 0 deletions lib/include/espp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extern "C" {
#include "tabulate.hpp"
#include "task.hpp"
#include "tcp_socket.hpp"
#include "thread_pool.hpp"
#include "timer.hpp"
#include "udp_socket.hpp"
#include "vector2d.hpp"
Expand Down
Loading
Loading