Skip to content

Commit

Permalink
user_config.h is deprecated
Browse files Browse the repository at this point in the history
Was removed from applications in SmingHub#1695.
It's a hangover from C esp8266 SDK applications and makes maintenace difficult because it contains so much stuff.
  • Loading branch information
mikee47 committed Nov 21, 2021
1 parent abf555a commit 976eb26
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 68 deletions.
1 change: 0 additions & 1 deletion Sming/Arch/Esp8266/Components/esp8266/crash_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include <user_config.h>
#include "gdb/gdb_hooks.h"

extern void __real_system_restart_local();
Expand Down
1 change: 1 addition & 0 deletions Sming/Arch/Esp8266/Core/Digital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <Digital.h>
#include "ESP8266EX.h"
#include <eagle_soc.h>

// Prototype declared in esp8266-peri.h
const uint8_t esp8266_gpioToFn[16] = {0x34, 0x18, 0x38, 0x14, 0x3C, 0x40, 0x1C, 0x20,
Expand Down
1 change: 1 addition & 0 deletions Sming/Arch/Esp8266/Core/ESP8266EX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Digital.h"
#include "ESP8266EX.h"
#include "Digital.h"
#include <espinc/pin_mux_register.h>

const EspDigitalPin EspDigitalPins[] = {
{0, PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0}, // FLASH
Expand Down
2 changes: 1 addition & 1 deletion Sming/Arch/Esp8266/Core/ESP8266EX.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#pragma once

#include "user_config.h"
#include <c_types.h>

#define TOTAL_PINS 16
#define NUM_DIGITAL_PINS TOTAL_PINS
Expand Down
21 changes: 11 additions & 10 deletions Sming/Arch/Esp8266/Core/HardwarePWM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@

#include <Clock.h>
#include "ESP8266EX.h"
#include <debug_progmem.h>

#include <HardwarePWM.h>

#define PERIOD_TO_MAX_DUTY(x) (x * 25)

HardwarePWM::HardwarePWM(uint8* pins, uint8 no_of_pins) : channel_count(no_of_pins)
HardwarePWM::HardwarePWM(uint8_t* pins, uint8_t no_of_pins) : channel_count(no_of_pins)
{
if(no_of_pins > 0) {
uint32 io_info[PWM_CHANNEL_NUM_MAX][3]; // pin information
uint32 pwm_duty_init[PWM_CHANNEL_NUM_MAX]; // pwm duty
for(uint8 i = 0; i < no_of_pins; i++) {
uint32_t io_info[PWM_CHANNEL_NUM_MAX][3]; // pin information
uint32_t pwm_duty_init[PWM_CHANNEL_NUM_MAX]; // pwm duty
for(uint8_t i = 0; i < no_of_pins; i++) {
io_info[i][0] = EspDigitalPins[pins[i]].mux;
io_info[i][1] = EspDigitalPins[pins[i]].gpioFunc;
io_info[i][2] = EspDigitalPins[pins[i]].id;
Expand All @@ -58,9 +59,9 @@ HardwarePWM::~HardwarePWM()
* Description: This function is used to get channel number for given pin
* Parameters: pin - Esp8266 pin number
*/
uint8 HardwarePWM::getChannel(uint8 pin)
uint8_t HardwarePWM::getChannel(uint8_t pin)
{
for(uint8 i = 0; i < channel_count; i++) {
for(uint8_t i = 0; i < channel_count; i++) {
if(channels[i] == pin) {
//debugf("getChannel %d is %d", pin, i);
return i;
Expand All @@ -74,7 +75,7 @@ uint8 HardwarePWM::getChannel(uint8 pin)
* Description: This function is used to get the duty cycle number for a given channel
* Parameters: chan -Esp8266 channel number
*/
uint32 HardwarePWM::getDutyChan(uint8 chan)
uint32_t HardwarePWM::getDutyChan(uint8_t chan)
{
if(chan == PWM_BAD_CHANNEL) {
return 0;
Expand All @@ -90,7 +91,7 @@ uint32 HardwarePWM::getDutyChan(uint8 chan)
* duty - duty cycle value
* update - update PWM output
*/
bool HardwarePWM::setDutyChan(uint8 chan, uint32 duty, bool update)
bool HardwarePWM::setDutyChan(uint8_t chan, uint32_t duty, bool update)
{
if(chan == PWM_BAD_CHANNEL) {
return false;
Expand All @@ -111,7 +112,7 @@ bool HardwarePWM::setDutyChan(uint8 chan, uint32 duty, bool update)
* Period / frequency will remain same for all pins.
*
*/
uint32 HardwarePWM::getPeriod()
uint32_t HardwarePWM::getPeriod()
{
return pwm_get_period();
}
Expand All @@ -120,7 +121,7 @@ uint32 HardwarePWM::getPeriod()
* Description: This function is used to set Period of PWM.
* Period / frequency will remain same for all pins.
*/
void HardwarePWM::setPeriod(uint32 period)
void HardwarePWM::setPeriod(uint32_t period)
{
maxduty = PERIOD_TO_MAX_DUTY(period);
pwm_set_period(period);
Expand Down
1 change: 1 addition & 0 deletions Sming/Arch/Rp2040/Components/rp2040/src/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <hardware/pll.h>
#include <esp_attr.h>
#include <hardware/exception.h>
#include <hardware/structs/systick.h>

#define DEFAULT_CPU_FREQ (125 * MHZ)

Expand Down
2 changes: 0 additions & 2 deletions Sming/Arch/Rp2040/Components/rp2040/src/include/esp_clk.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#pragma once

#include <c_types.h>
#include <sming_attr.h>
#include <hardware/structs/systick.h>

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 1 addition & 2 deletions Sming/Arch/Rp2040/Components/rp2040/src/include/esp_sleep.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include <stdint.h>
#include <stdbool.h>
#include <c_types.h>

#ifdef __cplusplus
extern "C" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <stdint.h>
#include <c_types.h>

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 1 addition & 2 deletions Sming/Arch/Rp2040/Components/rp2040/src/include/esp_tasks.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include <stdint.h>
#include <stdbool.h>
#include <c_types.h>

#ifdef __cplusplus
extern "C" {
Expand Down
1 change: 0 additions & 1 deletion Sming/Arch/Rp2040/Components/rp2040/src/startup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*
*/

#include <user_config.h>
#include "Platform/System.h"
#include <driver/uart.h>
#include <driver/hw_timer.h>
Expand Down
1 change: 1 addition & 0 deletions Sming/Arch/Rp2040/Components/spi_flash/flashmem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <hardware/structs/xip_ctrl.h>
#include <hardware/structs/ssi.h>
#include <hardware/regs/ssi.h>
#include <debug_progmem.h>

#define FLASHCMD_READ_SFDP 0x5a
#define FLASHCMD_READ_JEDEC_ID 0x9f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
extern "C" {
#endif

#include <user_config.h>
#include <esp_system.h>
#include <sys/pgmspace.h>

#define SPI_FLASH_SEC_SIZE 4096

Expand Down
43 changes: 21 additions & 22 deletions Sming/Components/.patches/http-parser.patch
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ index df88252..5935bcf 100644
/** PRIVATE **/
unsigned int type : 2; /* enum http_parser_type */
diff --git a/http_parser.c b/http_parser.c
index 95ff42f..2c7510b 100644
index 95ff42f..beaf1f7 100644
--- a/http_parser.c
+++ b/http_parser.c
@@ -19,12 +19,19 @@
* IN THE SOFTWARE.
@@ -20,11 +20,19 @@
*/
#include "http_parser.h"
-#include <assert.h>
#include <assert.h>
-#include <stddef.h>
+#include <user_config.h>
#include <ctype.h>
-#include <ctype.h>
+#include <stringutil.h>
+#include <sys/pgmspace.h>
#include <string.h>
#include <limits.h>

Expand All @@ -65,7 +65,7 @@ index 95ff42f..2c7510b 100644
static uint32_t max_header_size = HTTP_MAX_HEADER_SIZE;

#ifndef ULLONG_MAX
@@ -186,7 +193,7 @@ static const char *method_strings[] =
@@ -186,7 +194,7 @@ static const char *method_strings[] =
* | "/" | "[" | "]" | "?" | "="
* | "{" | "}" | SP | HT
*/
Expand All @@ -74,7 +74,7 @@ index 95ff42f..2c7510b 100644
/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
0, 0, 0, 0, 0, 0, 0, 0,
/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */
@@ -220,19 +227,10 @@ static const char tokens[256] = {
@@ -220,19 +228,10 @@ static const char tokens[256] = {
/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */
'x', 'y', 'z', 0, '|', 0, '~', 0 };

Expand All @@ -98,7 +98,7 @@ index 95ff42f..2c7510b 100644
#if HTTP_PARSER_STRICT
# define T(v) 0
#else
@@ -428,14 +426,14 @@ enum http_host_state
@@ -428,14 +427,14 @@ enum http_host_state
(c) == ';' || (c) == ':' || (c) == '&' || (c) == '=' || (c) == '+' || \
(c) == '$' || (c) == ',')

Expand All @@ -115,7 +115,7 @@ index 95ff42f..2c7510b 100644
#define IS_URL_CHAR(c) \
(BIT_AT(normal_url_char, (unsigned char)c) || ((c) & 0x80))
#define IS_HOST_CHAR(c) \
@@ -467,16 +465,6 @@ do { \
@@ -467,16 +466,6 @@ do { \
#endif


Expand All @@ -132,7 +132,7 @@ index 95ff42f..2c7510b 100644
int http_message_needs_eof(const http_parser *parser);

/* Our URL parser.
@@ -758,7 +746,7 @@ reexecute:
@@ -758,7 +747,7 @@ reexecute:
}

parser->type = HTTP_REQUEST;
Expand All @@ -141,7 +141,7 @@ index 95ff42f..2c7510b 100644
parser->index = 2;
UPDATE_STATE(s_req_method);
}
@@ -938,23 +926,23 @@ reexecute:
@@ -938,23 +927,23 @@ reexecute:
parser->method = (enum http_method) 0;
parser->index = 1;
switch (ch) {
Expand Down Expand Up @@ -180,7 +180,7 @@ index 95ff42f..2c7510b 100644
default:
SET_ERRNO(HPE_INVALID_METHOD);
goto error;
@@ -983,8 +971,8 @@ reexecute:
@@ -983,8 +972,8 @@ reexecute:

switch (parser->method << 16 | parser->index << 8 | ch) {
#define XX(meth, pos, ch, new_meth) \
Expand All @@ -191,7 +191,7 @@ index 95ff42f..2c7510b 100644

XX(POST, 1, 'U', PUT)
XX(POST, 1, 'A', PATCH)
@@ -1024,7 +1012,7 @@ reexecute:
@@ -1024,7 +1013,7 @@ reexecute:
if (ch == ' ') break;

MARK(url);
Expand All @@ -200,7 +200,7 @@ index 95ff42f..2c7510b 100644
UPDATE_STATE(s_req_server_start);
}

@@ -1100,7 +1088,7 @@ reexecute:
@@ -1100,7 +1089,7 @@ reexecute:
UPDATE_STATE(s_req_http_H);
break;
case 'I':
Expand All @@ -209,7 +209,7 @@ index 95ff42f..2c7510b 100644
UPDATE_STATE(s_req_http_I);
break;
}
@@ -1826,7 +1814,7 @@ reexecute:
@@ -1826,7 +1815,7 @@ reexecute:
parser->upgrade =
(parser->type == HTTP_REQUEST || parser->status_code == 101);
} else {
Expand All @@ -218,7 +218,7 @@ index 95ff42f..2c7510b 100644
}

/* Here we call the headers_complete callback. This is somewhat
@@ -1874,7 +1862,7 @@ reexecute:
@@ -1874,7 +1863,7 @@ reexecute:

hasBody = parser->flags & F_CHUNKED ||
(parser->content_length > 0 && parser->content_length != ULLONG_MAX);
Expand All @@ -227,7 +227,7 @@ index 95ff42f..2c7510b 100644
(parser->flags & F_SKIPBODY) || !hasBody)) {
/* Exit, the rest of the message is in a different protocol. */
UPDATE_STATE(NEW_MESSAGE());
@@ -1991,7 +1979,7 @@ reexecute:
@@ -1991,7 +1980,7 @@ reexecute:
assert(nread == 1);
assert(parser->flags & F_CHUNKED);

Expand All @@ -236,7 +236,7 @@ index 95ff42f..2c7510b 100644
if (UNLIKELY(unhex_val == -1)) {
SET_ERRNO(HPE_INVALID_CHUNK_SIZE);
goto error;
@@ -2013,7 +2001,7 @@ reexecute:
@@ -2013,7 +2002,7 @@ reexecute:
break;
}

Expand All @@ -245,7 +245,7 @@ index 95ff42f..2c7510b 100644

if (unhex_val == -1) {
if (ch == ';' || ch == ' ') {
@@ -2207,7 +2195,7 @@ const char *
@@ -2207,7 +2196,7 @@ const char *
http_status_str (enum http_status s)
{
switch (s) {
Expand All @@ -254,7 +254,7 @@ index 95ff42f..2c7510b 100644
HTTP_STATUS_MAP(XX)
#undef XX
default: return "<unknown>";
@@ -2231,18 +2219,6 @@ http_parser_settings_init(http_parser_settings *settings)
@@ -2231,18 +2220,6 @@ http_parser_settings_init(http_parser_settings *settings)
memset(settings, 0, sizeof(*settings));
}

Expand All @@ -273,4 +273,3 @@ index 95ff42f..2c7510b 100644
static enum http_host_state
http_parse_host_char(enum http_host_state s, const char ch) {
switch(s) {

3 changes: 2 additions & 1 deletion Sming/Components/Network/src/IpAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

#pragma once

#include <user_config.h>
#include <lwip/init.h>
#include <lwip/ip_addr.h>
#include "Printable.h"
#include "WString.h"

Expand Down
2 changes: 1 addition & 1 deletion Sming/Components/Network/src/Network/NetUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
*
****/

#include <user_config.h>
#include "NetUtils.h"
#include <Data/CStringArray.h>
#include <WString.h>
#include <debug_progmem.h>

namespace
{
Expand Down
1 change: 0 additions & 1 deletion Sming/Components/Network/src/Network/TelnetServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#pragma once

#include <user_config.h>
#include "TcpClient.h"
#include "TcpServer.h"
#include "SystemClock.h"
Expand Down
1 change: 1 addition & 0 deletions Sming/Components/Storage/src/SpiFlash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "include/Storage/SpiFlash.h"
#include "include/Storage/partition_info.h"
#include <esp_spi_flash.h>
#include <debug_progmem.h>

namespace Storage
{
Expand Down
4 changes: 3 additions & 1 deletion Sming/Components/ssl/include/Network/Ssl/InputBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

#pragma once

#include <user_config.h>
#include <cstdlib>
#include <cstdint>
#include <lwip/pbuf.h>

namespace Ssl
{
Expand Down
3 changes: 2 additions & 1 deletion Sming/Core/Data/Buffer/LineBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

#pragma once

#include <user_config.h>
#include <cstdint>
#include <cstring>

/**
* @brief Class to enable buffering of a single line of text, with simple editing
Expand Down
Loading

0 comments on commit 976eb26

Please sign in to comment.