Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the SDK to 1.0.1_b2_15_04_10, and some more #93

Merged
merged 11 commits into from
Apr 23, 2015
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,10 @@ build/windows/launcher/launch4j
build/windows/WinAVR-*.zip
hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h
avr-toolchain-*.zip
/hardware/tools/esp8266/utils/
/hardware/tools/esp8266/xtensa-lx106-elf
/hardware/tools/esp8266/esptool.exe
/hardware/tools/avr/
/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/
/hardware/tools/bossac.exe
/hardware/tools/listComPorts.exe
1 change: 1 addition & 0 deletions hardware/esp8266com/esp8266/cores/esp8266/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void yield(void);
#define INPUT 0x0
#define OUTPUT 0x1
#define INPUT_PULLUP 0x2
#define INPUT_PULLDOWN 0x3
#define OUTPUT_OPEN_DRAIN 0x4

#define PI 3.1415926535897932384626433832795
Expand Down
46 changes: 42 additions & 4 deletions hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ extern "C" {
#include "user_interface.h"
}

extern "C" void ets_wdt_enable (void);
extern "C" void ets_wdt_disable (void);
extern "C" void wdt_feed (void);

//extern "C" void ets_wdt_init(uint32_t val);
extern "C" void ets_wdt_enable(void);
extern "C" void ets_wdt_disable(void);
extern "C" void wdt_feed(void);

EspClass ESP;

Expand All @@ -35,11 +37,17 @@ EspClass::EspClass()

}

void EspClass::wdtEnable(int)
void EspClass::wdtEnable(uint32_t timeout_ms)
{
//todo find doku for ets_wdt_init may set the timeout
ets_wdt_enable();
}

void EspClass::wdtEnable(WDTO_t timeout_ms)
{
wdtEnable((uint32_t) timeout_ms);
}

void EspClass::wdtDisable(void)
{
ets_wdt_disable();
Expand Down Expand Up @@ -70,3 +78,33 @@ uint16_t EspClass::getVCC(void)
{
return system_get_vdd33();
}

uint32_t EspClass::getFreeHeap(void)
{
return system_get_free_heap_size();
}

uint32_t EspClass::getChipId(void)
{
return system_get_chip_id();
}

const char * EspClass::getSDKversion(void)
{
return system_get_sdk_version();
}

uint8_t EspClass::getBootVersion(void)
{
return system_get_boot_version();
}

uint8_t EspClass::getBootMode(void)
{
return system_get_boot_mode();
}

uint8_t EspClass::getCPUfreqMHz(void)
{
return system_get_cpu_freq();
}
35 changes: 34 additions & 1 deletion hardware/esp8266com/esp8266/cores/esp8266/Esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,27 @@

#ifndef ESP_H
#define ESP_H
/**
* AVR macros for WDT managment
*/
typedef enum {
WDTO_0MS = 0, //!< WDTO_0MS
WDTO_15MS = 15, //!< WDTO_15MS
WDTO_30MS = 30, //!< WDTO_30MS
WDTO_60MS = 60, //!< WDTO_60MS
WDTO_120MS = 120, //!< WDTO_120MS
WDTO_250MS = 250, //!< WDTO_250MS
WDTO_500MS = 500, //!< WDTO_500MS
WDTO_1S = 1000,//!< WDTO_1S
WDTO_2S = 2000,//!< WDTO_2S
WDTO_4S = 4000,//!< WDTO_4S
WDTO_8S = 8000 //!< WDTO_8S
} WDTO_t;


#define wdt_enable(time) ESP.wdtEnable(time)
#define wdt_disable() ESP.wdtDisable()
#define wdt_reset() ESP.wdtFeed()

enum WakeMode {
WAKE_RF_DEFAULT = 0, // RF_CAL or not after deep-sleep wake up, depends on init data byte 108.
Expand All @@ -33,8 +53,10 @@ class EspClass {
public:
EspClass();

void wdtEnable(int timeout_ms = 0);
// TODO: figure out how to set WDT timeout
void wdtEnable(uint32_t timeout_ms = 0);
void wdtEnable(WDTO_t timeout_ms = WDTO_0MS);

void wdtDisable(void);
void wdtFeed(void);

Expand All @@ -44,6 +66,17 @@ class EspClass {
void reset(void);
void restart(void);
uint16_t getVCC(void);
uint32_t getFreeHeap(void);

uint32_t getChipId(void);

const char * getSDKversion(void);

uint8_t getBootVersion(void);
uint8_t getBootMode(void);

uint8_t getCPUfreqMHz(void);

};

extern EspClass ESP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void ICACHE_FLASH_ATTR uart1_write_char(char c) {
}
}

static UARTnr_t s_uart_debug_nr = UART_NO;
static UARTnr_t s_uart_debug_nr = UART0;
void ICACHE_FLASH_ATTR uart_set_debug(UARTnr_t uart_nr) {
s_uart_debug_nr = uart_nr;
switch(s_uart_debug_nr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ extern void __pinMode(uint8_t pin, uint8_t mode) {
PIN_PULLUP_DIS(mux);
} else if(mode == INPUT_PULLUP) {
gpio_output_set(0, 0, 0, 1 << pin);
PIN_PULLDWN_DIS(mux);
PIN_PULLUP_EN(mux);
} else if(mode == INPUT_PULLDOWN) {
gpio_output_set(0, 0, 0, 1 << pin);
PIN_PULLUP_DIS(mux);
PIN_PULLDWN_EN(mux);
} else if(mode == OUTPUT) {
gpio_output_set(0, 0, 1 << pin, 0);
} else if(mode == OUTPUT_OPEN_DRAIN) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <math.h>
#include <limits.h>
#include <errno.h>
#include <string.h>

#include "ets_sys.h"
#include "os_type.h"
Expand Down
12 changes: 11 additions & 1 deletion hardware/esp8266com/esp8266/cores/esp8266/pgmspace.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
#ifndef __PGMSPACE_H_
#define __PGMSPACE_H_

#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdio.h>
#include "ets_sys.h"
#include "osapi.h"
#ifdef __cplusplus
}
#endif

#define PROGMEM
#define PGM_P const char *
#define PSTR(str) (str)

#define vsnprintf_P(...) vsnprintf( __VA_ARGS__ )
#define vsnprintf_P(...) ets_vsnprintf( __VA_ARGS__ )
#define snprintf_P(...) snprintf( __VA_ARGS__ )
#define printf_P(...) os_printf(__VA_ARGS__)

#define _SFR_BYTE(n) (n)

Expand Down
68 changes: 68 additions & 0 deletions hardware/tools/esp8266/sdk/License
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
ESPRESSIF GENERAL PUBLIC LICENSE

PREAMBLE

The Espressif General Public License is a free, copyleft license for software and other kinds of works.
The Espressif General Public License is intended to guarantee your freedom to share and change all versions of a program released by ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD, to make sure it remains free software for all its users. We use the Espressif General Public License for all of our open-source software.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the Espressif GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.

TERMS AND CONDITIONS

0. Definitions.
��This License�� refers to the Espressif Public License.

��The Program�� refers to any copyrightable work licensed under this License. Each licensee is addressed as ��you��. ��Licensees�� and ��recipients�� may be individuals or organizations.
To ��modify�� a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a ��modified version�� of the earlier work or a work ��based on�� the earlier work.
A ��covered work�� means either the unmodified Program or a work based on the Program.
To ��propagate�� a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To ��convey�� a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
1. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below.

2. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.

3. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License applies to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.

4. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 3, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License. This requirement modifies the requirement in section 3 to ��keep intact all notices��.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.

5. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 7.

6. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.

7. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.

8. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
9. Revised Versions of this License.
ESPRESSIF SYSTEMS (SHANGHAI) PTE LED may publish revised and/or new versions of the ESPRESSIF General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the Espressif General Public License ��or any later version�� applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD. If the Program does not specify a version number of the Espressif General Public License, you may choose any version ever published.

10. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ��AS IS�� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

11. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


12. Interpretation of Sections 10 and 11.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.

END OF TERMS AND CONDITIONS
Loading