strncpy is not safe + memory optimization

This commit is contained in:
Philippe G
2021-11-03 22:00:07 -07:00
parent 2146014f04
commit 974ff5fa68
6 changed files with 12 additions and 8 deletions

View File

@@ -47,14 +47,14 @@ static EXT_RAM_ATTR struct button_s {
TimerHandle_t timer;
} buttons[MAX_BUTTONS];
static struct {
static EXT_RAM_ATTR struct {
int gpio, level;
struct button_s *button;
} polled_gpio[] = { {36, -1, NULL}, {39, -1, NULL}, {-1, -1, NULL} };
static TimerHandle_t polled_timer;
static struct {
static EXT_RAM_ATTR struct {
QueueHandle_t queue;
void *client;
rotary_encoder_info_t info;
@@ -62,7 +62,7 @@ static struct {
rotary_handler handler;
} rotary;
static struct {
static EXT_RAM_ATTR struct {
RingbufHandle_t rb;
infrared_handler handler;
} infrared;

View File

@@ -28,7 +28,7 @@
static const char *TAG = "led";
static struct led_s {
static EXT_RAM_ATTR struct led_s {
gpio_num_t gpio;
bool on;
int onstate;
@@ -40,7 +40,7 @@ static struct led_s {
TimerHandle_t timer;
} leds[MAX_LED];
static struct {
static EXT_RAM_ATTR struct {
int gpio;
int active;
int pwm;