ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
Macros | Functions | Variables
user_main.c File Reference

Main user and initialization code This initialize the platform and runs the main user task. All display updates and task are called from here. More...

#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include "user_config.h"
#include "time.h"
#include "timer.h"
#include "matrix.h"
#include "esp8266/system.h"
#include "lib/stringsup.h"

Go to the source code of this file.

Macros

#define R1   330000.0
 
#define R2   100000.0
 
#define VERROR   0.95
 
#define VSCALE   (VERROR*((R1+R2)/R2)/1024.0)
 

Functions

void ets_timer_disarm (ETSTimer *ptimer)
 
void ets_timer_setfn (ETSTimer *ptimer, ETSTimerFunc *pfunction, void *parg)
 
MEMSPACE void ms_clear ()
 Clear 1000HZ timer We loop in case the update of ms_time is not "atomic" - done in a single instruction. More...
 
MEMSPACE unsigned long ms_read ()
 Read 1000HZ timer We loop in case the update of ms_time is not "atomic" - done in a single instruction. More...
 
void ms_task (void)
 1000HZ timer task More...
 
MEMSPACE void ms_init ()
 Initialize 1000HZ timer task. More...
 
void ntp_setup (void)
 
 user_tasks ()
 
float adc_read ()
 return system_adc_read scaled to a float T_OUT pin is connected to the junction of a voltage divider R1 and R2 R1 is connected to VCC R2 is connected to ground T_OUT is connected to the junction of R1 and R2 FIXME T_OUT has a loading value More...
 
void user_loop (void)
 
void loop ()
 
void user_help ()
 
MEMSPACE int user_tests (int argc, char *argv[])
 help functions test parser More...
 
 test_types ()
 
MEMSPACE void setup (void)
 main() Initialize user task More...
 

Variables

unsigned long ms_time = 0
 
int ntp_init = 0
 
int signal_loop = 0
 
time_t seconds = 0
 
uint8_t ip_msg []
 test task Runs corrected cube demo from Sem Optionally wireframe Earth viewer More...
 
int skip = 0
 
long last_time10 = 0
 
long last_time50 = 0
 
time_t sec = 0
 
int loop_cnt = 0
 
int inloop = 0
 

Detailed Description

Main user and initialization code This initialize the platform and runs the main user task. All display updates and task are called from here.

Copyright © 2015 Mike Gore, GPL License
You are free to use this code under the terms of GPL
please retain a copy of this notice in any code you use it in.

This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file user_main.c.

Macro Definition Documentation

#define R1   330000.0

Definition at line 313 of file user_main.c.

#define R2   100000.0

Definition at line 315 of file user_main.c.

#define VERROR   0.95

Definition at line 319 of file user_main.c.

#define VSCALE   (VERROR*((R1+R2)/R2)/1024.0)

Definition at line 321 of file user_main.c.

Referenced by adc_read().

Function Documentation

float adc_read ( )

return system_adc_read scaled to a float T_OUT pin is connected to the junction of a voltage divider R1 and R2 R1 is connected to VCC R2 is connected to ground T_OUT is connected to the junction of R1 and R2 FIXME T_OUT has a loading value

Returns
float

Definition at line 332 of file user_main.c.

Referenced by user_loop().

void ets_timer_disarm ( ETSTimer ptimer)
void ets_timer_setfn ( ETSTimer ptimer,
ETSTimerFunc pfunction,
void *  parg 
)
void loop ( )

Definition at line 533 of file user_main.c.

Referenced by atexit(), and loop_wrapper().

MEMSPACE void ms_clear ( )

Clear 1000HZ timer We loop in case the update of ms_time is not "atomic" - done in a single instruction.

Returns
void.

Definition at line 136 of file user_main.c.

MEMSPACE void ms_init ( )

Initialize 1000HZ timer task.

Returns
void.

Definition at line 166 of file user_main.c.

Referenced by setup().

MEMSPACE unsigned long ms_read ( )

Read 1000HZ timer We loop in case the update of ms_time is not "atomic" - done in a single instruction.

Returns
time in milliseconds

Definition at line 146 of file user_main.c.

Referenced by user_loop().

void ms_task ( void  )

1000HZ timer task

Returns
void

Definition at line 158 of file user_main.c.

Referenced by ms_init().

void ntp_setup ( void  )

Definition at line 176 of file user_main.c.

Referenced by user_loop().

MEMSPACE void setup ( void  )

main() Initialize user task

Returns
void

Definition at line 971 of file user_main.c.

Referenced by atexit(), loop_wrapper(), and user_init().

test_types ( )

test byte order and basic type sizes

Definition at line 783 of file user_main.c.

Referenced by setup().

void user_help ( )

Definition at line 592 of file user_main.c.

Referenced by user_tests().

void user_loop ( void  )

Definition at line 348 of file user_main.c.

Referenced by loop().

user_tasks ( )

second argument 1 = only report when an EOL is detectedEOL

Definition at line 274 of file user_main.c.

Referenced by user_loop().

MEMSPACE int user_tests ( int  argc,
char *  argv[] 
)

help functions test parser

  • Keywords and arguments are matched against test functions If there are matched the function along with its arguments are called.
    Parameters
    [in]strUser supplied command line
    Returns
    1 The return code indicates a command matched.
    0 if no rules matched

Definition at line 631 of file user_main.c.

Referenced by user_tasks().

Variable Documentation

int inloop = 0

Definition at line 532 of file user_main.c.

Referenced by loop().

uint8_t ip_msg[]

test task Runs corrected cube demo from Sem Optionally wireframe Earth viewer

Returns
void

Definition at line 51 of file network.c.

Referenced by setup(), setup_networking(), and wifi_event_cb().

long last_time10 = 0

Definition at line 306 of file user_main.c.

Referenced by user_loop().

long last_time50 = 0

Definition at line 307 of file user_main.c.

Referenced by user_loop().

int loop_cnt = 0

Definition at line 310 of file user_main.c.

unsigned long ms_time = 0

Definition at line 127 of file user_main.c.

Referenced by ms_clear(), ms_init(), ms_read(), and ms_task().

int ntp_init = 0

Definition at line 175 of file user_main.c.

Referenced by ntp_setup().

time_t sec = 0

Definition at line 308 of file user_main.c.

Referenced by ntp_setup(), tm2epoch(), and user_loop().

time_t seconds = 0
int signal_loop = 0

Definition at line 291 of file user_main.c.

int skip = 0

Definition at line 304 of file user_main.c.

Referenced by FontAdjustFull(), and FontAdjustSmall().