 bdba15b366
			
		
	
	
		bdba15b366
		
			
		
	
	
	
	
		
			
			* iButton: getting started on the worker concept * Hal delay: added global instructions_per_us variable * iButton: one wire slave * iButton: ibutton key setter * iButton: one wire host, use ibutton_hal * iButton\RFID: common pulse decoder concept * iButton: cyfral decoder * iButton: worker thread concept * iButton: metakom decoder * iButton: write key through worker * iButton: worker mode holder * iButton: worker improvements * iButton: Cyfral encoder * iButton: Metakom encoder * lib: pulse protocol helpers * iButton: Metakom decoder * iButton: Cyfral decoder * iButton worker: separate modes * iButton: libs documentation * HAL: iButton gpio modes * iButton worker: rename modes file * iButton worker, hal: move to LL * iButton CLI: worker for reading and emulation commands * iButton HAL: correct init and emulation sequence * iButton cli: moved to plain C * iButton: move to worker, small step to plain C * Libs, one wire: move to plain C * Libs: added forgotten files to compilation * iButton writer: get rid of manual disable/enable irq
		
			
				
	
	
		
			16 lines
		
	
	
		
			511 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			511 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "maxim_crc.h"
 | |
| 
 | |
| uint8_t maxim_crc8(const uint8_t* data, const uint8_t data_size, const uint8_t crc_init) {
 | |
|     uint8_t crc = crc_init;
 | |
| 
 | |
|     for(uint8_t index = 0; index < data_size; ++index) {
 | |
|         uint8_t input_byte = data[index];
 | |
|         for(uint8_t bit_position = 0; bit_position < 8; ++bit_position) {
 | |
|             const uint8_t mix = (crc ^ input_byte) & (uint8_t)(0x01);
 | |
|             crc >>= 1;
 | |
|             if(mix != 0) crc ^= 0x8C;
 | |
|             input_byte >>= 1;
 | |
|         }
 | |
|     }
 | |
|     return crc;
 | |
| } |