-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Esp8266 PHY settings runtime modification (#2830)
The initial PHY data is used initialize an ESP8266 chip and controls its behaviour. This is stored in the ``phy_init`` partition and is loaded at startup. Sometimes you may want to change that data for a certain ROM on the device without changing it for all ROMs on the device. To do this, build with ``ENABLE_CUSTOM_PHY=1`` and add code to your application: ``` #include <esp_phy.h> void customPhyInit(PhyInitData data) { // Use methods of `data` to modify as required data.set_vdd33_const(0xff); } ``` This PR supersedes #1491 and provides a more C++ mechanism for adjusting the configuration at runtime.
- Loading branch information
Showing
5 changed files
with
451 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Adapted from Arduino for Sming. | ||
Original copyright note is kept below. | ||
phy.c - ESP8266 PHY initialization data | ||
Copyright (c) 2015 Ivan Grokhotkov. All rights reserved. | ||
This file is part of the esp8266 core for Arduino environment. | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
|
||
// #ifdef ENABLE_CUSTOM_PHY | ||
|
||
#include "include/esp_phy.h" | ||
#include <Storage.h> | ||
#include <esp_attr.h> | ||
#include <sys/pgmspace.h> | ||
#include <string.h> | ||
|
||
extern "C" { | ||
extern int __wrap_register_chipv6_phy(uint8_t* initData); | ||
extern int __real_register_chipv6_phy(uint8_t* initData); | ||
} | ||
|
||
int ICACHE_RAM_ATTR __wrap_register_chipv6_phy(uint8_t* initData) | ||
{ | ||
if(initData != NULL) { | ||
PhyInitData data{initData}; | ||
customPhyInit(data); | ||
} | ||
return __real_register_chipv6_phy(initData); | ||
} | ||
|
||
// #endif /* ENABLE_CUSTOM_PHY */ |
Oops, something went wrong.