mirror of
				https://github.com/halleysfifthinc/Toyota-AVC-LAN
				synced 2025-10-31 02:17:20 +00:00 
			
		
		
		
	Change sendbit timer config to optimize function length (insns)
This commit is contained in:
		
							parent
							
								
									ba27167b2e
								
							
						
					
					
						commit
						ba40f96d44
					
				| @ -191,10 +191,9 @@ void AVCLAN_init() { | |||||||
|   PORTB.DIRSET = PIN2_bm;                     // Enable AC2 OUT for LED
 |   PORTB.DIRSET = PIN2_bm;                     // Enable AC2 OUT for LED
 | ||||||
|   PORTB.PIN2CTRL = PORT_ISC_INPUT_DISABLE_gc; // Output only
 |   PORTB.PIN2CTRL = PORT_ISC_INPUT_DISABLE_gc; // Output only
 | ||||||
| 
 | 
 | ||||||
|   TCB1.CTRLB = TCB_ASYNC_bm | TCB_CNTMODE_SINGLE_gc; |   // TCB1 for send bit timing
 | ||||||
|   TCB1.EVCTRL = TCB_CAPTEI_bm; |   TCB1.CTRLB = TCB_CNTMODE_INT_gc; | ||||||
|   TCB1.INTCTRL = TCB_CAPT_bm; |   TCB1.CCMP = 0xFFFF; | ||||||
|   EVSYS.ASYNCUSER0 = EVSYS_ASYNCUSER0_ASYNCCH0_gc; |  | ||||||
|   TCB1.CTRLA = TCB_CLKSEL_CLKDIV2_gc | TCB_ENABLE_bm; |   TCB1.CTRLA = TCB_CLKSEL_CLKDIV2_gc | TCB_ENABLE_bm; | ||||||
| 
 | 
 | ||||||
|   answerReq = cm_Null; |   answerReq = cm_Null; | ||||||
| @ -225,15 +224,15 @@ uint8_t AVCLan_Read_Byte(uint8_t length, uint8_t *parity) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void set_AVC_logic_for(uint8_t val, uint16_t period) { | void set_AVC_logic_for(uint8_t val, uint16_t period) { | ||||||
|   if (val == 1) { |   TCB1.CNT = 0; | ||||||
|  |   if (val) { | ||||||
|     AVC_SET_LOGICAL_1(); |     AVC_SET_LOGICAL_1(); | ||||||
|   } else { |   } else { | ||||||
|     AVC_SET_LOGICAL_0(); |     AVC_SET_LOGICAL_0(); | ||||||
|   } |   } | ||||||
|   TCB1.CCMP = period; |   while (TCB1.CNT <= period) {}; | ||||||
|   EVSYS.ASYNCSTROBE = EVSYS_ASYNCCH0_0_bm; | 
 | ||||||
|   loop_until_bit_is_set(TCB1_INTFLAGS, 0); |   return; | ||||||
|   TCB1_INTFLAGS = 1; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| uint8_t AVCLan_Send_StartBit() { | uint8_t AVCLan_Send_StartBit() { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user