STIMA  3
Functions
stima.ino File Reference
#include <debug_config.h>
#include "stima.h"
Include dependency graph for stima.ino:

Functions

void setup ()
 Arduino setup function. Init watchdog, hardware, debug, buffer and load configuration stored in EEPROM. More...
 
void loop ()
 Arduino loop function. First, initialize tasks and sensors, then execute the tasks and activates the power down if no task is running. More...
 
void logPrefix (Print *_logOutput)
 
void logSuffix (Print *_logOutput)
 
void init_logging ()
 Init logging system. More...
 
void init_power_down (uint32_t *time_ms, uint32_t debouncing_ms)
 Enter power down mode. More...
 
void init_buffers ()
 Init buffers. More...
 
void init_tasks ()
 Init tasks variable and state. More...
 
void init_pins ()
 Init hardware pins. More...
 
void i2c_receive_interrupt_handler (int rx_data_length)
 I2C receive interrupt handler. More...
 
void init_wire ()
 Init wire (i2c) library and performs checks on the bus. More...
 
void reset_wire ()
 
void init_spi ()
 Init SPI library. More...
 
void init_system ()
 Init system. More...
 
void init_rpc ()
 Register RPC. More...
 
void init_wdt (uint8_t wdt_timer)
 Init watchdog. More...
 
void init_timer1 ()
 Init Timer1 module. More...
 
void start_timer ()
 Start Timer1 module. More...
 
void stop_timer ()
 Stop Timer1 module. More...
 
 ISR (TIMER1_OVF_vect)
 
void init_sensors ()
 Create and setup sensors. More...
 
void setNextTimeForSensorReading (time_t *next_time, uint16_t time_s)
 
void print_configuration ()
 Print current configuration. More...
 
void set_default_configuration ()
 Set default configuration to global configuration variable. More...
 
void save_configuration (bool is_default)
 Save configuration to EEPROM. More...
 
void load_configuration ()
 Load configuration from EEPROM. More...
 
time_t getSystemTime ()
 
void realreboot ()
 
void interrupt_task_1s ()
 1 seconds task. More...
 
void supervisor_task ()
 Supervisor task. Manage RTC and NTP sync and open/close gsm and ethernet connection. More...
 
void rtc_task ()
 Real Time Clock task. Read RTC time and sync system time with it. More...
 
void time_task ()
 Time task. Get time from NTP and sync RTC with it. More...
 
void ethernet_task ()
 Ethernet task. Manage Ethernet operation. More...
 
void sensors_reading_task (bool do_prepare, bool do_get, char *driver, char *type, uint8_t address, uint8_t node, uint8_t *sensor_index, uint32_t *wait_time)
 Sensors reading Task. Read data from sensors. More...
 

Function Documentation

◆ ethernet_task()

void ethernet_task ( void  )

Ethernet task. Manage Ethernet operation.

Returns
void.

◆ i2c_receive_interrupt_handler()

void i2c_receive_interrupt_handler ( int  rx_data_length)

I2C receive interrupt handler.

Parameters
[in]rx_data_lengthreceived data length in bytes.
Returns
void.

check crc: ok

◆ init_buffers()

void init_buffers ( void  )

Init buffers.

Returns
void.

copy readable_data_2 in readable_data_1

copy readable_data_2 in readable_data_1

copy readable_data_write in readable_data_read

copy readable_data_write in readable_data_read

copy readable_data_write in readable_data_read

copy readable_data_2 in readable_data_1

copy readable_data_write in readable_data_read

◆ init_logging()

void init_logging ( void  )

Init logging system.

Returns
void.

◆ init_pins()

void init_pins ( void  )

Init hardware pins.

Returns
void.

◆ init_power_down()

void init_power_down ( uint32_t *  time_ms,
uint32_t  debouncing_ms 
)

Enter power down mode.

Parameters
time_mspointer to a variable to save the last instant you entered power down.
debouncing_msdelay to power down.
Returns
void.

◆ init_rpc()

void init_rpc ( void  )

Register RPC.

Returns
void.

◆ init_sensors()

void init_sensors ( void  )

Create and setup sensors.

Returns
void.

◆ init_spi()

void init_spi ( void  )

Init SPI library.

Returns
void.

◆ init_system()

void init_system ( void  )

Init system.

Returns
void.

main loop state

main loop state

main loop state

main loop state

main loop state

◆ init_tasks()

void init_tasks ( void  )

Init tasks variable and state.

Returns
void.

no tasks ready

no tasks ready

reset samples_count value

no tasks ready

no tasks ready

no tasks ready

◆ init_timer1()

void init_timer1 ( void  )

Init Timer1 module.

Returns
void.

◆ init_wdt()

void init_wdt ( uint8_t  wdt_timer)

Init watchdog.

Parameters
wdt_timera time value for init watchdog (WDTO_xxxx).
Returns
void.

◆ init_wire()

void init_wire ( void  )

Init wire (i2c) library and performs checks on the bus.

Returns
void.

◆ interrupt_task_1s()

void interrupt_task_1s ( void  )

1 seconds task.

Returns
void.

◆ ISR()

ISR ( TIMER1_OVF_vect  )

Pre-load timer counter register

◆ load_configuration()

void load_configuration ( void  )

Load configuration from EEPROM.

Returns
void.

read configuration from eeprom

read configuration from eeprom

read configuration from eeprom

read configuration from eeprom

read configuration from eeprom

◆ loop()

void loop ( void  )

Arduino loop function. First, initialize tasks and sensors, then execute the tasks and activates the power down if no task is running.

Returns
void.

◆ print_configuration()

void print_configuration ( void  )

Print current configuration.

Returns
void.

◆ rtc_task()

void rtc_task ( void  )

Real Time Clock task. Read RTC time and sync system time with it.

Returns
void.

◆ save_configuration()

void save_configuration ( bool  is_default)

Save configuration to EEPROM.

Parameters
is_defaultif true save default configuration; if false save current configuration.
Returns
void.

write configuration to eeprom

write configuration to eeprom

write configuration to eeprom

write configuration to eeprom

write configuration to eeprom

◆ sensors_reading_task()

void sensors_reading_task ( bool  do_prepare,
bool  do_get,
char *  driver,
char *  type,
uint8_t  address,
uint8_t  node,
uint8_t *  sensor_index,
uint32_t *  wait_time 
)

Sensors reading Task. Read data from sensors.

Parameters
do_prepareif true, execute the prepare sensor's procedure
do_getif true, execute the get sensor's procedure
*driversensor's driver
*typesensor's type
*addresssensor's address
*nodesensor's node
*sensor_indexsensor's index
*wait_timesensor's wait time
Returns
void.

◆ set_default_configuration()

void set_default_configuration ( void  )

Set default configuration to global configuration variable.

Returns
void.

◆ setup()

void setup ( )

Arduino setup function. Init watchdog, hardware, debug, buffer and load configuration stored in EEPROM.

Arduino setup function. Init watchdog, hardware, debug and load configuration stored in EEPROM.

Returns
void.

◆ start_timer()

void start_timer ( void  )

Start Timer1 module.

Returns
void.

< Normal timer operation

< 1:1024 prescaler

< Pre-load timer counter register

< Clear interrupt overflow flag register

< Enable overflow interrupt

◆ stop_timer()

void stop_timer ( void  )

Stop Timer1 module.

Returns
void.

< Stop

< Disable overflow interrupt

< Clear interrupt overflow flag register

< Pre-load timer counter register

◆ supervisor_task()

void supervisor_task ( void  )

Supervisor task. Manage RTC and NTP sync and open/close gsm and ethernet connection.

Returns
void.

◆ time_task()

void time_task ( void  )

Time task. Get time from NTP and sync RTC with it.

Returns
void.