Removed magic numbers from the Reading of the ZCD pin.
This commit is contained in:
		
							parent
							
								
									b987d81827
								
							
						
					
					
						commit
						f3c48ba643
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -15,6 +15,8 @@
 | 
				
			||||||
#include "MockADC/MockADC.h"
 | 
					#include "MockADC/MockADC.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define ZCD_PIN 0x07
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ZCD_Setup(void)
 | 
					void ZCD_Setup(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ADC_Init(7);
 | 
					    ADC_Init(7);
 | 
				
			||||||
| 
						 | 
					@ -25,11 +27,11 @@ bool ZCD_IsTriggered()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    uint16_t first, second;
 | 
					    uint16_t first, second;
 | 
				
			||||||
    ZCD_Setup();
 | 
					    ZCD_Setup();
 | 
				
			||||||
    first = ADC_ReadValue(7);
 | 
					    first = ADC_ReadValue(ZCD_PIN);
 | 
				
			||||||
    ADC_Disable();
 | 
					    ADC_Disable();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ZCD_Setup();
 | 
					    ZCD_Setup();
 | 
				
			||||||
    second = ADC_ReadValue(7);
 | 
					    second = ADC_ReadValue(ZCD_PIN);
 | 
				
			||||||
    ADC_Disable();
 | 
					    ADC_Disable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(second < TRIGGERVAL){
 | 
					    if(second < TRIGGERVAL){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue