ESP32 TimerCam#
Esp32-Timer-Cam#
The ESP32 TimerCam is a little usb-c webcamera using the ESP32. It has a little blue LED, a real-time clock (RTC), and supports battery operation with battery voltage monitoring as well.
The espp::EspTimerCam component provides a singleton hardware abstraction for initializing the I2C, LED, RTC, and ADC subsystems.
API Reference#
Header File#
Classes#
-
class EspTimerCam : public espp::BaseComponent#
The EspTimerCam class provides an interface to the ESP32-S3-BOX and ESP32-S3-BOX-3 development boards.
The class provides access to the following features:
I2C
LED
Battery Voltage Measurement
RTC
Camera pin definition
The class is a singleton and can be accessed using the get() method.
Example#
auto &timer_cam = espp::EspTimerCam::get(); // initialize RTC if (!timer_cam.initialize_rtc()) { logger.error("Could not initialize RTC"); return; } // initialize LED static constexpr float disconnected_led_breathing_period = 1.0f; static constexpr float connected_led_breathing_period = 3.5f; if (!timer_cam.initialize_led(disconnected_led_breathing_period)) { logger.error("Could not initialize LED"); return; } timer_cam.start_led_breathing();
Public Functions
-
I2c &internal_i2c()#
Get a reference to the internal I2C bus
Note
The internal I2C bus is used for the touchscreen and audio codec
- Returns:
A reference to the internal I2C bus
-
espp::Interrupt &interrupts()#
Get a reference to the interrupts
- Returns:
A reference to the interrupts
-
bool initialize_led(float breathing_period = 3.5f)#
Initialize the LED.
- Parameters:
breathing_period – The period of the LED breathing effect
- Returns:
True if the LED was successfully initialized, false otherwise
-
void start_led_breathing()#
Start the LED breathing effect.
-
void stop_led_breathing()#
Stop the LED breathing effect.
-
bool set_led_brightness(float brightness)#
Set the LED brightness.
Note
The LED brightness can only be set if the LED is not currently breathing
- Parameters:
brightness – The brightness of the LED, in the range [0, 1]
- Returns:
True if the LED brightness was successfully set, false otherwise
-
float get_led_brightness()#
Get the LED brightness.
- Returns:
The brightness of the LED, in the range [0, 1]
-
bool set_led_breathing_period(float period)#
Set the LED breathing period.
- Parameters:
period – The period of the LED breathing effect in seconds
- Returns:
True if the LED breathing period was successfully set, false otherwise
-
float get_led_breathing_period()#
Get the LED breathing period.
- Returns:
The period of the LED breathing effect in seconds
-
espp::Gaussian &gaussian()#
Get the Gaussian waveform used for the LED breathing effect.
- Returns:
A reference to the Gaussian waveform used for the LED breathing effect
-
float get_battery_voltage()#
Get the battery voltage.
- Returns:
The battery voltage in volts
-
bool initialize_rtc()#
Initialize the RTC.
- Returns:
True if the RTC was successfully initialized, false otherwise
-
std::shared_ptr<Rtc> rtc()#
Get the RTC.
- Returns:
A shared pointer to the RTC
-
inline const std::string &get_name() const#
Get the name of the component
Note
This is the tag of the logger
- Returns:
A const reference to the name of the component
-
template<typename T = void>
inline void set_log_tag(const std::string_view&)# Not available: the tag is fixed at construction (pass it to the constructor). Enable CONFIG_ESPP_LOGGER_MUTABLE_TAG (menuconfig: ESPP Logger -> Mutable tag) to change it afterwards.
-
inline espp::Logger::Verbosity get_log_level() const#
Get the log level for the logger
See also
See also
- Returns:
The verbosity level of the logger
-
inline void set_log_level(espp::Logger::Verbosity level)#
Set the log level for the logger
See also
See also
- Parameters:
level – The verbosity level to use for the logger
-
inline void set_log_verbosity(espp::Logger::Verbosity level)#
Set the log verbosity for the logger
See also
See also
See also
Note
This is a convenience method that calls set_log_level
- Parameters:
level – The verbosity level to use for the logger
-
inline espp::Logger::Verbosity get_log_verbosity() const#
Get the log verbosity for the logger
See also
See also
See also
Note
This is a convenience method that calls get_log_level
- Returns:
The verbosity level of the logger
-
inline void set_log_rate_limit(std::chrono::duration<float> rate_limit)#
Set the rate limit for the logger
See also
Note
Only calls to the logger that have _rate_limit suffix will be rate limited
- Parameters:
rate_limit – The rate limit to use for the logger
Public Static Functions
-
static inline EspTimerCam &get()#
Access the singleton instance of the EspTimerCam class.
- Returns:
Reference to the singleton instance of the EspTimerCam class
-
static inline gpio_num_t get_camera_reset_pin()#
Get the camera reset pin.
- Returns:
The camera reset pin
-
static inline gpio_num_t get_camera_xclk_pin()#
Get the camera XCLK pin.
- Returns:
The camera XCLK pin
-
static inline gpio_num_t get_camera_sda_pin()#
Get the camera SDA pin.
- Returns:
The camera SDA pin
-
static inline gpio_num_t get_camera_scl_pin()#
Get the camera SCL pin.
- Returns:
The camera SCL pin
-
static inline gpio_num_t get_camera_d0_pin()#
Get the camera D0 pin.
- Returns:
The camera D0 pin
-
static inline gpio_num_t get_camera_d1_pin()#
Get the camera D1 pin.
- Returns:
The camera D1 pin
-
static inline gpio_num_t get_camera_d2_pin()#
Get the camera D2 pin.
- Returns:
The camera D2 pin
-
static inline gpio_num_t get_camera_d3_pin()#
Get the camera D3 pin.
- Returns:
The camera D3 pin
-
static inline gpio_num_t get_camera_d4_pin()#
Get the camera D4 pin.
- Returns:
The camera D4 pin
-
static inline gpio_num_t get_camera_d5_pin()#
Get the camera D5 pin.
- Returns:
The camera D5 pin
-
static inline gpio_num_t get_camera_d6_pin()#
Get the camera D6 pin.
- Returns:
The camera D6 pin
-
static inline gpio_num_t get_camera_d7_pin()#
Get the camera D7 pin.
- Returns:
The camera D7 pin
-
static inline gpio_num_t get_camera_vsync_pin()#
Get the camera VSYNC pin.
- Returns:
The camera VSYNC pin
-
static inline gpio_num_t get_camera_href_pin()#
Get the camera HREF pin.
- Returns:
The camera HREF pin
-
static inline gpio_num_t get_camera_pclk_pin()#
Get the camera PCLK pin.
- Returns:
The camera PCLK pin
-
static inline int get_camera_xclk_freq_hz()#
Get the camera XCLK frequency.
- Returns:
The camera XCLK frequency in Hz