Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed May 21, 2024
1 parent 50b8dce commit 0d28003
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions components/tcs_intercom/tcs_intercom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include "esphome/components/api/custom_api_device.h"
#include "esphome/core/application.h"
#include <Arduino.h>
#include "soc/efuse_reg.h"

//#include "soc/efuse_reg.h"
#include "esp_efuse.h"
#include "esp_efuse_table.h"

Expand All @@ -24,6 +25,24 @@ namespace esphome
{
ESP_LOGCONFIG(TAG, "Setting up TCS Intercom...");



// Doorman Hardware Revision
uint8_t ver[3];
uint32_t value;
esp_efuse_read_block(EFUSE_BLK3, &value, 0, 24);
ver[0] = value >> 0;
ver[1] = value >> 8;
ver[2] = value >> 16;

if(ver[0] > 0)
{
this->rx_pin_.set_pin(gpio_num_t(22));
this->rx_pin_.set_pin(gpio_num_t(23));
}



this->rx_pin_->setup();
this->tx_pin_->setup();
this->tx_pin_->digital_write(false);
Expand Down Expand Up @@ -64,33 +83,15 @@ namespace esphome



/*char h[32];
uint32_t field1_1 = 0;
esp_efuse_read_field_blob(ESP_EFUSE_USER_DATA, &field1_1, 8);
sprintf(h, "%08X ", field1_1);
ESP_LOGW(TAG, "User Data:");
ESP_LOGW(TAG, h);
ESP_LOG(TAG, h);*/


uint8_t ver[3];

uint32_t value;
esp_efuse_read_block(EFUSE_BLK3, &value, 0, 24);
ver[0] = value >> 0;
ver[1] = value >> 8;
ver[2] = value >> 16;

ESP_LOGI(TAG, "Version: %i.%i.%i", ver[0], ver[1], ver[2]);

/*har h[10];
for (int32_t block3Address = EFUSE_BLK3_RDATA0_REG, i = 0; block3Address <= EFUSE_BLK3_RDATA7_REG; block3Address += 4, ++i)
{
uint32_t block = REG_GET_FIELD(block3Address, EFUSE_BLK3_DOUT0);
sprintf(h, "%08X ", block);
ESP_LOGCONFIG(TAG, h);
}*/
}

void TCSComponent::loop()
Expand Down

0 comments on commit 0d28003

Please sign in to comment.