11 static const char *
const TAG =
"mpr121";
14 ESP_LOGCONFIG(TAG,
"Setting up MPR121...");
59 uint8_t mask = debounce << 4;
65 uint8_t mask = debounce & 0x0f;
71 ESP_LOGCONFIG(TAG,
"MPR121:");
73 switch (this->error_code_) {
75 ESP_LOGE(TAG,
"Communication with MPR121 failed!");
78 ESP_LOGE(TAG,
"MPR121 has wrong default value for CONFIG2?");
90 uint8_t lsb = val >> 8;
92 val = (uint16_t(msb) << 8) | lsb;
95 channel->process(val);
144 assert(this->pin_ >= 4);
145 this->parent_->pin_mode(this->pin_ - 4, flags);
149 assert(this->pin_ >= 4);
150 return this->parent_->digital_read(this->pin_ - 4) != this->inverted_;
154 assert(this->pin_ >= 4);
155 this->parent_->digital_write(this->pin_ - 4, value != this->inverted_);
160 snprintf(buffer,
sizeof(buffer),
"ELE%u on MPR121", this->pin_);
bool digital_read(uint8_t ionum)
bool read_byte(uint8_t a_register, uint8_t *data, bool stop=true)
bool read_byte_16(uint8_t a_register, uint16_t *data)
void status_set_warning(const char *message="unspecified")
uint8_t gpio_input_
The mask to read as input state - 1 means HIGH, 0 means LOW.
bool digital_read() override
void set_release_debounce(uint8_t debounce)
void pin_mode(uint8_t ionum, gpio::Flags flags)
enum esphome::mpr121::MPR121Component::ErrorCode NONE
std::vector< MPR121Channel * > channels_
uint8_t gpio_enable_
The enable mask - zero means high Z, 1 means GPIO usage.
void status_clear_warning()
uint8_t gpio_direction_
Mask for the pin mode - 1 means output, 0 means input.
void digital_write(uint8_t ionum, bool value)
bool write_byte(uint8_t a_register, uint8_t data, bool stop=true)
void digital_write(bool value) override
virtual void mark_failed()
Mark this component as failed.
std::string dump_summary() const override
Implementation of SPI Controller mode.
void dump_config() override
uint8_t max_touch_channel_
void pin_mode(gpio::Flags flags) override
uint8_t gpio_output_
The mask to write as output state - 1 means HIGH, 0 means LOW.
void IRAM_ATTR HOT delay(uint32_t ms)
void set_touch_debounce(uint8_t debounce)