44 ESP_LOGCONFIG(TAG,
"Setting up ATM90E26 Component...");
47 uint16_t mmode = 0x422;
51 this->
write16_(ATM90E26_REGISTER_SOFTRESET, 0x789A);
52 this->
write16_(ATM90E26_REGISTER_FUNCEN,
54 uint16_t read = this->
read16_(ATM90E26_REGISTER_LASTDATA);
56 ESP_LOGW(TAG,
"Could not initialize ATM90E26 IC, check SPI settings: %d", read);
61 this->
write16_(ATM90E26_REGISTER_SAGTH, 0x17DD);
64 this->
write16_(ATM90E26_REGISTER_CALSTART, 0x5678);
67 this->
write16_(ATM90E26_REGISTER_MMODE, mmode);
74 this->
write16_(ATM90E26_REGISTER_LPHI, 0x0000);
75 this->
write16_(ATM90E26_REGISTER_NGAIN, 0x0000);
76 this->
write16_(ATM90E26_REGISTER_NPHI, 0x0000);
77 this->
write16_(ATM90E26_REGISTER_PSTARTTH, 0x08BD);
78 this->
write16_(ATM90E26_REGISTER_PNOLTH, 0x0000);
79 this->
write16_(ATM90E26_REGISTER_QSTARTTH, 0x0AEC);
80 this->
write16_(ATM90E26_REGISTER_QNOLTH, 0x0000);
93 this->
write16_(ATM90E26_REGISTER_CS1, cs);
94 ESP_LOGVV(TAG,
"Set CS1 to: 0x%04X", cs);
97 this->
write16_(ATM90E26_REGISTER_ADJSTART, 0x5678);
100 this->
write16_(ATM90E26_REGISTER_IGAINN, 0x7530);
101 this->
write16_(ATM90E26_REGISTER_UOFFSET, 0x0000);
102 this->
write16_(ATM90E26_REGISTER_IOFFSETL, 0x0000);
103 this->
write16_(ATM90E26_REGISTER_IOFFSETN, 0x0000);
104 this->
write16_(ATM90E26_REGISTER_POFFSETL, 0x0000);
105 this->
write16_(ATM90E26_REGISTER_QOFFSETL, 0x0000);
106 this->
write16_(ATM90E26_REGISTER_POFFSETN, 0x0000);
107 this->
write16_(ATM90E26_REGISTER_QOFFSETN, 0x0000);
112 this->
write16_(ATM90E26_REGISTER_CS2, cs);
113 ESP_LOGVV(TAG,
"Set CS2 to: 0x%04X", cs);
115 this->
write16_(ATM90E26_REGISTER_CALSTART,
117 this->
write16_(ATM90E26_REGISTER_ADJSTART,
120 const uint16_t sys_status = this->
read16_(ATM90E26_REGISTER_SYSSTATUS);
121 if (sys_status & 0xC000) {
123 ESP_LOGW(TAG,
"Could not initialize ATM90E26 IC: CS1 was incorrect, expected: 0x%04X",
124 this->
read16_(ATM90E26_REGISTER_CS1));
127 if (sys_status & 0x3000) {
128 ESP_LOGW(TAG,
"Could not initialize ATM90E26 IC: CS2 was incorrect, expected: 0x%04X",
129 this->
read16_(ATM90E26_REGISTER_CS2));