From a4a214e8310574b939f66cf369e09a0638bcccb9 Mon Sep 17 00:00:00 2001 From: Martin Thierer Date: Tue, 28 Feb 2017 16:18:15 +0100 Subject: [PATCH 1/3] Include "user_config.h" at the top of pwm.c This makes it possible to customize configuration values (for example PWM_MAX_CHANNELS) without modifying pwm.c or including pwm.c from another .c file. --- pwm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pwm.c b/pwm.c index 6df21ac..d5e7132 100644 --- a/pwm.c +++ b/pwm.c @@ -18,6 +18,8 @@ /* Set the following three defines to your needs */ +#include "user_config.h" + #ifndef SDK_PWM_PERIOD_COMPAT_MODE #define SDK_PWM_PERIOD_COMPAT_MODE 0 #endif From 7218aea1ab21f39bf4645ce2029cccc8b1adf428 Mon Sep 17 00:00:00 2001 From: Martin Thierer Date: Tue, 28 Feb 2017 16:22:53 +0100 Subject: [PATCH 2/3] Wrap PWM_DEBUG and PWM_USE_NMI in #ifndef Makes it easier to customize them. --- pwm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pwm.c b/pwm.c index d5e7132..1630718 100644 --- a/pwm.c +++ b/pwm.c @@ -26,8 +26,12 @@ #ifndef PWM_MAX_CHANNELS #define PWM_MAX_CHANNELS 8 #endif -#define PWM_DEBUG 0 -#define PWM_USE_NMI 0 +#ifndef PWM_DEBUG + #define PWM_DEBUG 0 +#endif +#ifndef PWM_USE_NMI + #define PWM_USE_NMI 0 +#endif /* no user servicable parts beyond this point */ From 99b8aec136941ff9a02bdd4b6ed150e0624bd26f Mon Sep 17 00:00:00 2001 From: Martin Thierer Date: Tue, 28 Feb 2017 18:22:13 +0100 Subject: [PATCH 3/3] Add empty define for ICACHE_RAM_ATTR if not defined by platform The "Non-OS" SDK only defines ICACHE_FLASH_ATTR and locates functions without specific annotations in RAM by default. --- pwm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pwm.c b/pwm.c index 1630718..87180b9 100644 --- a/pwm.c +++ b/pwm.c @@ -53,6 +53,11 @@ #include #include +// ICACHE_RAM_ATTR is neither used nor defined in Non-OS SDK +#ifndef ICACHE_RAM_ATTR + #define ICACHE_RAM_ATTR +#endif + // from SDK hw_timer.c #define TIMER1_DIVIDE_BY_16 0x0004 #define TIMER1_ENABLE_TIMER 0x0080