+void owDeviceDS2408::setDefaultConfig() {\r
+ config->setConfig({0,13, 0,13, 0,13, 0,13, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0});\r
+ configstate=OWDCS_DEFAULT;\r
+}\r
+int owDeviceDS2408::convertAll() {\r
+ std::vector<uint8_t> da;\r
+ /*da.push_back(0x11);\r
+ da.push_back(0x22);\r
+ da.push_back(0x34);\r
+ writeMemory(0,0x8b,3,&da);\r
+ readMemory(0,0x88,10,&da);\r
+ printf("\n____________________________\n");\r
+ readChannelAccess(80,&da);\r
+ owi->log->clear();\r
+ da.clear();\r
+ da.push_back(0x11);\r
+ da.push_back(0x12);\r
+ da.push_back(0x31);\r
+ da.push_back(0x14);\r
+ da.push_back(0x55);\r
+ da.push_back(0x63);\r
+ da.push_back(0x70);\r
+ owi->log->clear();\r
+ \r
+ writeChannelAccess(7,&da);*/\r
+ return 1;\r
+}\r
+int owDeviceDS2408::readMemory(int page,int start, int count,std::vector<uint8_t> *data) {\r
+ std::vector<uint8_t> cl;\r
+ cl.push_back(0xF0);\r
+ cl.push_back(start&0xFF);\r
+ cl.push_back(start>>8);\r
+ if (start>=0x90) {\r
+ owi->log->set(OWLOG_WARNING,"DS2408 reading Register. Address value to hight");\r
+ return 0;\r
+ }\r
+ count=0x90-start;\r
+ \r
+ Communicate(&cl, 3,count+2 );\r
+ for (uint8_t v :cl) printf("%02X ",v);;printf("\n");\r
+ if (!owi->testCRC16(cl)) {\r
+ owi->log->set(OWLOG_ERROR,"CRC ERROR Reading Register of DS2408");\r
+ return 0;\r
+ }\r
+ data->clear();\r
+ data->insert(data->begin(),cl.begin()+3+start,cl.begin()+start+3+count);\r
+ return count;\r
+ \r
+}\r
+\r
+int owDeviceDS2408::writeMemory(int page,int start, int count,std::vector<uint8_t> *data) {\r
+ std::vector<uint8_t> cl;\r
+ cl.push_back(0xCC);\r
+ cl.push_back(start&0xFF);\r
+ cl.push_back(start>>8);\r
+ if ((start<0x8b)&&(start>0x8b)) {\r
+ owi->log->set(OWLOG_WARNING,"DS2408 writing Register. Address value not match 0x8B 0x8C 0x8D");\r
+ return 0;\r
+ }\r
+ if ((142-start)<count)\r
+ count=142-start;\r
+ for(int i=0;i<count;i++) {\r
+ cl.push_back((*data)[i]);\r
+ }\r
+ printf("count: %i\n",count);\r
+ for (uint8_t v :cl) printf("%02X ",v);;printf("\n");\r
+ Communicate(&cl, 3+count,0 );\r
+ \r
+ return count;\r
+}\r
+\r
+\r
+\r
+\r
+int owDeviceDS2408::readChannelAccess(int count,std::vector<uint8_t> *data) {\r
+ std::vector<uint8_t> cl;\r
+ cl.push_back(0xF5);\r
+ Communicate(&cl, 1,34 );\r
+ int read=0;\r
+ for (uint8_t v :cl) printf("%02X ",v);;printf("\n");\r
+ if (!owi->testCRC16(cl)) {\r
+ owi->log->set(OWLOG_ERROR,"CRC ERROR Reading Register of DS2408");\r
+ return 0;\r
+ }\r
+ read=32;\r
+ data->clear();\r
+ data->insert(data->begin(),cl.begin()+1,cl.begin()+33);\r
+\r
+ while (read<count) {\r
+ cl.clear();\r
+ owi->Communicate(&cl,0,34);\r
+ for (uint8_t v :cl) printf("%02X ",v);;printf("\n");\r
+ if (!owi->testCRC16(cl)) {\r
+ owi->log->set(OWLOG_ERROR,"CRC ERROR Reading Register of DS2408");\r
+ return read;\r
+ }\r
+ data->insert(data->begin()+read,cl.begin(),cl.begin()+32);\r
+ read+=32;\r
+\r
+ }\r
+ \r
+\r
+ return read;\r
+}\r
+int owDeviceDS2408::writeChannelAccess(int count, std::vector<uint8_t> *data) {\r
+ std::vector<uint8_t> cl;\r
+ cl.push_back(0x5A);\r
+ Communicate(&cl, 1,0 );\r
+ for(int i=0;i<count;i++) {\r
+ cl.clear();\r
+ uint8_t v=(*data)[i];\r
+ cl.push_back(v);\r
+ cl.push_back(~v);\r
+ owi->Communicate(&cl,2,2);\r
+ for (uint8_t v :cl) printf("%02X ",v);;printf("\n");\r
+ }\r
+ return count;\r
+}\r
+int owDeviceDS2408::resetActivityLatches() {\r
+ return 1;\r
+}\r
+\r
+\r
+\r
+\r