mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
parent
9f67167eef
commit
9dce0c4181
10
README.md
10
README.md
@ -169,6 +169,16 @@ Several APIs may be used to get flash chip info:
|
||||
|
||||
```ESP.getCycleCount()``` returns the cpu instruction cycle count since start as an unsigned 32-bit. This is useful for accurate timing of very short actions like bit banging.
|
||||
|
||||
```ESP.getVcc()``` may be used to measure supply voltage. ESP needs to reconfigure the ADC
|
||||
at startup in order for this feature to be available. Add the following line to the top
|
||||
of your sketch to use ```getVcc```:
|
||||
```
|
||||
ADC_MODE(ADC_VCC);
|
||||
```
|
||||
TOUT pin has to be disconnected in this mode.
|
||||
|
||||
Note that by default ADC is configured to read from TOUT pin using ```analogRead(A0)```, and
|
||||
```ESP.getVCC()``` is not available.
|
||||
|
||||
#### OneWire (from https://www.pjrc.com/teensy/td_libs_OneWire.html) ####
|
||||
|
||||
|
@ -61,6 +61,15 @@ enum RFMode {
|
||||
#define WAKE_NO_RFCAL RF_NO_CAL
|
||||
#define WAKE_RF_DISABLED RF_DISABLED
|
||||
|
||||
enum ADCMode {
|
||||
ADC_TOUT = 33,
|
||||
ADC_TOUT_3V3 = 33,
|
||||
ADC_VCC = 255,
|
||||
ADC_VDD = 255
|
||||
};
|
||||
|
||||
#define ADC_MODE(mode) extern "C" int __get_adc_mode() { return (int) (mode); }
|
||||
|
||||
typedef enum {
|
||||
FM_QIO = 0x00,
|
||||
FM_QOUT = 0x01,
|
||||
|
@ -224,6 +224,7 @@ static uint8_t phy_init_data[128] =
|
||||
|
||||
extern int __real_register_chipv6_phy(uint8_t* init_data);
|
||||
extern int __wrap_register_chipv6_phy(uint8_t* unused) {
|
||||
phy_init_data[107] = __get_adc_mode();
|
||||
return __real_register_chipv6_phy(phy_init_data);
|
||||
}
|
||||
|
||||
@ -243,6 +244,10 @@ extern int __get_rf_mode()
|
||||
return 0; // default mode
|
||||
}
|
||||
|
||||
|
||||
extern int __get_adc_mode() __attribute__((weak));
|
||||
extern int __get_adc_mode()
|
||||
{
|
||||
return 33; // default ADC mode
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user