Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed some unnecessary task scheduling stuff #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 10 additions & 24 deletions blinky/user/user_main.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "user_config.h"

#define user_procTaskPrio 0
#define user_procTaskQueueLen 1
os_event_t user_procTaskQueue[user_procTaskQueueLen];
static void user_procTask(os_event_t *events);
#include "ets_sys.h" // Event signals and task priorities
#include "osapi.h" // General ESP functions (timers, strings, memory)
#include "gpio.h" // Interacting and configuring pins
#include "os_type.h" // Mapping to ETS structures
#include "user_config.h" // Any user-defined functions. Alway required.

// create os_timer that's not optimized by the compiler and is file-wide in scope
static volatile os_timer_t some_timer;


// Function to drive GPIO pin high or low
void some_timerfunc(void *arg)
{
//Do blinky stuff
// If GPIO_2 is set HIGH, set it LOW
if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & BIT2)
{
//Set GPIO2 to LOW
Expand All @@ -27,15 +23,8 @@ void some_timerfunc(void *arg)
}
}

//Do nothing function
static void ICACHE_FLASH_ATTR
user_procTask(os_event_t *events)
{
os_delay_us(10);
}

//Init function
void ICACHE_FLASH_ATTR
// Init function
void ICACHE_FLASH_ATTR // Store function in flash memory instead of RAM
user_init()
{
// Initialize the GPIO subsystem.
Expand All @@ -58,7 +47,4 @@ user_init()
//1000 is the fire time in ms
//0 for once and 1 for repeating
os_timer_arm(&some_timer, 1000, 1);

//Start os task
system_os_task(user_procTask, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);
}