mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
This commit is contained in:
@ -20,3 +20,4 @@
|
|||||||
[env:esp01_8266]
|
[env:esp01_8266]
|
||||||
platform = espressif
|
platform = espressif
|
||||||
board = esp01
|
board = esp01
|
||||||
|
build_flags = -Wl,-T"eagle.app.v6.ld"
|
||||||
|
36
examples/espressif/esp8266-native/src/blinky.c
Normal file
36
examples/espressif/esp8266-native/src/blinky.c
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include "ets_sys.h"
|
||||||
|
#include "osapi.h"
|
||||||
|
#include "gpio.h"
|
||||||
|
#include "os_type.h"
|
||||||
|
|
||||||
|
static const int pin = 1;
|
||||||
|
static volatile os_timer_t some_timer;
|
||||||
|
|
||||||
|
void some_timerfunc(void *arg)
|
||||||
|
{
|
||||||
|
//Do blinky stuff
|
||||||
|
if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & (1 << pin))
|
||||||
|
{
|
||||||
|
// set gpio low
|
||||||
|
gpio_output_set(0, (1 << pin), 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// set gpio high
|
||||||
|
gpio_output_set((1 << pin), 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICACHE_FLASH_ATTR user_init()
|
||||||
|
{
|
||||||
|
// init gpio sussytem
|
||||||
|
gpio_init();
|
||||||
|
|
||||||
|
// configure UART TXD to be GPIO1, set as output
|
||||||
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1);
|
||||||
|
gpio_output_set(0, 0, (1 << pin), 0);
|
||||||
|
|
||||||
|
// setup timer (500ms, repeating)
|
||||||
|
os_timer_setfn(&some_timer, (os_timer_func_t *)some_timerfunc, NULL);
|
||||||
|
os_timer_arm(&some_timer, 1000, 1);
|
||||||
|
}
|
@ -1,68 +0,0 @@
|
|||||||
/******************************************************************************
|
|
||||||
* Copyright 2013-2014 Espressif Systems (Wuxi)
|
|
||||||
*
|
|
||||||
* FileName: user_main.c
|
|
||||||
*
|
|
||||||
* Description: entry file of user application
|
|
||||||
*
|
|
||||||
* Modification history:
|
|
||||||
* 2014/1/1, v1.0 create this file.
|
|
||||||
*******************************************************************************/
|
|
||||||
#include "ets_sys.h"
|
|
||||||
#include "osapi.h"
|
|
||||||
|
|
||||||
#include "user_interface.h"
|
|
||||||
#include "smartconfig.h"
|
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR
|
|
||||||
smartconfig_done(sc_status status, void *pdata)
|
|
||||||
{
|
|
||||||
switch(status) {
|
|
||||||
case SC_STATUS_WAIT:
|
|
||||||
os_printf("SC_STATUS_WAIT\n");
|
|
||||||
break;
|
|
||||||
case SC_STATUS_FIND_CHANNEL:
|
|
||||||
os_printf("SC_STATUS_FIND_CHANNEL\n");
|
|
||||||
break;
|
|
||||||
case SC_STATUS_GETTING_SSID_PSWD:
|
|
||||||
os_printf("SC_STATUS_GETTING_SSID_PSWD\n");
|
|
||||||
sc_type *type = pdata;
|
|
||||||
if (*type == SC_TYPE_ESPTOUCH) {
|
|
||||||
os_printf("SC_TYPE:SC_TYPE_ESPTOUCH\n");
|
|
||||||
} else {
|
|
||||||
os_printf("SC_TYPE:SC_TYPE_AIRKISS\n");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SC_STATUS_LINK:
|
|
||||||
os_printf("SC_STATUS_LINK\n");
|
|
||||||
struct station_config *sta_conf = pdata;
|
|
||||||
|
|
||||||
wifi_station_set_config(sta_conf);
|
|
||||||
wifi_station_disconnect();
|
|
||||||
wifi_station_connect();
|
|
||||||
break;
|
|
||||||
case SC_STATUS_LINK_OVER:
|
|
||||||
os_printf("SC_STATUS_LINK_OVER\n");
|
|
||||||
if (pdata != NULL) {
|
|
||||||
uint8 phone_ip[4] = {0};
|
|
||||||
|
|
||||||
os_memcpy(phone_ip, (uint8*)pdata, 4);
|
|
||||||
os_printf("Phone ip: %d.%d.%d.%d\n",phone_ip[0],phone_ip[1],phone_ip[2],phone_ip[3]);
|
|
||||||
}
|
|
||||||
smartconfig_stop();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void user_rf_pre_init(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void user_init(void)
|
|
||||||
{
|
|
||||||
os_printf("SDK version:%s\n", system_get_sdk_version());
|
|
||||||
|
|
||||||
wifi_set_opmode(STATION_MODE);
|
|
||||||
smartconfig_start(smartconfig_done);
|
|
||||||
}
|
|
@ -254,16 +254,21 @@ else:
|
|||||||
join("$PIOPACKAGES_DIR", "sdk-esp8266", "include"),
|
join("$PIOPACKAGES_DIR", "sdk-esp8266", "include"),
|
||||||
"$PROJECTSRC_DIR"
|
"$PROJECTSRC_DIR"
|
||||||
],
|
],
|
||||||
LIBPATH=[join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib")],
|
|
||||||
|
LIBPATH=[
|
||||||
|
join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib"),
|
||||||
|
join("$PIOPACKAGES_DIR", "sdk-esp8266", "ld")
|
||||||
|
],
|
||||||
|
|
||||||
BUILDERS=dict(
|
BUILDERS=dict(
|
||||||
ElfToBin=Builder(
|
ElfToBin=Builder(
|
||||||
action=" ".join([
|
action=" ".join([
|
||||||
'"$OBJCOPY"',
|
'"$OBJCOPY"',
|
||||||
"-eo", "$SOURCES",
|
"-eo", "$SOURCES",
|
||||||
"-bo", "${TARGETS[0]}",
|
"-bo", "${TARGETS[0]}",
|
||||||
"-bm", "qio",
|
"-bm", "$BOARD_FLASH_MODE",
|
||||||
"-bf", "40",
|
"-bf", "${__get_board_f_flash(__env__)}",
|
||||||
"-bz", "512K",
|
"-bz", "${__get_flash_size(__env__)}",
|
||||||
"-bs", ".text",
|
"-bs", ".text",
|
||||||
"-bs", ".data",
|
"-bs", ".data",
|
||||||
"-bs", ".rodata",
|
"-bs", ".rodata",
|
||||||
@ -277,20 +282,24 @@ else:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
env.Replace(
|
env.Replace(
|
||||||
LDSCRIPT_PATH=join(
|
LIBS=[
|
||||||
"$PIOPACKAGES_DIR", "sdk-esp8266", "ld", "eagle.app.v6.ld"),
|
"c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "wpa2",
|
||||||
LIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main",
|
"main", "wps", "crypto", "json", "ssl", "pwm", "upgrade",
|
||||||
"json", "upgrade", "smartconfig", "pwm", "at", "ssl"],
|
"smartconfig", "airkiss", "at"
|
||||||
|
],
|
||||||
|
|
||||||
UPLOADERFLAGS=[
|
UPLOADERFLAGS=[
|
||||||
"-vv",
|
"-vv",
|
||||||
"-cd", "ck",
|
"-cd", "$UPLOAD_RESETMETHOD",
|
||||||
"-cb", "$UPLOAD_SPEED",
|
"-cb", "$UPLOAD_SPEED",
|
||||||
"-cp", "$UPLOAD_PORT",
|
"-cp", "$UPLOAD_PORT",
|
||||||
"-ca", "0x00000",
|
"-ca", "0x00000",
|
||||||
"-cf", "${SOURCES[0]}",
|
"-cf", "${SOURCES[0]}",
|
||||||
"-ca", "0x40000",
|
"-ca", "0x40000",
|
||||||
"-cf", "${SOURCES[1]}"
|
"-cf", "${SOURCES[1]}"
|
||||||
]
|
],
|
||||||
|
|
||||||
|
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS',
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user