1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

analogRead

This commit is contained in:
Ivan Grokhotkov 2014-12-12 04:40:43 +03:00
parent 84765a16b0
commit f8ddfe8d0a
2 changed files with 10 additions and 15 deletions

View File

@ -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)
{
}

View File

@ -132,3 +132,10 @@ void initPins()
} }
} }
void analogWrite(uint8_t pin, int val)
{
}