Merge branch 'master' into lwip220d1

This commit is contained in:
Our Air Quality 2019-04-12 12:34:20 +10:00
commit 3f72d59b75
55 changed files with 1787 additions and 737 deletions

View file

@ -2,6 +2,7 @@ EXAMPLES = $(shell find $(dir $(lastword $(MAKEFILE_LIST))) -mindepth 2 -name Ma
# Generate some dummy .dummybuild/.dummyrebuild target files
EXAMPLES_BUILD = $(patsubst %,%.dummybuild,$(EXAMPLES))
EXAMPLES_REBUILD = $(patsubst %,%.dummyrebuild,$(EXAMPLES))
EXAMPLES_CLEAN = $(patsubst %,%.dummyclean,$(EXAMPLES))
warning:
@echo "******************************************************"
@ -21,12 +22,17 @@ build-examples: $(EXAMPLES_BUILD)
rebuild-examples: $(EXAMPLES_REBUILD)
clean-examples: $(EXAMPLES_CLEAN)
%.dummybuild:
$(MAKE) -C $(dir $@)
%.dummyrebuild:
$(MAKE) -C $(dir $@) rebuild
.PHONY: warning rebuild-examples build-examples
%.dummyclean:
$(MAKE) -C $(dir $@) clean
.PHONY: warning rebuild-examples build-examples clean-examples
.NOTPARALLEL:
.ONESHELL:

View file

@ -184,7 +184,7 @@ uint32_t IRAM run_test(const char *string, test_with_fn_t testfn, const char *te
return instructions;
}
void test_string(const char *string, char *label, bool evict_cache)
void test_string(const char *string, const char *label, bool evict_cache)
{
printf("Testing %s (%p) '%s'\r\n", label, string, string);
printf("Formats as: '");

View file

@ -43,7 +43,7 @@ int32_t ssi_handler(int32_t iIndex, char *pcInsert, int32_t iInsertLen)
return (strlen(pcInsert));
}
char *gpio_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
const char *gpio_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
{
for (int i = 0; i < iNumParams; i++) {
if (strcmp(pcParam[i], "on") == 0) {
@ -63,12 +63,12 @@ char *gpio_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValu
return "/index.ssi";
}
char *about_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
const char *about_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
{
return "/about.html";
}
char *websocket_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
const char *websocket_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
{
return "/websockets.html";
}

View file

@ -32,7 +32,7 @@
void sntp_tsk(void *pvParameters)
{
char *servers[] = {SNTP_SERVERS};
const char *servers[] = {SNTP_SERVERS};
UNUSED_ARG(pvParameters);
/* Wait until we have joined AP and are assigned an IP */

1
examples/tsoftuart/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
!local.mk

View file

@ -0,0 +1,7 @@
#define configUSE_TRACE_FACILITY 1
#define configGENERATE_RUN_TIME_STATS 1
#define portGET_RUN_TIME_COUNTER_VALUE() (RTC.COUNTER)
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() {}
/* Use the defaults for everything else */
#include_next<FreeRTOSConfig.h>

View file

@ -0,0 +1,13 @@
# Makefile for tsfotuart example
PROGRAM=tsoftuart
EXTRA_COMPONENTS=extras/dhcpserver extras/wificfg extras/mactimer extras/tsoftuart
# For the mDNS responder included with lwip:
EXTRA_CFLAGS += -DLWIP_MDNS_RESPONDER=1 -DLWIP_NUM_NETIF_CLIENT_DATA=1 -DLWIP_NETIF_EXT_STATUS_CALLBACK=1
# Avoid writing the wifi state to flash when using wificfg.
EXTRA_CFLAGS += -DWIFI_PARAM_SAVE=0
EXTRA_CFLAGS += -DWIFICFG_CLIENT_TASK=1 -DWIFICFG_IRAM_TEST=1
include ../../common.mk

View file

@ -0,0 +1 @@
FLASH_SIZE ?= 32

View file

@ -0,0 +1,75 @@
/*
* Example timer based software UART drive.
*
* Copyright (C) 2019 OurAirQuality.org
*
* Licensed under the Apache License, Version 2.0, January 2004 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.apache.org/licenses/
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS WITH THE SOFTWARE.
*
*/
#include <string.h>
#include <ctype.h>
#include <espressif/esp_common.h>
#include <espressif/user_interface.h>
#include <esp/uart.h>
#include <FreeRTOS.h>
#include <task.h>
#include "lwip/sockets.h"
#include "wificfg/wificfg.h"
#include "tsoftuart/tsoftuart.h"
static void tsoftuart_task(void *pvParameters)
{
/* Initialize the UART Tx. */
uint32_t tx_pin = *(uint32_t *)pvParameters;
struct tsoftuart *uart = tsoftuart_init(tx_pin, 9600);
for (;;) {
/* Reset the timing error records. */
uart->output_queue_error_low = 0;
uart->output_queue_error_high = 0;
char str[] = "Hello 0123456789 abcdefghijklmnopqrstuvwxyz\r\n";
for (size_t i = 0; i < strlen(str); i++) {
tsoftuart_putc(uart, str[i]);
}
/* Check the timing error. */
if (uart->output_queue_error_high > 2 || uart->output_queue_error_low < -2) {
tsoftuart_write(uart, "X\r\n", 3);
}
vTaskDelay(200 / portTICK_PERIOD_MS);
}
}
void user_init(void)
{
uart_set_baud(0, 115200);
printf("SDK version:%s\n", sdk_system_get_sdk_version());
wificfg_init(80, NULL);
/* Start two tasks writing to different pins. */
static uint32_t tx_pin1 = 1;
xTaskCreate(&tsoftuart_task, "tsoftuart1", 256, &tx_pin1, 1, NULL);
static uint32_t tx_pin2 = 2;
xTaskCreate(&tsoftuart_task, "tsoftuart2", 256, &tx_pin2, 1, NULL);
}

View file

@ -19,7 +19,7 @@ void httpd_task(void *pvParameters)
if ((err = netconn_recv(client, &nb)) == ERR_OK) {
struct sdk_station_config config;
sdk_wifi_station_get_config(&config);
char * buf =
const char * buf =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<root>\
<device>\
@ -50,4 +50,4 @@ void httpd_task(void *pvParameters)
netconn_close(client);
netconn_delete(client);
}
}
}

View file

@ -25,7 +25,7 @@ static const char* get_my_ip(void)
* @param recv the lwip UDP callback
* @retval udp_pcb* or NULL if joining failed
*/
static struct udp_pcb* mcast_join_group(char *group_ip, uint16_t group_port, void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port))
static struct udp_pcb* mcast_join_group(const char *group_ip, uint16_t group_port, void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port))
{
bool status = false;
struct udp_pcb *upcb;