 389ff92cc1
			
		
	
	
		389ff92cc1
		
			
		
	
	
	
	
		
			
			* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
		
			
				
	
	
		
			36 lines
		
	
	
		
			795 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			795 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| #include "../ibutton_key.h"
 | |
| #include <one_wire_master.h>
 | |
| 
 | |
| class KeyWriter {
 | |
| public:
 | |
|     enum class Error : uint8_t {
 | |
|         OK,
 | |
|         SAME_KEY,
 | |
|         NO_DETECT,
 | |
|         CANNOT_WRITE,
 | |
|     };
 | |
| 
 | |
|     KeyWriter(OneWireMaster* onewire_master);
 | |
|     ~KeyWriter();
 | |
| 
 | |
|     KeyWriter::Error write(iButtonKey* key);
 | |
|     void start();
 | |
|     void stop();
 | |
| 
 | |
| private:
 | |
|     OneWireMaster* onewire_master;
 | |
| 
 | |
|     KeyWriter::Error write_internal(iButtonKey* key);
 | |
|     bool compare_key_ds1990(iButtonKey* key);
 | |
| 
 | |
|     // write strategy
 | |
|     bool write_1990_1(iButtonKey* key);
 | |
|     bool write_1990_2(iButtonKey* key);
 | |
|     bool write_TM2004(iButtonKey* key);
 | |
|     bool write_TM01(iButtonKey* key);
 | |
| 
 | |
|     void onewire_write_one_bit(bool value, uint32_t delay = 10000);
 | |
|     void write_byte_ds1990(uint8_t data);
 | |
| };
 |