mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-11-03 14:33:37 +03:00 
			
		
		
		
	analogRead
This commit is contained in:
		@@ -27,29 +27,17 @@
 | 
				
			|||||||
#include "wiring_private.h"
 | 
					#include "wiring_private.h"
 | 
				
			||||||
#include "pins_arduino.h"
 | 
					#include "pins_arduino.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8_t analog_reference = DEFAULT;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void analogReference(uint8_t mode)
 | 
					void analogReference(uint8_t mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	analog_reference = mode;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int analogRead(uint8_t pin)
 | 
					int analogRead(uint8_t pin)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint8_t low, high;
 | 
					  if (pin == 0)
 | 
				
			||||||
 | 
					    return system_adc_read();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	low  = 0;
 | 
					  return 0;
 | 
				
			||||||
	high = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// combine the two bytes
 | 
					 | 
				
			||||||
	return (high << 8) | low;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Right now, PWM output only works on the pins with
 | 
					 | 
				
			||||||
// hardware support.  These are defined in the appropriate
 | 
					 | 
				
			||||||
// pins_*.c file.  For the rest of the pins, we default
 | 
					 | 
				
			||||||
// to digital output.
 | 
					 | 
				
			||||||
void analogWrite(uint8_t pin, int val)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -132,3 +132,10 @@ void initPins()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void analogWrite(uint8_t pin, int val)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user