ESPHome 2026.1.0-dev
Loading...
Searching...
No Matches
esphome::cc1101::CC1101Component Class Reference

#include <cc1101.h>

Inheritance diagram for esphome::cc1101::CC1101Component:
esphome::Component esphome::spi::SPIDevice< spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ > esphome::spi::SPIClient

Public Member Functions

 CC1101Component ()
 
void setup () override
 
void loop () override
 
void dump_config () override
 
void begin_tx ()
 
void begin_rx ()
 
void reset ()
 
void set_idle ()
 
void set_gdo0_pin (InternalGPIOPin *pin)
 
void set_output_power (float value)
 
void set_rx_attenuation (RxAttenuation value)
 
void set_dc_blocking_filter (bool value)
 
void set_frequency (float value)
 
void set_if_frequency (float value)
 
void set_filter_bandwidth (float value)
 
void set_channel (uint8_t value)
 
void set_channel_spacing (float value)
 
void set_fsk_deviation (float value)
 
void set_msk_deviation (uint8_t value)
 
void set_symbol_rate (float value)
 
void set_sync_mode (SyncMode value)
 
void set_carrier_sense_above_threshold (bool value)
 
void set_modulation_type (Modulation value)
 
void set_manchester (bool value)
 
void set_num_preamble (uint8_t value)
 
void set_sync1 (uint8_t value)
 
void set_sync0 (uint8_t value)
 
void set_magn_target (MagnTarget value)
 
void set_max_lna_gain (MaxLnaGain value)
 
void set_max_dvga_gain (MaxDvgaGain value)
 
void set_carrier_sense_abs_thr (int8_t value)
 
void set_carrier_sense_rel_thr (CarrierSenseRelThr value)
 
void set_lna_priority (bool value)
 
void set_filter_length_fsk_msk (FilterLengthFskMsk value)
 
void set_filter_length_ask_ook (FilterLengthAskOok value)
 
void set_freeze (Freeze value)
 
void set_wait_time (WaitTime value)
 
void set_hyst_level (HystLevel value)
 
void set_packet_mode (bool value)
 
void set_packet_length (uint8_t value)
 
void set_crc_enable (bool value)
 
void set_whitening (bool value)
 
CC1101Error transmit_packet (const std::vector< uint8_t > &packet)
 
Trigger< std::vector< uint8_t >, float, uint8_t > * get_packet_trigger () const
 
- Public Member Functions inherited from esphome::Component
virtual float get_setup_priority () const
 priority of setup().
 
float get_actual_setup_priority () const
 
void set_setup_priority (float priority)
 
virtual float get_loop_priority () const
 priority of loop().
 
void call ()
 
virtual void on_shutdown ()
 
virtual void on_safe_shutdown ()
 
virtual bool teardown ()
 Called during teardown to allow component to gracefully finish operations.
 
virtual void on_powerdown ()
 Called after teardown is complete to power down hardware.
 
uint8_t get_component_state () const
 
void reset_to_construction_state ()
 Reset this component back to the construction state to allow setup to run again.
 
bool is_in_loop_state () const
 Check if this component has completed setup and is in the loop state.
 
bool is_idle () const
 Check if this component is idle.
 
virtual void mark_failed ()
 Mark this component as failed.
 
 ESPDEPRECATED ("Use mark_failed(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary " "strings. Will stop working in 2026.6.0", "2025.12.0") void mark_failed(const char *message)
 
void mark_failed (const LogString *message)
 
void disable_loop ()
 Disable this component's loop.
 
void enable_loop ()
 Enable this component's loop.
 
void enable_loop_soon_any_context ()
 Thread and ISR-safe version of enable_loop() that can be called from any context.
 
bool is_failed () const
 
bool is_ready () const
 
virtual bool can_proceed ()
 
bool status_has_warning () const
 
bool status_has_error () const
 
void status_set_warning (const char *message=nullptr)
 
void status_set_warning (const LogString *message)
 
void status_set_error ()
 
 ESPDEPRECATED ("Use status_set_error(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary " "strings. Will stop working in 2026.6.0", "2025.12.0") void status_set_error(const char *message)
 
void status_set_error (const LogString *message)
 
void status_clear_warning ()
 
void status_clear_error ()
 
void status_momentary_warning (const char *name, uint32_t length=5000)
 Set warning status flag and automatically clear it after a timeout.
 
void status_momentary_error (const char *name, uint32_t length=5000)
 Set error status flag and automatically clear it after a timeout.
 
bool has_overridden_loop () const
 
void set_component_source (const LogString *source)
 Set where this component was loaded from for some debug messages.
 
const LogString * get_component_log_str () const
 Get the integration where this component was declared as a LogString for logging.
 
bool should_warn_of_blocking (uint32_t blocking_time)
 
- Public Member Functions inherited from esphome::spi::SPIDevice< spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ >
 SPIDevice ()
 
 SPIDevice (SPIComponent *parent, GPIOPin *cs_pin)
 
void spi_setup () override
 
void spi_teardown () override
 
void set_spi_parent (SPIComponent *parent)
 
void set_cs_pin (GPIOPin *cs)
 
void set_data_rate (uint32_t data_rate)
 
void set_bit_order (SPIBitOrder order)
 
void set_mode (SPIMode mode)
 
uint8_t read_byte ()
 
void read_array (uint8_t *data, size_t length)
 
void write (uint16_t data, size_t num_bits)
 Write a single data item, up to 32 bits.
 
void write_cmd_addr_data (size_t cmd_bits, uint32_t cmd, size_t addr_bits, uint32_t address, const uint8_t *data, size_t length, uint8_t bus_width=1)
 
void write_byte (uint8_t data)
 
void transfer_array (uint8_t *data, size_t length)
 Write the array data, replace with received data.
 
void transfer_array (std::array< uint8_t, N > &data)
 
uint8_t transfer_byte (uint8_t data)
 
void write_byte16 (uint16_t data)
 Write 16 bit data.
 
void write_array16 (const uint16_t *data, size_t length)
 Write an array of data as 16 bit values, byte-swapping if required.
 
void enable ()
 
void disable ()
 
void write_array (const uint8_t *data, size_t length)
 
void write_array (const std::array< uint8_t, N > &data)
 
void write_array (const std::vector< uint8_t > &data)
 
- Public Member Functions inherited from esphome::spi::SPIClient
 SPIClient (SPIBitOrder bit_order, SPIMode mode, uint32_t data_rate)
 
bool spi_is_ready ()
 
void set_release_device (bool release)
 
void set_write_only (bool write_only)
 

Protected Member Functions

uint8_t strobe_ (Command cmd)
 
void write_ (Register reg)
 
void write_ (Register reg, uint8_t value)
 
void write_ (Register reg, const uint8_t *buffer, size_t length)
 
void read_ (Register reg)
 
void read_ (Register reg, uint8_t *buffer, size_t length)
 
bool wait_for_state_ (State target_state, uint32_t timeout_ms=100)
 
void enter_idle_ ()
 
- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
 
virtual void call_setup ()
 
virtual void call_dump_config ()
 
void set_component_state_ (uint8_t state)
 Helper to set component state (clears state bits and sets new state)
 
void set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a unique name.
 
void set_interval (const char *name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a const char* name.
 
void set_interval (uint32_t interval, std::function< void()> &&f)
 
bool cancel_interval (const std::string &name)
 Cancel an interval function.
 
bool cancel_interval (const char *name)
 
void set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 Set an retry function with a unique name.
 
void set_retry (const char *name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 
void set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 
bool cancel_retry (const std::string &name)
 Cancel a retry function.
 
bool cancel_retry (const char *name)
 
void set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a unique name.
 
void set_timeout (const char *name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a const char* name.
 
void set_timeout (uint32_t timeout, std::function< void()> &&f)
 
bool cancel_timeout (const std::string &name)
 Cancel a timeout function.
 
bool cancel_timeout (const char *name)
 
void defer (const std::string &name, std::function< void()> &&f)
 Defer a callback to the next loop() call.
 
void defer (const char *name, std::function< void()> &&f)
 Defer a callback to the next loop() call with a const char* name.
 
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call.
 
bool cancel_defer (const std::string &name)
 Cancel a defer callback using the specified name, name must not be empty.
 

Protected Attributes

uint16_t chip_id_ {0}
 
bool initialized_ {false}
 
float output_power_requested_ {10.0f}
 
float output_power_effective_ {10.0f}
 
uint8_t pa_table_ [PA_TABLE_SIZE] {}
 
CC1101State state_
 
InternalGPIOPingdo0_pin_ {nullptr}
 
Trigger< std::vector< uint8_t >, float, uint8_t > * packet_trigger_ {new Trigger<std::vector<uint8_t>, float, uint8_t>()}
 
std::vector< uint8_t > packet_
 
- Protected Attributes inherited from esphome::Component
const LogString * component_source_ {nullptr}
 
uint16_t warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_MS}
 Warn if blocked for this many ms (max 65.5s)
 
uint8_t component_state_ {0x00}
 State of this component - each bit has a purpose: Bits 0-2: Component state (0x00=CONSTRUCTION, 0x01=SETUP, 0x02=LOOP, 0x03=FAILED, 0x04=LOOP_DONE) Bit 3: STATUS_LED_WARNING Bit 4: STATUS_LED_ERROR Bits 5-7: Unused - reserved for future expansion.
 
volatile bool pending_enable_loop_ {false}
 ISR-safe flag for enable_loop_soon_any_context.
 
- Protected Attributes inherited from esphome::spi::SPIClient
SPIBitOrder bit_order_ {BIT_ORDER_MSB_FIRST}
 
SPIMode mode_ {MODE0}
 
uint32_t data_rate_ {1000000}
 
SPIComponentparent_ {nullptr}
 
GPIOPincs_ {nullptr}
 
bool release_device_ {false}
 
bool write_only_ {false}
 
SPIDelegatedelegate_ {SPIDelegate::NULL_DELEGATE}
 

Detailed Description

Definition at line 14 of file cc1101.h.

Constructor & Destructor Documentation

◆ CC1101Component()

esphome::cc1101::CC1101Component::CC1101Component ( )

Definition at line 27 of file cc1101.cpp.

Member Function Documentation

◆ begin_rx()

void esphome::cc1101::CC1101Component::begin_rx ( )

Definition at line 242 of file cc1101.cpp.

◆ begin_tx()

void esphome::cc1101::CC1101Component::begin_tx ( )

Definition at line 229 of file cc1101.cpp.

◆ dump_config()

void esphome::cc1101::CC1101Component::dump_config ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 208 of file cc1101.cpp.

◆ enter_idle_()

void esphome::cc1101::CC1101Component::enter_idle_ ( )
protected

Definition at line 273 of file cc1101.cpp.

◆ get_packet_trigger()

Trigger< std::vector< uint8_t >, float, uint8_t > * esphome::cc1101::CC1101Component::get_packet_trigger ( ) const
inline

Definition at line 76 of file cc1101.h.

◆ loop()

void esphome::cc1101::CC1101Component::loop ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 152 of file cc1101.cpp.

◆ read_() [1/2]

void esphome::cc1101::CC1101Component::read_ ( Register reg)
protected

Definition at line 311 of file cc1101.cpp.

◆ read_() [2/2]

void esphome::cc1101::CC1101Component::read_ ( Register reg,
uint8_t * buffer,
size_t length )
protected

Definition at line 319 of file cc1101.cpp.

◆ reset()

void esphome::cc1101::CC1101Component::reset ( )

Definition at line 250 of file cc1101.cpp.

◆ set_carrier_sense_above_threshold()

void esphome::cc1101::CC1101Component::set_carrier_sense_above_threshold ( bool value)

Definition at line 488 of file cc1101.cpp.

◆ set_carrier_sense_abs_thr()

void esphome::cc1101::CC1101Component::set_carrier_sense_abs_thr ( int8_t value)

Definition at line 556 of file cc1101.cpp.

◆ set_carrier_sense_rel_thr()

void esphome::cc1101::CC1101Component::set_carrier_sense_rel_thr ( CarrierSenseRelThr value)

Definition at line 563 of file cc1101.cpp.

◆ set_channel()

void esphome::cc1101::CC1101Component::set_channel ( uint8_t value)

Definition at line 429 of file cc1101.cpp.

◆ set_channel_spacing()

void esphome::cc1101::CC1101Component::set_channel_spacing ( float value)

Definition at line 438 of file cc1101.cpp.

◆ set_crc_enable()

void esphome::cc1101::CC1101Component::set_crc_enable ( bool value)

Definition at line 647 of file cc1101.cpp.

◆ set_dc_blocking_filter()

void esphome::cc1101::CC1101Component::set_dc_blocking_filter ( bool value)

Definition at line 390 of file cc1101.cpp.

◆ set_filter_bandwidth()

void esphome::cc1101::CC1101Component::set_filter_bandwidth ( float value)

Definition at line 418 of file cc1101.cpp.

◆ set_filter_length_ask_ook()

void esphome::cc1101::CC1101Component::set_filter_length_ask_ook ( FilterLengthAskOok value)

Definition at line 584 of file cc1101.cpp.

◆ set_filter_length_fsk_msk()

void esphome::cc1101::CC1101Component::set_filter_length_fsk_msk ( FilterLengthFskMsk value)

Definition at line 577 of file cc1101.cpp.

◆ set_freeze()

void esphome::cc1101::CC1101Component::set_freeze ( Freeze value)

Definition at line 591 of file cc1101.cpp.

◆ set_frequency()

void esphome::cc1101::CC1101Component::set_frequency ( float value)

Definition at line 397 of file cc1101.cpp.

◆ set_fsk_deviation()

void esphome::cc1101::CC1101Component::set_fsk_deviation ( float value)

Definition at line 450 of file cc1101.cpp.

◆ set_gdo0_pin()

void esphome::cc1101::CC1101Component::set_gdo0_pin ( InternalGPIOPin * pin)
inline

Definition at line 31 of file cc1101.h.

◆ set_hyst_level()

void esphome::cc1101::CC1101Component::set_hyst_level ( HystLevel value)

Definition at line 605 of file cc1101.cpp.

◆ set_idle()

void esphome::cc1101::CC1101Component::set_idle ( )

Definition at line 255 of file cc1101.cpp.

◆ set_if_frequency()

void esphome::cc1101::CC1101Component::set_if_frequency ( float value)

Definition at line 411 of file cc1101.cpp.

◆ set_lna_priority()

void esphome::cc1101::CC1101Component::set_lna_priority ( bool value)

Definition at line 570 of file cc1101.cpp.

◆ set_magn_target()

void esphome::cc1101::CC1101Component::set_magn_target ( MagnTarget value)

Definition at line 535 of file cc1101.cpp.

◆ set_manchester()

void esphome::cc1101::CC1101Component::set_manchester ( bool value)

Definition at line 507 of file cc1101.cpp.

◆ set_max_dvga_gain()

void esphome::cc1101::CC1101Component::set_max_dvga_gain ( MaxDvgaGain value)

Definition at line 549 of file cc1101.cpp.

◆ set_max_lna_gain()

void esphome::cc1101::CC1101Component::set_max_lna_gain ( MaxLnaGain value)

Definition at line 542 of file cc1101.cpp.

◆ set_modulation_type()

void esphome::cc1101::CC1101Component::set_modulation_type ( Modulation value)

Definition at line 495 of file cc1101.cpp.

◆ set_msk_deviation()

void esphome::cc1101::CC1101Component::set_msk_deviation ( uint8_t value)

Definition at line 461 of file cc1101.cpp.

◆ set_num_preamble()

void esphome::cc1101::CC1101Component::set_num_preamble ( uint8_t value)

Definition at line 514 of file cc1101.cpp.

◆ set_output_power()

void esphome::cc1101::CC1101Component::set_output_power ( float value)

Definition at line 355 of file cc1101.cpp.

◆ set_packet_length()

void esphome::cc1101::CC1101Component::set_packet_length ( uint8_t value)

Definition at line 634 of file cc1101.cpp.

◆ set_packet_mode()

void esphome::cc1101::CC1101Component::set_packet_mode ( bool value)

Definition at line 612 of file cc1101.cpp.

◆ set_rx_attenuation()

void esphome::cc1101::CC1101Component::set_rx_attenuation ( RxAttenuation value)

Definition at line 383 of file cc1101.cpp.

◆ set_symbol_rate()

void esphome::cc1101::CC1101Component::set_symbol_rate ( float value)

Definition at line 469 of file cc1101.cpp.

◆ set_sync0()

void esphome::cc1101::CC1101Component::set_sync0 ( uint8_t value)

Definition at line 528 of file cc1101.cpp.

◆ set_sync1()

void esphome::cc1101::CC1101Component::set_sync1 ( uint8_t value)

Definition at line 521 of file cc1101.cpp.

◆ set_sync_mode()

void esphome::cc1101::CC1101Component::set_sync_mode ( SyncMode value)

Definition at line 481 of file cc1101.cpp.

◆ set_wait_time()

void esphome::cc1101::CC1101Component::set_wait_time ( WaitTime value)

Definition at line 598 of file cc1101.cpp.

◆ set_whitening()

void esphome::cc1101::CC1101Component::set_whitening ( bool value)

Definition at line 654 of file cc1101.cpp.

◆ setup()

void esphome::cc1101::CC1101Component::setup ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 105 of file cc1101.cpp.

◆ strobe_()

uint8_t esphome::cc1101::CC1101Component::strobe_ ( Command cmd)
protected

Definition at line 278 of file cc1101.cpp.

◆ transmit_packet()

CC1101Error esphome::cc1101::CC1101Component::transmit_packet ( const std::vector< uint8_t > & packet)

Definition at line 327 of file cc1101.cpp.

◆ wait_for_state_()

bool esphome::cc1101::CC1101Component::wait_for_state_ ( State target_state,
uint32_t timeout_ms = 100 )
protected

Definition at line 260 of file cc1101.cpp.

◆ write_() [1/3]

void esphome::cc1101::CC1101Component::write_ ( Register reg)
protected

Definition at line 289 of file cc1101.cpp.

◆ write_() [2/3]

void esphome::cc1101::CC1101Component::write_ ( Register reg,
const uint8_t * buffer,
size_t length )
protected

Definition at line 303 of file cc1101.cpp.

◆ write_() [3/3]

void esphome::cc1101::CC1101Component::write_ ( Register reg,
uint8_t value )
protected

Definition at line 297 of file cc1101.cpp.

Field Documentation

◆ chip_id_

uint16_t esphome::cc1101::CC1101Component::chip_id_ {0}
protected

Definition at line 79 of file cc1101.h.

◆ gdo0_pin_

InternalGPIOPin* esphome::cc1101::CC1101Component::gdo0_pin_ {nullptr}
protected

Definition at line 89 of file cc1101.h.

◆ initialized_

bool esphome::cc1101::CC1101Component::initialized_ {false}
protected

Definition at line 80 of file cc1101.h.

◆ output_power_effective_

float esphome::cc1101::CC1101Component::output_power_effective_ {10.0f}
protected

Definition at line 83 of file cc1101.h.

◆ output_power_requested_

float esphome::cc1101::CC1101Component::output_power_requested_ {10.0f}
protected

Definition at line 82 of file cc1101.h.

◆ pa_table_

uint8_t esphome::cc1101::CC1101Component::pa_table_[PA_TABLE_SIZE] {}
protected

Definition at line 84 of file cc1101.h.

◆ packet_

std::vector<uint8_t> esphome::cc1101::CC1101Component::packet_
protected

Definition at line 93 of file cc1101.h.

◆ packet_trigger_

Trigger<std::vector<uint8_t>, float, uint8_t>* esphome::cc1101::CC1101Component::packet_trigger_ {new Trigger<std::vector<uint8_t>, float, uint8_t>()}
protected

Definition at line 92 of file cc1101.h.

◆ state_

CC1101State esphome::cc1101::CC1101Component::state_
protected

Definition at line 86 of file cc1101.h.


The documentation for this class was generated from the following files: