Documentazione del codice

The C++ API documentation is also available as doxgen documentation.

union addr16_t

Public Members

uint8_t *bptr
uint16_t *wptr
uint16_t word
uint8_t bytes[2]
struct bin_value_t

Public Members

uint16_t sample

last sample

uint16_t med

average values of observations

uint16_t sigma

standard deviation of observations

class BitBangedSPI

Public Functions

inline void begin()
inline void beginTransaction(SPISettings settings)
inline void end()
inline uint8_t transfer(uint8_t b)

Private Members

unsigned long pulseWidth
struct configuration_t
#include <i2c-leaf.h>

EEPROM saved configuration.

Public Members

uint8_t module_version

module version

uint8_t module_type

module type

uint8_t i2c_address

i2c address

bool is_oneshot

enable or disable oneshot mode

bool is_continuous

enable or disable continuous mode

uint16_t leaf_calibration_min
uint16_t leaf_calibration_max
float adc_voltage_offset_1
float adc_voltage_offset_2
float adc_voltage_min
float adc_voltage_max
uint8_t module_main_version

module main version

uint8_t module_configuration_version

module configuration version

uint16_t tipping_bucket_time_ms

Tipping bucket time in milliseconds.

uint8_t rain_for_tip

How much mm of rain for one tip of tipping bucket rain gauge.

sensor_conf_t sensors[2]

sensors configurations

sensor_t sensors[SENSORS_MAX]

SensorDriver buffer for storing sensors parameter.

uint8_t sensors_count

configured sensors number

uint16_t report_seconds

seconds for report values

constantdata_t constantdata[USE_CONSTANTDATA_COUNT]

Constantdata buffer for storing constant station data parameter.

uint8_t constantdata_count

configured constantdata number

bool is_dhcp_enable

dhcp status

uint8_t ethernet_mac[ETHERNET_MAC_LENGTH]

ethernet mac

uint8_t ip[ETHERNET_IP_LENGTH]

ip address

uint8_t netmask[ETHERNET_IP_LENGTH]

netmask

uint8_t gateway[ETHERNET_IP_LENGTH]

gateway

uint8_t primary_dns[ETHERNET_IP_LENGTH]

primary dns

struct constantdata_t

Public Members

char btable[CONSTANTDATA_BTABLE_LENGTH]

table B code for constant station data

char value[CONSTANTDATA_VALUE_LENGTH]

value of constant station data

struct DIR

Public Members

WORD index
BYTE *fn
CLUST sclust
CLUST clust
DWORD sect
struct FatFileDesc

Public Members

uint32_t firstFatBlock
uint32_t dataBlock
uint8_t blocksPerCluster
struct FATFS

Public Members

BYTE fs_type
BYTE flag
BYTE csize
BYTE pad1
WORD n_rootdir
CLUST n_fatent
DWORD fatbase
DWORD dirbase
DWORD database
DWORD fptr
DWORD fsize
CLUST org_clust
CLUST curr_clust
DWORD dsect
struct FILINFO

Public Members

DWORD fsize
WORD fdate
WORD ftime
BYTE fattrib
char fname[13]
struct float_observation_t

Public Members

float med[OBSERVATION_COUNT]

buffer containing the mean values calculated on a one sample buffer respectively

uint16_t count

number of observations

float *read_ptr

reader pointer to buffer (read observations for calculate report value)

float *write_ptr

writer pointer to buffer (add new observation)

struct ihex_state

Public Members

ihex_address_t address
ihex_segment_t segment
ihex_flags_t flags
uint8_t line_length
uint8_t length
uint8_t data[IHEX_LINE_MAX_LENGTH + 1]
struct leaf_wetness_t
#include <i2c-leaf.h>

Leaf wetness data.

Public Members

float timer

timer in seconds that indicates wet leaf

struct observation_t
#include <i2c-opc.h>

Observations values for opc.

Observations values for temperature and humidity NOT USED / typedef struct { int32_t values[OBSERVATION_COUNT]; //!< buffer containing the mean values calculated on a one sample buffer respectively uint16_t count; //!< number of observations uint32_t *read_ptr; //!< reader pointer to buffer (read observations for calculate report value) uint32_t *write_ptr; //!< writer pointer to buffer (add new observation) } observation_t;.

/********************************************************************* TYPEDEF for Finite State Machine

struct param

Public Members

uint8_t devicecode
uint8_t revision
uint8_t progtype
uint8_t parmode
uint8_t polling
uint8_t selftimed
uint8_t lockbytes
uint8_t fusebytes
uint8_t flashpoll
uint16_t eeprompoll
uint16_t pagesize
uint16_t eepromsize
uint32_t flashsize
struct pm_value_t

Public Members

float sample

last sample

float med

average values of observations

float sigma

standard deviation of observations

struct readable_data_t
#include <i2c-leaf.h>

Readable data through i2c bus.

Public Members

uint8_t module_type

module version

module type

uint8_t module_version

module type

leaf_wetness_t leaf_wetness

leaf wetness data for report

float pm_sample[OPCXX_PM_LENGTH]
float pm_med[OPCXX_PM_LENGTH]
float pm_sigma[OPCXX_PM_LENGTH]
uint16_t bins_med[OPCN3_BINS_LENGTH]
uint16_t bins_sigma[OPCN3_BINS_LENGTH]
pm_value_t pm1

pm1 data for report

pm_value_t pm25

pm25 data for report

pm_value_t pm10

pm10 data for report

bin_value_t bins[OPC_BINS_LENGTH]

bins array data for report

report_t solar_radiation
uint8_t module_main_version

module main version

uint8_t module_minor_version

module minor version

rain_t rain

rain data

value_t temperature

temperature data for report

value_t humidity

humidity data for report

report_t thr
report_t wind
struct report_t
#include <i2c-radiation.h>

report data.

Public Members

float avg
float rain_tips
float rain
float sample_temperature
float sample_humidity
float ist_temperature
float ist_humidity
float min_temperature
float min_humidity
float avg_temperature
float avg_humidity
float max_temperature
float max_humidity
float sigma_temperature
float sigma_humidity
float vavg10_speed
float vavg10_direction
float vavg_speed
float vavg_direction
float peak_gust_speed
float long_gust_speed
float avg_speed
float class_1
float class_2
float class_3
float class_4
float class_5
float class_6
float peak_gust_direction
float long_gust_direction
struct sample_t
#include <i2c-opc.h>

Samples values for measured opc data.

samples data

Public Members

float values

buffer containing the measured samples

uint8_t count

number of good samples

samples counter

uint8_t error_count

number of bad samples

float value[SAMPLES_COUNT]

samples buffer

uint16_t count

samples counter

float *read_ptr

reader pointer

float *write_ptr

writer pointer

int32_t values[SAMPLES_COUNT_MAX]

samples buffer

int32_t *read_ptr

reader pointer

int32_t *write_ptr

writer pointer

struct sensor_conf_t

Public Members

char type[4]

sensor type

uint8_t i2c_address

i2c address of sensor

struct sensor_t
#include <i2c-th.h>

sensors configuration.

struct sensordata_t
#include <stima.h>

constant station data (station name, station height ...) parameters.

class SPISettings

Public Functions

inline SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode)

Private Members

uint32_t clock

Friends

friend class BitBangedSPI
struct uint16_observation_t

Public Members

uint16_t med[OBSERVATION_COUNT]

buffer containing the mean values calculated on a one sample buffer respectively

uint16_t count

number of observations

uint16_t *read_ptr

reader pointer to buffer (read observations for calculate report value)

uint16_t *write_ptr

writer pointer to buffer (add new observation)

struct writable_data_t
#include <i2c-leaf.h>

Writable data through i2c bus.

Public Members

uint8_t i2c_address

i2c address

bool is_oneshot

enable or disable oneshot mode

bool is_continuous

enable or disable continuous mode

float adc_voltage_offset_1
float adc_voltage_offset_2
float adc_voltage_min
float adc_voltage_max
uint16_t tipping_bucket_time_ms

Tipping bucket time in milliseconds.

uint8_t rain_for_tip

How much mm of rain for one tip of tipping bucket rain gauge.

sensor_conf_t sensors[2]

sensors configurations

file index.md
file ArduinoISP.ino
#include "Arduino.h"

Defines

PROG_FLICKER
SPI_CLOCK
RESET
LED_HB
LED_ERR
LED_PMODE
PIN_MOSI
PIN_MISO
PIN_SCK
SERIAL
BAUDRATE
HWVER
SWMAJ
SWMIN
STK_OK
STK_FAILED
STK_UNKNOWN
STK_INSYNC
STK_NOSYNC
CRC_EOP
SPI_MODE0
beget16(addr)
PTIME
EECHUNK

Typedefs

typedef struct param parameter

Functions

void pulse(int pin, int times)
void setup()

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

Return

void.

void heartbeat()
void reset_target(bool reset)
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.

Return

void.

uint8_t getch()
void fill(int n)
void prog_lamp(int state)
uint8_t spi_transaction(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
void empty_reply()
void breply(uint8_t b)
void get_version(uint8_t c)
void set_parameters()
void start_pmode()
void end_pmode()
void universal()
void flash(uint8_t hilo, unsigned int addr, uint8_t data)
void commit(unsigned int addr)
unsigned int current_page()
void write_flash(int length)
uint8_t write_flash_pages(int length)
uint8_t write_eeprom(unsigned int length)
uint8_t write_eeprom_chunk(unsigned int start, unsigned int length)
void program_page()
uint8_t flash_read(uint8_t hilo, unsigned int addr)
char flash_read_page(int length)
char eeprom_read_page(int length)
void read_page()
void read_signature()
void avrisp()

Variables

static BitBangedSPI SPI
int error = 0
int pmode = 0
unsigned int here
uint8_t buff[256]
parameter param
uint8_t hbval = 128
int8_t hbdelta = 8
static bool rst_active_high
file baudcheck.c

Variables

bpsx =BAUD_RATEbps=${bpsx/L/}bps=${bps/U/}fcpux=F_CPUfcpu=${fcpux/L/}fcpu=${fcpu/U/}BAUD_SETTING=$(( ( ($fcpu + $bps * 4) / (($bps * 8))) - 1 ))BAUD_ACTUAL=$(( ($fcpu/(8 * (($BAUD_SETTING)+1))) ))BAUD_ERROR=$(( (( 100*($BAUD_ACTUAL - $bps) ) / $bps) ))ERR_TS=$(( ((( 1000*($BAUD_ACTUAL - $bps) ) / $bps) - $BAUD_ERROR * 10) ))ERR_TENTHS=$(( ERR_TS > 0 ? ERR_TS: -ERR_TS ))echo BAUD RATE CHECK: Desired: $bps
Real __pad0__
Real UBRRL = $BAUD_SETTING
file baudcheck.c

Variables

bpsx =BAUD_RATEbps=${bpsx/L/}bps=${bps/U/}fcpux=F_CPUfcpu=${fcpux/L/}fcpu=${fcpu/U/}BAUD_SETTING=$(( ( ($fcpu + $bps * 4) / (($bps * 8))) - 1 ))BAUD_ACTUAL=$(( ($fcpu/(8 * (($BAUD_SETTING)+1))) ))BAUD_ERROR=$(( (( 100*($BAUD_ACTUAL - $bps) ) / $bps) ))ERR_TS=$(( ((( 1000*($BAUD_ACTUAL - $bps) ) / $bps) - $BAUD_ERROR * 10) ))ERR_TENTHS=$(( ERR_TS > 0 ? ERR_TS: -ERR_TS ))echo BAUD RATE CHECK: Desired: $bps
Real __pad0__
Real UBRRL = $BAUD_SETTING
file boot.h
#include <avr/eeprom.h>#include <avr/io.h>#include <inttypes.h>#include <limits.h>

Defines

BOOTLOADER_SECTION

Used to declare a function or variable to be placed into a new section called .bootloader. This section and its contents can then be relocated to any address (such as the bootloader NRWW area) at link-time.

__COMMON_ASB
__COMMON_ASRE
BLB12
BLB11
BLB02
BLB01
boot_spm_interrupt_enable()

Enable the SPM interrupt.

boot_spm_interrupt_disable()

Disable the SPM interrupt.

boot_is_spm_interrupt()

Check if the SPM interrupt is enabled.

boot_rww_busy()

Check if the RWW section is busy.

boot_spm_busy()

Check if the SPM instruction is busy.

boot_spm_busy_wait()

Wait while the SPM instruction is busy.

__BOOT_PAGE_ERASE
__BOOT_PAGE_WRITE
__BOOT_PAGE_FILL
__BOOT_RWW_ENABLE
__BOOT_LOCK_BITS_SET
__boot_page_fill_short(address, data)
__boot_page_fill_normal(address, data)
__boot_page_fill_alternate(address, data)
__boot_page_fill_extended(address, data)
__boot_page_fill_extended_short(address, data)
__boot_page_erase_short(address)
__boot_page_erase_normal(address)
__boot_page_erase_alternate(address)
__boot_page_erase_extended(address)
__boot_page_erase_extended_short(address)
__boot_page_write_short(address)
__boot_page_write_normal(address)
__boot_page_write_alternate(address)
__boot_page_write_extended(address)
__boot_page_write_extended_short(address)
__boot_rww_enable_short()
__boot_rww_enable()
__boot_rww_enable_alternate()
__boot_lock_bits_set_short(lock_bits)
__boot_lock_bits_set(lock_bits)
__boot_lock_bits_set_alternate(lock_bits)
GET_LOW_FUSE_BITS

address to read the low fuse bits, using boot_lock_fuse_bits_get

GET_LOCK_BITS

address to read the lock bits, using boot_lock_fuse_bits_get

GET_EXTENDED_FUSE_BITS

address to read the extended fuse bits, using boot_lock_fuse_bits_get

GET_HIGH_FUSE_BITS

address to read the high fuse bits, using boot_lock_fuse_bits_get

boot_lock_fuse_bits_get_short(address)
boot_lock_fuse_bits_get(address)

Read the lock or fuse bits at address.

Parameter address can be any of GET_LOW_FUSE_BITS, GET_LOCK_BITS, GET_EXTENDED_FUSE_BITS, or GET_HIGH_FUSE_BITS.

Note

The lock and fuse bits returned are the physical values, i.e. a bit returned as 0 means the corresponding fuse or lock bit is programmed.

__BOOT_SIGROW_READ
boot_signature_byte_get_short(addr)
boot_signature_byte_get(addr)

Read the Signature Row byte at address. For some MCU types, this function can also retrieve the factory-stored oscillator calibration bytes.

Parameter address can be 0-0x1f as documented by the datasheet.

Note

The values are MCU type dependent.

boot_page_fill(address, data)

Fill the bootloader temporary page buffer for flash address with data word.

Note

The address is a byte address. The data is a word. The AVR writes data to the buffer a word at a time, but addresses the buffer per byte! So, increment your address by 2 between calls, and send 2 data bytes in a word format! The LSB of the data is written to the lower address; the MSB of the data is written to the higher address.

boot_page_erase(address)

Erase the flash page that contains address.

Note

address is a byte address in flash, not a word address.

boot_page_write(address)

Write the bootloader temporary page buffer to flash page that contains address.

Note

address is a byte address in flash, not a word address.

boot_rww_enable()

Enable the Read-While-Write memory section.

boot_lock_bits_set(lock_bits)

Set the bootloader lock bits.

For example, to disallow the SPM instruction from writing to the Boot Loader memory section of flash, you would use this macro as such:

Note

In this context, a 'set bit' will be written to a zero value. Note also that only BLBxx bits can be programmed by this command.

Parameters
  • lock_bits: A mask of which Boot Loader Lock Bits to set.

boot_lock_bits_set (_BV (BLB11));

Note

Like any lock bits, the Boot Loader Lock Bits, once set, cannot be cleared again except by a chip erase which will in turn also erase the boot loader itself.

boot_page_fill_safe(address, data)

Same as boot_page_fill() except it waits for eeprom and spm operations to complete before filling the page.

boot_page_erase_safe(address)

Same as boot_page_erase() except it waits for eeprom and spm operations to complete before erasing the page.

boot_page_write_safe(address)

Same as boot_page_write() except it waits for eeprom and spm operations to complete before writing the page.

boot_rww_enable_safe()

Same as boot_rww_enable() except waits for eeprom and spm operations to complete before enabling the RWW mameory.

boot_lock_bits_set_safe(lock_bits)

Same as boot_lock_bits_set() except waits for eeprom and spm operations to complete before setting the lock bits.

file boot.h
#include <avr/eeprom.h>#include <avr/io.h>#include <inttypes.h>#include <limits.h>

Defines

BOOTLOADER_SECTION

Used to declare a function or variable to be placed into a new section called .bootloader. This section and its contents can then be relocated to any address (such as the bootloader NRWW area) at link-time.

__COMMON_ASB
__COMMON_ASRE
BLB12
BLB11
BLB02
BLB01
boot_spm_interrupt_enable()

Enable the SPM interrupt.

boot_spm_interrupt_disable()

Disable the SPM interrupt.

boot_is_spm_interrupt()

Check if the SPM interrupt is enabled.

boot_rww_busy()

Check if the RWW section is busy.

boot_spm_busy()

Check if the SPM instruction is busy.

boot_spm_busy_wait()

Wait while the SPM instruction is busy.

__BOOT_PAGE_ERASE
__BOOT_PAGE_WRITE
__BOOT_PAGE_FILL
__BOOT_RWW_ENABLE
__BOOT_LOCK_BITS_SET
__boot_page_fill_short(address, data)
__boot_page_fill_normal(address, data)
__boot_page_fill_alternate(address, data)
__boot_page_fill_extended(address, data)
__boot_page_fill_extended_short(address, data)
__boot_page_erase_short(address)
__boot_page_erase_normal(address)
__boot_page_erase_alternate(address)
__boot_page_erase_extended(address)
__boot_page_erase_extended_short(address)
__boot_page_write_short(address)
__boot_page_write_normal(address)
__boot_page_write_alternate(address)
__boot_page_write_extended(address)
__boot_page_write_extended_short(address)
__boot_rww_enable_short()
__boot_rww_enable()
__boot_rww_enable_alternate()
__boot_lock_bits_set_short(lock_bits)
__boot_lock_bits_set(lock_bits)
__boot_lock_bits_set_alternate(lock_bits)
GET_LOW_FUSE_BITS

address to read the low fuse bits, using boot_lock_fuse_bits_get

GET_LOCK_BITS

address to read the lock bits, using boot_lock_fuse_bits_get

GET_EXTENDED_FUSE_BITS

address to read the extended fuse bits, using boot_lock_fuse_bits_get

GET_HIGH_FUSE_BITS

address to read the high fuse bits, using boot_lock_fuse_bits_get

boot_lock_fuse_bits_get_short(address)
boot_lock_fuse_bits_get(address)

Read the lock or fuse bits at address.

Parameter address can be any of GET_LOW_FUSE_BITS, GET_LOCK_BITS, GET_EXTENDED_FUSE_BITS, or GET_HIGH_FUSE_BITS.

Note

The lock and fuse bits returned are the physical values, i.e. a bit returned as 0 means the corresponding fuse or lock bit is programmed.

__BOOT_SIGROW_READ
boot_signature_byte_get_short(addr)
boot_signature_byte_get(addr)

Read the Signature Row byte at address. For some MCU types, this function can also retrieve the factory-stored oscillator calibration bytes.

Parameter address can be 0-0x1f as documented by the datasheet.

Note

The values are MCU type dependent.

boot_page_fill(address, data)

Fill the bootloader temporary page buffer for flash address with data word.

Note

The address is a byte address. The data is a word. The AVR writes data to the buffer a word at a time, but addresses the buffer per byte! So, increment your address by 2 between calls, and send 2 data bytes in a word format! The LSB of the data is written to the lower address; the MSB of the data is written to the higher address.

boot_page_erase(address)

Erase the flash page that contains address.

Note

address is a byte address in flash, not a word address.

boot_page_write(address)

Write the bootloader temporary page buffer to flash page that contains address.

Note

address is a byte address in flash, not a word address.

boot_rww_enable()

Enable the Read-While-Write memory section.

boot_lock_bits_set(lock_bits)

Set the bootloader lock bits.

For example, to disallow the SPM instruction from writing to the Boot Loader memory section of flash, you would use this macro as such:

Note

In this context, a 'set bit' will be written to a zero value. Note also that only BLBxx bits can be programmed by this command.

Parameters
  • lock_bits: A mask of which Boot Loader Lock Bits to set.

boot_lock_bits_set (_BV (BLB11));

Note

Like any lock bits, the Boot Loader Lock Bits, once set, cannot be cleared again except by a chip erase which will in turn also erase the boot loader itself.

boot_page_fill_safe(address, data)

Same as boot_page_fill() except it waits for eeprom and spm operations to complete before filling the page.

boot_page_erase_safe(address)

Same as boot_page_erase() except it waits for eeprom and spm operations to complete before erasing the page.

boot_page_write_safe(address)

Same as boot_page_write() except it waits for eeprom and spm operations to complete before writing the page.

boot_rww_enable_safe()

Same as boot_rww_enable() except waits for eeprom and spm operations to complete before enabling the RWW mameory.

boot_lock_bits_set_safe(lock_bits)

Same as boot_lock_bits_set() except waits for eeprom and spm operations to complete before setting the lock bits.

file diskio.c
#include "pff/src/pff.h"#include "pff/src/diskio.h"

Defines

CMD0
CMD1
ACMD41
CMD8
CMD16
CMD17
CMD24
CMD55
CMD58
CT_MMC
CT_SD1
CT_SD2
CT_BLOCK

Functions

void init_spi(void)

Init SPI library.

Return

void.

void deselect(void)
void select(void)
void xmit_spi(BYTE d)
BYTE rcv_spi(void)
void dly_100us(void)
static BYTE send_cmd(BYTE cmd, DWORD arg)
DSTATUS disk_initialize(void)
DRESULT disk_readp(BYTE *buff, DWORD sector, UINT offset, UINT count)

Variables

static BYTE CardType
file diskio.c
#include "diskio.h"

Functions

DSTATUS disk_initialize(void)
DRESULT disk_readp(BYTE *buff, DWORD sector, UINT offset, UINT count)
DRESULT disk_writep(BYTE *buff, DWORD sc)
file diskio.c
#include "pff/src/pff.h"#include "pff/src/diskio.h"

Defines

CMD0
CMD1
ACMD41
CMD8
CMD16
CMD17
CMD24
CMD55
CMD58
CT_MMC
CT_SD1
CT_SD2
CT_BLOCK

Functions

void init_spi(void)

Init SPI library.

Return

void.

void deselect(void)
void select(void)
void xmit_spi(BYTE d)
BYTE rcv_spi(void)
void dly_100us(void)
static BYTE send_cmd(BYTE cmd, DWORD arg)
DSTATUS disk_initialize(void)
DRESULT disk_readp(BYTE *buff, DWORD sector, UINT offset, UINT count)

Variables

static BYTE CardType
file diskio.c
#include "diskio.h"

Functions

DSTATUS disk_initialize(void)
DRESULT disk_readp(BYTE *buff, DWORD sector, UINT offset, UINT count)
DRESULT disk_writep(BYTE *buff, DWORD sc)
file optiboot.c
#include <inttypes.h>#include <avr/io.h>#include <avr/pgmspace.h>#include <avr/eeprom.h>#include <string.h>#include "pff/src/pff.h"#include "boot.h"#include "pin_defs.h"#include "stk500.h"

Defines

FUNC_READ
FUNC_WRITE
OPTIBOOT_MAJVER
OPTIBOOT_MINVER
OPTIBOOT_CUSTOMVER
PGM_READ_BYTE(x)
UART_REPORT
LED_START_FLASHES
BAUD_RATE
UART
BAUD_SETTING
BAUD_ACTUAL
BAUD_ERROR
WATCHDOG_OFF
WATCHDOG_16MS
WATCHDOG_32MS
WATCHDOG_64MS
WATCHDOG_125MS
WATCHDOG_250MS
WATCHDOG_500MS
WATCHDOG_1S
WATCHDOG_2S
WATCHDOG_4S
WATCHDOG_8S
GETLENGTH(len)
RAMSTART
buff
appstart_vec

Functions

unsigned const int __attribute__ ((section(".version")))
static uint8_t pagecmp()
uint8_t doFlash()
void checkFile()
void UART_puts(const char *str)
void UART_newline(void)
void UART_putnibble(uint8_t c)
void UART_puthex(uint8_t c)
void UART_puthex16(uint16_t n)
void UART_puthex32(uint32_t n)
void UART_putsP(const char *str, uint16_t n)
int main(void)
void putch(char ch)
uint8_t getch(void)
void getNch(uint8_t count)
void verifySpace()
void watchdogReset()
void watchdogConfig(uint8_t x)
void appStart(uint8_t rstFlags)
static inline void writebuffer(int8_t memtype, uint8_t *mybuff, uint16_t address, pagelen_t len)
static inline void read_mem(uint8_t memtype, uint16_t address, pagelen_t length)

Variables

const char filename[13] = "FIRMWARE.BIN\0"
file optiboot.c
#include <inttypes.h>#include <avr/io.h>#include <avr/pgmspace.h>#include <avr/eeprom.h>#include <string.h>#include "pff/src/pff.h"#include "ihex/kk_ihex_read.h"#include "boot.h"#include "pin_defs.h"#include "stk500.h"

Defines

FUNC_READ
FUNC_WRITE
OPTIBOOT_MAJVER
OPTIBOOT_MINVER
OPTIBOOT_CUSTOMVER
PGM_READ_BYTE(x)
UART_REPORT
LED_START_FLASHES
BAUD_RATE
UART
BAUD_SETTING
BAUD_ACTUAL
BAUD_ERROR
WATCHDOG_OFF
WATCHDOG_16MS
WATCHDOG_32MS
WATCHDOG_64MS
WATCHDOG_125MS
WATCHDOG_250MS
WATCHDOG_500MS
WATCHDOG_1S
WATCHDOG_2S
WATCHDOG_4S
WATCHDOG_8S
GETLENGTH(len)
RAMSTART
buff
appstart_vec

Functions

unsigned const int __attribute__ ((section(".version")))
void write_flash_page()
static uint8_t pagecmp()
uint8_t doFlash()
void checkFile()
void UART_puts(const char *str)
void UART_newline(void)
void UART_putnibble(uint8_t c)
void UART_puthex(uint8_t c)
void UART_puthex16(uint16_t n)
void UART_puthex32(uint32_t n)
void UART_putsP(const char *str, uint16_t n)
int main(void)
void putch(char ch)
uint8_t getch(void)
void getNch(uint8_t count)
void verifySpace()
void watchdogReset()
void watchdogConfig(uint8_t x)
void appStart(uint8_t rstFlags)
static inline void writebuffer(int8_t memtype, uint8_t *mybuff, uint16_t address, pagelen_t len)
static inline void read_mem(uint8_t memtype, uint16_t address, pagelen_t length)

Variables

const char filename[13] = "FIRMWARE.BIN\0"
file diskio.h
#include "integer.h"

Defines

STA_NOINIT
STA_NODISK

Typedefs

typedef BYTE DSTATUS

Enums

enum DRESULT

Values:

enumerator RES_OK
enumerator RES_ERROR
enumerator RES_NOTRDY
enumerator RES_PARERR
enumerator RES_OK
enumerator RES_ERROR
enumerator RES_NOTRDY
enumerator RES_PARERR

Functions

DSTATUS disk_initialize(void)
DRESULT disk_readp(BYTE *buff, DWORD sector, UINT offser, UINT count)
DRESULT disk_writep(const BYTE *buff, DWORD sc)
file diskio.h
#include "integer.h"

Defines

STA_NOINIT
STA_NODISK

Typedefs

typedef BYTE DSTATUS

Enums

enum DRESULT

Values:

enumerator RES_OK
enumerator RES_ERROR
enumerator RES_NOTRDY
enumerator RES_PARERR
enumerator RES_OK
enumerator RES_ERROR
enumerator RES_NOTRDY
enumerator RES_PARERR

Functions

DSTATUS disk_initialize(void)
DRESULT disk_readp(BYTE *buff, DWORD sector, UINT offser, UINT count)
DRESULT disk_writep(const BYTE *buff, DWORD sc)
file integer.h

Typedefs

typedef unsigned char BYTE
typedef short SHORT
typedef unsigned short WORD
typedef unsigned short WCHAR
typedef int INT
typedef unsigned int UINT
typedef long LONG
typedef unsigned long DWORD
file integer.h

Typedefs

typedef unsigned char BYTE
typedef short SHORT
typedef unsigned short WORD
typedef unsigned short WCHAR
typedef int INT
typedef unsigned int UINT
typedef long LONG
typedef unsigned long DWORD
file pff.c
#include "pff.h"#include "diskio.h"

Defines

_FS_32ONLY
ABORT(err)
_EXCVT
IsUpper(c)
IsLower(c)
IsDBCS1(c)
IsDBCS2(c)
BS_jmpBoot
BS_OEMName
BPB_BytsPerSec
BPB_SecPerClus
BPB_RsvdSecCnt
BPB_NumFATs
BPB_RootEntCnt
BPB_TotSec16
BPB_Media
BPB_FATSz16
BPB_SecPerTrk
BPB_NumHeads
BPB_HiddSec
BPB_TotSec32
BS_55AA
BS_DrvNum
BS_BootSig
BS_VolID
BS_VolLab
BS_FilSysType
BPB_FATSz32
BPB_ExtFlags
BPB_FSVer
BPB_RootClus
BPB_FSInfo
BPB_BkBootSec
BS_DrvNum32
BS_BootSig32
BS_VolID32
BS_VolLab32
BS_FilSysType32
MBR_Table
DIR_Name
DIR_Attr
DIR_NTres
DIR_CrtTime
DIR_CrtDate
DIR_FstClusHI
DIR_WrtTime
DIR_WrtDate
DIR_FstClusLO
DIR_FileSize

Functions

static void mem_set(void *dst, int val, int cnt)
static int mem_cmp(const void *dst, const void *src, int cnt)
static CLUST get_fat(CLUST clst)
static DWORD clust2sect(CLUST clst)
static CLUST get_clust(BYTE *dir)
static FRESULT dir_rewind(DIR *dj)
static FRESULT dir_next(DIR *dj)
static FRESULT dir_find(DIR *dj, BYTE *dir)
static FRESULT create_name(DIR *dj, const char **path)
static FRESULT follow_path(DIR *dj, BYTE *dir, const char *path)
static BYTE check_fs(BYTE *buf, DWORD sect)
FRESULT pf_mount(FATFS *fs)
FRESULT pf_open(const char *path)
FRESULT pf_read(void *buff, UINT btr)

Variables

static FATFS *FatFs
file pff.c
#include "pff.h"#include "diskio.h"

Defines

_FS_32ONLY
ABORT(err)
_EXCVT
IsUpper(c)
IsLower(c)
IsDBCS1(c)
IsDBCS2(c)
BS_jmpBoot
BS_OEMName
BPB_BytsPerSec
BPB_SecPerClus
BPB_RsvdSecCnt
BPB_NumFATs
BPB_RootEntCnt
BPB_TotSec16
BPB_Media
BPB_FATSz16
BPB_SecPerTrk
BPB_NumHeads
BPB_HiddSec
BPB_TotSec32
BS_55AA
BS_DrvNum
BS_BootSig
BS_VolID
BS_VolLab
BS_FilSysType
BPB_FATSz32
BPB_ExtFlags
BPB_FSVer
BPB_RootClus
BPB_FSInfo
BPB_BkBootSec
BS_DrvNum32
BS_BootSig32
BS_VolID32
BS_VolLab32
BS_FilSysType32
MBR_Table
DIR_Name
DIR_Attr
DIR_NTres
DIR_CrtTime
DIR_CrtDate
DIR_FstClusHI
DIR_WrtTime
DIR_WrtDate
DIR_FstClusLO
DIR_FileSize

Functions

static void mem_set(void *dst, int val, int cnt)
static int mem_cmp(const void *dst, const void *src, int cnt)
static CLUST get_fat(CLUST clst)
static DWORD clust2sect(CLUST clst)
static CLUST get_clust(BYTE *dir)
static FRESULT dir_rewind(DIR *dj)
static FRESULT dir_next(DIR *dj)
static FRESULT dir_find(DIR *dj, BYTE *dir)
static FRESULT create_name(DIR *dj, const char **path)
static FRESULT follow_path(DIR *dj, BYTE *dir, const char *path)
static BYTE check_fs(BYTE *buf, DWORD sect)
FRESULT pf_mount(FATFS *fs)
FRESULT pf_open(const char *path)
FRESULT pf_read(void *buff, UINT btr)

Variables

static FATFS *FatFs
file pff.h
#include "integer.h"#include "pffconf.h"

Defines

_PFATFS
CLUST
FA_OPENED
FA_WPRT
FA__WIP
FS_FAT12
FS_FAT16
FS_FAT32
AM_RDO
AM_HID
AM_SYS
AM_VOL
AM_LFN
AM_DIR
AM_ARC
AM_MASK
LD_WORD(ptr)
LD_DWORD(ptr)
ST_WORD(ptr, val)
ST_DWORD(ptr, val)

Enums

enum FRESULT

Values:

enumerator FR_OK
enumerator FR_DISK_ERR
enumerator FR_NOT_READY
enumerator FR_NO_FILE
enumerator FR_NOT_OPENED
enumerator FR_NOT_ENABLED
enumerator FR_NO_FILESYSTEM
enumerator FR_OK
enumerator FR_DISK_ERR
enumerator FR_NOT_READY
enumerator FR_NO_FILE
enumerator FR_NOT_OPENED
enumerator FR_NOT_ENABLED
enumerator FR_NO_FILESYSTEM

Functions

FRESULT pf_mount(FATFS *fs)
FRESULT pf_open(const char *path)
FRESULT pf_read(void *buff, UINT btr)
FRESULT pf_write(const void *buff, UINT btw, UINT *bw)
FRESULT pf_lseek(DWORD ofs)
FRESULT pf_opendir(DIR *dj, const char *path)
FRESULT pf_readdir(DIR *dj, FILINFO *fno)
file pff.h
#include "integer.h"#include "pffconf.h"

Defines

_PFATFS
CLUST
FA_OPENED
FA_WPRT
FA__WIP
FS_FAT12
FS_FAT16
FS_FAT32
AM_RDO
AM_HID
AM_SYS
AM_VOL
AM_LFN
AM_DIR
AM_ARC
AM_MASK
LD_WORD(ptr)
LD_DWORD(ptr)
ST_WORD(ptr, val)
ST_DWORD(ptr, val)

Enums

enum FRESULT

Values:

enumerator FR_OK
enumerator FR_DISK_ERR
enumerator FR_NOT_READY
enumerator FR_NO_FILE
enumerator FR_NOT_OPENED
enumerator FR_NOT_ENABLED
enumerator FR_NO_FILESYSTEM
enumerator FR_OK
enumerator FR_DISK_ERR
enumerator FR_NOT_READY
enumerator FR_NO_FILE
enumerator FR_NOT_OPENED
enumerator FR_NOT_ENABLED
enumerator FR_NO_FILESYSTEM

Functions

FRESULT pf_mount(FATFS *fs)
FRESULT pf_open(const char *path)
FRESULT pf_read(void *buff, UINT btr)
FRESULT pf_write(const void *buff, UINT btw, UINT *bw)
FRESULT pf_lseek(DWORD ofs)
FRESULT pf_opendir(DIR *dj, const char *path)
FRESULT pf_readdir(DIR *dj, FILINFO *fno)
file pffconf.h

Defines

_PFFCONF
_USE_MINIMALISTIC_PFF
_USE_READ
_USE_DIR
_USE_LSEEK
_USE_WRITE
_FS_FAT12
_FS_FAT16
_FS_FAT32
_USE_LCC
_CODE_PAGE
_WORD_ACCESS
file pffconf.h

Defines

_PFFCONF
_USE_MINIMALISTIC_PFF
_USE_READ
_USE_DIR
_USE_LSEEK
_USE_WRITE
_FS_FAT12
_FS_FAT16
_FS_FAT32
_USE_LCC
_CODE_PAGE
_WORD_ACCESS
file pin_defs.h

Defines

UART_SRA
UART_SRB
UART_SRC
UART_SRL
UART_UDR
A0
A1
A2
A3
A4
A5
A6
A7
B0
B1
B2
B3
B4
B5
B6
B7
C0
C1
C2
C3
C4
C5
C6
C7
D0
D1
D2
D3
D4
D5
D6
D7
E0
E1
E2
E3
E4
E5
E6
E7
F0
F1
F2
F3
F4
F5
F6
F7
G0
G1
G2
G3
G4
G5
G6
G7
H0
H1
H2
H3
H4
H5
H6
H7
J0
J1
J2
J3
J4
J5
J6
J7
K0
K1
K2
K3
K4
K5
K6
K7
L0
L1
L2
L3
L4
L5
L6
L7
file pin_defs.h

Defines

UART_SRA
UART_SRB
UART_SRC
UART_SRL
UART_UDR
A0
A1
A2
A3
A4
A5
A6
A7
B0
B1
B2
B3
B4
B5
B6
B7
C0
C1
C2
C3
C4
C5
C6
C7
D0
D1
D2
D3
D4
D5
D6
D7
E0
E1
E2
E3
E4
E5
E6
E7
F0
F1
F2
F3
F4
F5
F6
F7
G0
G1
G2
G3
G4
G5
G6
G7
H0
H1
H2
H3
H4
H5
H6
H7
J0
J1
J2
J3
J4
J5
J6
J7
K0
K1
K2
K3
K4
K5
K6
K7
L0
L1
L2
L3
L4
L5
L6
L7
file spi_pins.h
file spi_pins.h
file stk500.h

Defines

STK_OK
STK_FAILED
STK_UNKNOWN
STK_NODEVICE
STK_INSYNC
STK_NOSYNC
ADC_CHANNEL_ERROR
ADC_MEASURE_OK
PWM_CHANNEL_ERROR
PWM_ADJUST_OK
CRC_EOP
STK_GET_SYNC
STK_GET_SIGN_ON
STK_SET_PARAMETER
STK_GET_PARAMETER
STK_SET_DEVICE
STK_SET_DEVICE_EXT
STK_ENTER_PROGMODE
STK_LEAVE_PROGMODE
STK_CHIP_ERASE
STK_CHECK_AUTOINC
STK_LOAD_ADDRESS
STK_UNIVERSAL
STK_PROG_FLASH
STK_PROG_DATA
STK_PROG_FUSE
STK_PROG_LOCK
STK_PROG_PAGE
STK_PROG_FUSE_EXT
STK_READ_FLASH
STK_READ_DATA
STK_READ_FUSE
STK_READ_LOCK
STK_READ_PAGE
STK_READ_SIGN
STK_READ_OSCCAL
STK_READ_FUSE_EXT
STK_READ_OSCCAL_EXT
STK_SW_MAJOR
STK_SW_MINOR
file stk500.h

Defines

STK_OK
STK_FAILED
STK_UNKNOWN
STK_NODEVICE
STK_INSYNC
STK_NOSYNC
ADC_CHANNEL_ERROR
ADC_MEASURE_OK
PWM_CHANNEL_ERROR
PWM_ADJUST_OK
CRC_EOP
STK_GET_SYNC
STK_GET_SIGN_ON
STK_SET_PARAMETER
STK_GET_PARAMETER
STK_SET_DEVICE
STK_SET_DEVICE_EXT
STK_ENTER_PROGMODE
STK_LEAVE_PROGMODE
STK_CHIP_ERASE
STK_CHECK_AUTOINC
STK_LOAD_ADDRESS
STK_UNIVERSAL
STK_PROG_FLASH
STK_PROG_DATA
STK_PROG_FUSE
STK_PROG_LOCK
STK_PROG_PAGE
STK_PROG_FUSE_EXT
STK_READ_FLASH
STK_READ_DATA
STK_READ_FUSE
STK_READ_LOCK
STK_READ_PAGE
STK_READ_SIGN
STK_READ_OSCCAL
STK_READ_FUSE_EXT
STK_READ_OSCCAL_EXT
STK_SW_MAJOR
STK_SW_MINOR
file kk_ihex.h
#include <stdint.h>

Defines

KK_IHEX_VERSION
IHEX_LINE_MAX_LENGTH
IHEX_LINEAR_ADDRESS(ihex)
IHEX_BYTE_ADDRESS(ihex, byte_index)
IHEX_NEWLINE_STRING

Typedefs

typedef uint_fast8_t ihex_bool_t
typedef uint_least32_t ihex_address_t
typedef uint_least16_t ihex_segment_t
typedef int ihex_count_t
typedef uint8_t ihex_flags_t
typedef struct ihex_state kk_ihex_t
typedef uint8_t ihex_record_type_t

Enums

enum ihex_flags

Values:

enumerator IHEX_FLAG_ADDRESS_OVERFLOW
enum ihex_record_type

Values:

enumerator IHEX_DATA_RECORD
enumerator IHEX_END_OF_FILE_RECORD
enumerator IHEX_EXTENDED_SEGMENT_ADDRESS_RECORD
enumerator IHEX_START_SEGMENT_ADDRESS_RECORD
enumerator IHEX_EXTENDED_LINEAR_ADDRESS_RECORD
enumerator IHEX_START_LINEAR_ADDRESS_RECORD
file kk_ihex_read.c
#include "kk_ihex_read.h"

Defines

IHEX_START
ADDRESS_HIGH_MASK
IHEX_READ_RECORD_TYPE_MASK
IHEX_READ_STATE_MASK
IHEX_READ_STATE_OFFSET

Enums

enum ihex_read_state

Values:

enumerator READ_WAIT_FOR_START
enumerator READ_COUNT_HIGH
enumerator READ_COUNT_LOW
enumerator READ_ADDRESS_MSB_HIGH
enumerator READ_ADDRESS_MSB_LOW
enumerator READ_ADDRESS_LSB_HIGH
enumerator READ_ADDRESS_LSB_LOW
enumerator READ_RECORD_TYPE_HIGH
enumerator READ_RECORD_TYPE_LOW
enumerator READ_DATA_HIGH
enumerator READ_DATA_LOW

Functions

void ihex_begin_read(struct ihex_state *const ihex)
void ihex_read_at_address(struct ihex_state *const ihex, ihex_address_t address)
void ihex_read_at_segment(struct ihex_state *const ihex, ihex_segment_t segment)
void ihex_end_read(struct ihex_state *const ihex)
void ihex_read_byte(struct ihex_state *const ihex, const char byte)
void ihex_read_bytes (struct ihex_state *restrict ihex, const char *restrict data, ihex_count_t count)
file kk_ihex_read.h
#include "kk_ihex.h"

Functions

void ihex_begin_read(struct ihex_state *ihex)
void ihex_read_at_address(struct ihex_state *ihex, ihex_address_t address)
void ihex_read_byte(struct ihex_state *ihex, char chr)
void ihex_read_bytes (struct ihex_state *restrict ihex, const char *restrict data, ihex_count_t count)
void ihex_end_read(struct ihex_state *ihex)
ihex_bool_t ihex_data_read(struct ihex_state *ihex, ihex_record_type_t type, ihex_bool_t checksum_mismatch)
void ihex_read_at_segment(struct ihex_state *ihex, ihex_segment_t segment)
file README.md
file PetitFS.ino
#include "PetitFS.h"#include "kk_ihex_read.h"

Functions

ihex_bool_t ihex_data_read(struct ihex_state *ihex, ihex_record_type_t type, ihex_bool_t checksum_error)
void ihex_read()
void setup()
void loop()

Variables

FATFS fs
file debug_config.h

Defines

SDCARD_LOGGING_FILE_NAME

File name for logging on SD-Card.

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

SDCARD_LOGGING_FILE_NAME

File name for logging on SD-Card.

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

SDCARD_LOGGING_FILE_NAME

File name for logging on SD-Card.

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

SDCARD_LOGGING_FILE_NAME

File name for logging on SD-Card.

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

SDCARD_LOGGING_FILE_NAME

File name for logging on SD-Card.

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

SDCARD_LOGGING_FILE_NAME

File name for logging on SD-Card.

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

SDCARD_LOGGING_FILE_NAME

File name for logging on SD-Card.

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

SERIAL_TRACE_LEVEL_OFF

Debug level for disable debug on serial interface.

SERIAL_TRACE_LEVEL_ERROR

Debug level for print error message on serial interface.

SERIAL_TRACE_LEVEL_WARNING

Debug level for print warning message on serial interface.

SERIAL_TRACE_LEVEL_INFO

Debug level for print informations message on serial interface.

SERIAL_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on serial interface.

SERIAL_TRACE_LEVEL_TRACE

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

SENSOR_DRIVER_SERIAL_TRACE_LEVEL

Serial trace level debug for SensorDriver library.

SIM800_SERIAL_TRACE_LEVEL

Serial trace level debug for Sim800 library.

OPC_SERIAL_TRACE_LEVEL

Serial trace level debug for Opcxx library.

I2C_TH_SERIAL_TRACE_LEVEL

Serial trace level debug for i2c-th sketch.

I2C_RAIN_SERIAL_TRACE_LEVEL

Serial trace level debug for i2c-rain sketch.

I2C_OPC_SERIAL_TRACE_LEVEL

Serial trace level debug for i2c-opc sketch.

STIMA_SERIAL_TRACE_LEVEL

Serial trace level debug for stima sketch.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

SERIAL_TRACE_LEVEL_OFF

Debug level for disable debug on serial interface.

SERIAL_TRACE_LEVEL_ERROR

Debug level for print error message on serial interface.

SERIAL_TRACE_LEVEL_WARNING

Debug level for print warning message on serial interface.

SERIAL_TRACE_LEVEL_INFO

Debug level for print informations message on serial interface.

SERIAL_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on serial interface.

SERIAL_TRACE_LEVEL_TRACE

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

SENSOR_DRIVER_SERIAL_TRACE_LEVEL

Serial trace level debug for SensorDriver library.

SIM800_SERIAL_TRACE_LEVEL

Serial trace level debug for Sim800 library.

OPC_SERIAL_TRACE_LEVEL

Serial trace level debug for Opcxx library.

I2C_TH_SERIAL_TRACE_LEVEL

Serial trace level debug for i2c-th sketch.

I2C_RAIN_SERIAL_TRACE_LEVEL

Serial trace level debug for i2c-rain sketch.

I2C_OPC_SERIAL_TRACE_LEVEL

Serial trace level debug for i2c-opc sketch.

STIMA_SERIAL_TRACE_LEVEL

Serial trace level debug for stima sketch.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file debug_config.h

Defines

ENABLE_SDCARD_LOGGING

Enable logging on SDcard define to 1 the macro to enable logging on a file on SDcard.

LOG_LEVEL

logging level at compile time Available levels are: LOG_LEVEL_SILENT LOG_LEVEL_FATAL LOG_LEVEL_ERROR LOG_LEVEL_WARNING LOG_LEVEL_NOTICE LOG_LEVEL_TRACE LOG_LEVEL_VERBOSE

DEBUG_MEMORY

Activate debug of memory use and stack heap collision on serial interface.

LCD_TRACE_LEVEL_OFF

Debug level for print error message on lcd interface.

LCD_TRACE_LEVEL_ERROR

Debug level for print error message on lcd.

LCD_TRACE_LEVEL_WARNING

Debug level for print detailed informations message on serial interface.

LCD_TRACE_LEVEL_INFO

Debug level for print informations message on lcd.

LCD_TRACE_LEVEL_DEBUG

Debug level for print verbose informations message on lcd.

OK_STRING

"OK" string message.

ERROR_STRING

"ERROR" string message.

FAIL_STRING

"FAIL" string message.

YES_STRING

"YES" string message.

NO_STRING

"NO" string message.

ON_STRING

"ON" string message.

OFF_STRING

"OFF" string message.

SAVE_STRING

"SAVE" string message.

STIMA_LCD_TRACE_LEVEL

Lcd trace level debug for stima sketch.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_HOW_MANY_BUSY_CHECKS_AFTER_STOP
TWI_TIMEOUT
I2C_BUS_CLOCK

I2C bus clock in Hertz. 30418,25 Hz : minimum freq with prescaler set to 1 and CPU clock to 16MHz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz. 30418,25 Hz : minimum freq with prescaler set to 1 and CPU clock to 16MHz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz. 30418,25 Hz : minimum freq with prescaler set to 1 and CPU clock to 16MHz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz. 30418,25 Hz : minimum freq with prescaler set to 1 and CPU clock to 16MHz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file i2c_config.h

Defines

I2C_BUS_CLOCK

I2C bus clock in Hertz.

I2C_MAX_DATA_LENGTH

Max length in bytes for i2c bus data buffer.

I2C_MAX_ERROR_COUNT

Max i2c error for bus restart.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file json_config.h

Defines

JSON_BUFFER_LENGTH

Length in bytes for JSON data buffer.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_RPC_TOPIC_LENGTH

Length in bytes for mqtt rpc topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_RPC_COMMAND_LENGTH

Length in bytes for mqtt rpc command message.

MQTT_RPC_RESPONSE_LENGTH

Length in bytes for mqtt rpc response message.

MQTT_PACKET_SIZE

Length in bytes for max mqtt packet size.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_RPC_TOPIC
MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_RPC_TOPIC_LENGTH

Length in bytes for mqtt rpc topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_RPC_COMMAND_LENGTH

Length in bytes for mqtt rpc command message.

MQTT_RPC_RESPONSE_LENGTH

Length in bytes for mqtt rpc response message.

MQTT_PACKET_SIZE

Length in bytes for max mqtt packet size.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

STATIONSLUG_LENGTH

Length in bytes for station slug.

BOARDSLUG_LENGTH

Length in bytes for board slug.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_RPC_TOPIC
MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

DEFAULT_STATIONSLUG

Default station slug.

DEFAULT_BOARDSLUG

Default board slug.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_RPC_TOPIC_LENGTH

Length in bytes for mqtt rpc topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_RPC_COMMAND_LENGTH

Length in bytes for mqtt rpc command message.

MQTT_RPC_RESPONSE_LENGTH

Length in bytes for mqtt rpc response message.

MQTT_PACKET_SIZE

Length in bytes for max mqtt packet size.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_RPC_TOPIC
MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file mqtt_config.h

Defines

MQTT_ROOT_TOPIC_LENGTH

Length in bytes for mqtt root topic.

MQTT_MAINT_TOPIC_LENGTH

Length in bytes for mqtt maint topic.

MQTT_SUBSCRIBE_TOPIC_LENGTH

Length in bytes for mqtt subscibe topic.

MQTT_SENSOR_TOPIC_LENGTH

Length in bytes for mqtt sensor topic.

MQTT_CLIENT_ID_LENGTH

Length in bytes for mqtt client id.

MQTT_MESSAGE_LENGTH

Length in bytes for mqtt message.

MQTT_SERVER_LENGTH

Length in bytes for mqtt server.

MQTT_USERNAME_LENGTH

Length in bytes for mqtt username.

MQTT_PASSWORD_LENGTH

Length in bytes for mqtt password.

MQTT_TIMEOUT_MS

Timeout in milliseconds for mqtt stack.

MQTT_DEFAULT_SERVER

Default MQTT server.

MQTT_DEFAULT_PORT

Default MQTT server port.

MQTT_DEFAULT_ROOT_TOPIC

Default MQTT root topic.

MQTT_DEFAULT_MAINT_TOPIC

Default MQTT maint topic.

MQTT_DEFAULT_SUBSCRIBE_TOPIC

Default MQTT subscibe topic.

MQTT_DEFAULT_USERNAME

Default MQTT username.

MQTT_DEFAULT_PASSWORD

Default MQTT password.

MQTT_STATUS_TOPIC

Default MQTT status topic for printing on connect/disconnect message.

MQTT_ON_CONNECT_MESSAGE

MQTT on connect message.

MQTT_ON_DISCONNECT_MESSAGE

MQTT on disconnect message.

MQTT_ON_ERROR_MESSAGE

MQTT on error message.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SPI_DRIVER_SELECT
USE_SD_CRC
SDFAT_FILE_TYPE
USE_LONG_FILE_NAMES
USE_SEPARATE_FAT_CACHE
USE_EXFAT_BITMAP_CACHE
USE_UTF8_LONG_NAMES
USE_FAT_FILE_FLAG_CONTIGUOUS
ENABLE_DEDICATED_SPI
SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sdcard_config.h

Defines

SDCARD_FILES_NAME_MAX_LENGTH

Length in bytes for sdcard file name data buffer.

file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_DES

Enable if you want use DigitEco Wind Speed sensor.

USE_SENSOR_DED

Enable if you want use DigitEco Wind Direction sensor.

USE_SENSOR_DSR

Enable if you want use DigitEco Global Solar Radiation sensor.

USE_SENSOR_VSR

Enable if you want use 0-5V High Resolution Global Solar Radiation sensor.

USE_SENSOR_DSA

Enable if you want average Global Solar Radiation sensor.

USE_SENSOR_DWA

Enable if you want vectorial average Wind Speed and Direction over 10'.

USE_SENSOR_DWB

Enable if you want vectorial average Wind Speed and Direction over report time.

USE_SENSOR_DWC

Enable if you want gust Wind Speed and Direction over report time.

USE_SENSOR_DWD

Enable if you want average Wind Speed over report time.

USE_SENSOR_DWE

Enable if you want class Wind Speed over report time.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

SENSORS_MAX
SENSORS_UNIQUE_MAX
USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
file sensors_config.h

Defines

SENSORS_MAX
SENSORS_UNIQUE_MAX
USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
file sensors_config.h

Defines

SENSORS_MAX
SENSORS_UNIQUE_MAX
USE_THR

Enable if you want use one module for TH and RAIN. Disable if you want use one module for TH and one for RAIN.

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

USE_TH_SENSORS
USE_RAIN_SENSORS
USE_MODULE_THR
USE_MODULE_TH
USE_MODULE_RAIN
file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_DES

Enable if you want use DigitEco Wind Speed sensor.

USE_SENSOR_DED

Enable if you want use DigitEco Wind Direction sensor.

USE_SENSOR_DSR

Enable if you want use DigitEco Global Solar Radiation sensor.

USE_SENSOR_VSR

Enable if you want use 0-5V High Resolution Global Solar Radiation sensor.

USE_SENSOR_DSA

Enable if you want average Global Solar Radiation sensor.

USE_SENSOR_DWA

Enable if you want vectorial average Wind Speed and Direction over 10'.

USE_SENSOR_DWB

Enable if you want vectorial average Wind Speed and Direction over report time.

USE_SENSOR_DWC

Enable if you want gust Wind Speed and Direction over report time.

USE_SENSOR_DWD

Enable if you want average Wind Speed over report time.

USE_SENSOR_DWE

Enable if you want class Wind Speed over report time.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

SENSORS_MAX
SENSORS_UNIQUE_MAX
USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_DES

Enable if you want use DigitEco Wind Speed sensor.

USE_SENSOR_DED

Enable if you want use DigitEco Wind Direction sensor.

USE_SENSOR_DSR

Enable if you want use DigitEco Global Solar Radiation sensor.

USE_SENSOR_VSR

Enable if you want use 0-5V High Resolution Global Solar Radiation sensor.

USE_SENSOR_DSA

Enable if you want average Global Solar Radiation sensor.

USE_SENSOR_DWA

Enable if you want vectorial average Wind Speed and Direction over 10'.

USE_SENSOR_DWB

Enable if you want vectorial average Wind Speed and Direction over report time.

USE_SENSOR_DWC

Enable if you want gust Wind Speed and Direction over report time.

USE_SENSOR_DWD

Enable if you want average Wind Speed over report time.

USE_SENSOR_DWE

Enable if you want class Wind Speed over report time.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

SENSORS_MAX
SENSORS_UNIQUE_MAX
USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_DWA
USE_SENSOR_DWB
USE_SENSOR_DWC
USE_SENSOR_DWD
USE_SENSOR_DWE
USE_SENSOR_DWF
USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file sensors_config.h

Defines

USE_JSON

Enable if you want use json library for json response (getJson function in SensorDriver).

USE_SENSOR_ADT

Enable if you want use ADT7420 sensor.

USE_SENSOR_HIH

Enable if you want use HIH6100 sensor.

USE_SENSOR_HYT

Enable if you want use HYT271 or HYT221 sensor.

USE_SENSOR_DEP

Enable if you want use DigitEco Power sensor.

USE_SENSOR_OA2

Enable if you want use OPC PM1, PM2.5, PM10 continuous average value.

USE_SENSOR_OA3
USE_SENSOR_OB2

Enable if you want use OPC PM1, PM2.5, PM10 continuous standard deviation value.

USE_SENSOR_OB3
USE_SENSOR_OC2

Enable if you want use OPC BINS continuous average value.

USE_SENSOR_OC3
USE_SENSOR_OD2

Enable if you want use OPC BINS continuous standard deviation value.

USE_SENSOR_OD3
USE_SENSOR_OE3
USE_SENSOR_LWT

Enable if you want use leaf wetness time continuous value.

USE_SENSOR_HI7

Enable if you want use SI7021 sensor.

USE_SENSOR_BMP

Enable if you want use Bmp085 sensor.

USE_SENSOR_DW1

Enable if you want use DW1 sensor.

USE_SENSOR_TBS

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_TBR

Enable if you want use Tipping bucket rain gauge sensor.

USE_SENSOR_STH

Enable if you want use Temperature and humidity oneshot sensor.

USE_SENSOR_ITH

Enable if you want use Temperature and humidity continuous istantaneous sensor.

USE_SENSOR_NTH

Enable if you want use Temperature and humidity continuous minium sensor.

USE_SENSOR_MTH

Enable if you want use Temperature and humidity continuous average sensor.

USE_SENSOR_XTH

Enable if you want use Temperature and humidity continuous maximum sensor.

USE_SENSOR_SSD

Enable if you want use SSD011 oneshot sensor.

USE_SENSOR_ISD

Enable if you want use SSD011 report istantaneous sensor.

USE_SENSOR_NSD

Enable if you want use SSD011 report minium sensor.

USE_SENSOR_MSD

Enable if you want use SSD011 report average sensor.

USE_SENSOR_XSD

Enable if you want use SSD011 report maximum sensor.

USE_SENSOR_SMI

Enable if you want use MICS4514 oneshot sensor.

USE_SENSOR_IMI

Enable if you want use MICS4514 report istantaneous sensor.

USE_SENSOR_NMI

Enable if you want use MICS4514 report minium sensor.

USE_SENSOR_MMI

Enable if you want use MICS4514 report average sensor.

USE_SENSOR_GWS

Enable if you want use Gill Windsonic sensor.

USE_SENSOR_XMI

Enable if you want use MICS4514 report maximum sensor.

USE_SENSOR_RF24

Enable if you want use Radio RF24 sensor.

RAIN_FOR_TIP

How much mm of rain for one tip of tipping bucket rain gauge.

VALUES_TO_READ_FROM_SENSOR_COUNT

Maximum number of values to be read by the sensors.

JSONS_TO_READ_FROM_SENSOR_COUNT
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

STATISTICAL_DATA_COUNT

How much observations are needed for generating a report.

OBSERVATION_COUNT

Observations buffer length.

OBSERVATION_COUNT_TOLLERANCE

Tolerance of observations for generating a valid report.

file i2c-leaf-config.h
#include <sensors_config.h>

Defines

MODULE_VERSION

Module version.

MODULE_TYPE

Type of module. It is defined in registers.h.

CONFIGURATION_DEFAULT_IS_ONESHOT

Oneshot mode for default.

CONFIGURATION_DEFAULT_IS_CONTINUOUS

Continuous mode for default.

CONFIGURATION_DEFAULT_I2C_ADDRESS

Default i2c address.

CONFIGURATION_RESET_PIN

Input pin for reset configuration at startup.

LEAF_POWER_PIN

Output pin for power on and power off leaf sensor.

LEAF_ANALOG_PIN

Input pin for reading leaf sensor value.

SDCARD_CHIP_SELECT_PIN

Chip select for SDcard SPI.

SPI_SPEED

Clock speed for SPI and SDcard.

USE_POWER_DOWN

Enable or disable power down.

DEBOUNCING_POWER_DOWN_TIME_MS

Debounce power down ms.

USE_TIMER_1

Enable or disable timer1.

USE_LEAF_POWER_DOWN

Enable or disable power down for leaf sensor.

WDT_TIMER

Watchdog timer for periodically check microprocessor block states.

Possible value for WDT_TIMER are: WDTO_15MS, WDTO_30MS, WDTO_60MS, WDTO_120MS, WDTO_250MS, WDTO_500MS, WDTO_1S, WDTO_2S, WDTO_4S, WDTO_8S

SENSORS_SAMPLE_TIME_MS

Milliseconds for sampling sensors: 1000 - 60000 [ms] must be integer multiple of TIMER1_INTERRUPT_TIME_MS !!!

SENSORS_SAMPLE_COUNT_MIN

Sample count minimum in OBSERVATIONS_MINUTES minutes.

SENSORS_SAMPLE_COUNT_MAX

Sample count maximum in OBSERVATIONS_MINUTES minutes.

SENSORS_SAMPLE_COUNT_TOLERANCE

Maximum invalid sample count for generate a valid observations.

USE_SENSORS_COUNT

Sensors count.

TIMER1_INTERRUPT_TIME_MS

Value in milliseconds for generating timer1 interrupt: 100 - 8000 [ms].

TIMER1_TCNT1_VALUE

Timer1 timer overflow with 1024 prescaler at 8 MHz.

TIMER_COUNTER_VALUE_MAX_MS

Maximum timer1 counter value for timed tasks.

TIMER_COUNTER_VALUE_MAX_S
LEAF_READ_DELAY_MS

Reading delay.

LEAF_VALUES_READ_DELAY_MS

Reading delay.

LEAF_CALIBRATION_READ_COUNT

Maximum number of retry for leaf reading.

LEAF_READ_COUNT
LEAF_CALIBRATION_OFFSET
file i2c-leaf.h
#include "i2c-leaf-config.h"#include <debug.h>#include <i2c_config.h>#include <avr/sleep.h>#include <avr/power.h>#include <avr/wdt.h>#include <i2c_utility.h>#include <rmap_utility.h>#include <eeprom_utility.h>#include <Wire.h>#include <TimeLib.h>#include <typedef.h>#include <registers-leaf.h>#include <debug_config.h>#include <SdFat.h>#include <StreamUtils.h>#include <ArduinoLog.h>

Defines

leafRead()

Enums

enum state_t

Main loop finite state machine.

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enum leaf_reading_state_t

Values:

enumerator LEAF_READING_INIT

init task variables

enumerator LEAF_READING_READ
enumerator LEAF_READING_END

performs end operations and deactivate task

enumerator LEAF_READING_WAIT_STATE

non-blocking waiting time

Functions

void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_system(void)

Init system.

Return

void.

void init_buffers(void)

Init buffers.

Return

void.

void init_tasks(void)

Init tasks variable and state.

Return

void.

void init_pins(void)

Init hardware pins.

Return

void.

void init_wire(void)

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

Return

void.

void init_spi(void)

Init SPI library.

Return

void.

void init_rtc(void)

Init RTC module.

Return

void.

void init_sensors(void)

Create and setup sensors.

Return

void.

void print_configuration(void)

Print current configuration.

Return

void.

void load_configuration(void)

Load configuration from EEPROM.

Return

void.

void save_configuration(bool)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void commands(void)

Performs specific operations based on the received command.

Return

void.

void reset_samples_buffer(void)

Reset samples buffers to default value.

Return

void.

void reset_report_buffer(void)
void reset_buffer(void)
void exchange_buffers(void)

Exchange reader and writer pointer to buffer.

Return

void.

template<typename sample_g, typename observation_g, typename value_v>
void addSample(sample_g *sample, observation_g *observation, value_v value)
template<typename observation_g, typename value_v>
value_v readCurrentObservation(observation_g *buffer)
template<typename observation_g, typename value_v>
void writeCurrentObservation(observation_g *buffer, value_v value)
template<typename observation_g, typename length_v>
void resetObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v>
void resetBackPmObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v>
void incrementObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v, typename value_v>
void addObservation(observation_g *buffer, length_v length, value_v value)
template<typename observation_g, typename length_v, typename value_v>
value_v readBackObservation(observation_g *buffer, length_v length)
void samples_processing(bool is_force_processing)

Main routine for processing the samples to calculate an observation.

Return

void.

Parameters
  • is_force_processing: if is true, force the calculation of the observation provided there is a minimum number of samples.

void leaf_reading_task(void)

Sensors reading Task. Read data from sensors.

Return

void.

void command_task(void)

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void i2c_request_interrupt_handler(void)

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(void)

I2C receive interrupt handler.

Return

void.

Variables

configuration_t configuration

Configuration data.

readable_data_t readable_data_1

First readable i2c register.

readable_data_t readable_data_2

Second readable i2c register.

readable_data_t *readable_data_read_ptr

Pointer for read data in i2c readable register.

readable_data_t *readable_data_write_ptr

Pointer for write data in i2c readable register.

readable_data_t *readable_data_temp_ptr

Temporary pointer for exchange read and write pointer for i2c readable register.

writable_data_t writable_data

Writable i2c register.

writable_data_t *writable_data_ptr

Pointer for read and write data in i2c writable register.

uint8_t readable_data_address

Address of readable i2c register.

uint8_t readable_data_length

Number of bytes to read at readable_data_address.

uint8_t i2c_rx_data[I2C_MAX_DATA_LENGTH]

Buffer for i2c received data.

uint8_t i2c_error

Number of i2c error.

uint8_t ready_tasks_count

Number of tasks ready to execute.

uint32_t awakened_event_occurred_time_ms

System time (in millisecond) when the system has awakened from power down.

bool is_start

Execute start command.

bool is_stop

Execute stop command.

bool is_oneshot

Received command is in oneshot mode.

bool is_continuous

Received command is in continuous mode.

leaf_wetness_t leaf_wetness

leaf_wetness data.

bool is_leaf_init
bool is_leaf_wet
uint8_t samples_count

Number of samples to be acquired for make one observation.

bool do_buffers_reset

Force a buffers reset.

uint16_t timer_counter_ms

Timer counter variable for execute timed task with time multiple of base Timer1 time.

uint16_t timer_counter_s
state_t state

Current main loop state.

leaf_reading_state_t leaf_reading_state
bool is_event_leaf_reading

Enable or disable the Sensors reading task.

bool is_event_command_task

Enable or disable the Command task.

file i2c-leaf.ino
#include "i2c-leaf.h"

Functions

void setup()
void loop()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_buffers()

Init buffers.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_pins()

Init hardware pins.

Return

void.

void init_wire()

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

Return

void.

void init_spi()

Init SPI library.

Return

void.

void init_rtc()

Init RTC module.

Return

void.

void init_system()

Init system.

Return

void.

void print_configuration()

Print current configuration.

Return

void.

void save_configuration(bool is_default)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void load_configuration()

Load configuration from EEPROM.

Return

void.

void init_sensors()

Create and setup sensors.

Return

void.

ISR(TIMER1_OVF_vect)

Timer1 overflow interrupts routine.

Return

void.

void i2c_request_interrupt_handler()

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

void leaf_reading_task()

Sensors reading Task. Read data from sensors.

Return

void.

void exchange_buffers()

Exchange reader and writer pointer to buffer.

Return

void.

void copy_oneshot_data()
void reset_samples_buffer()

Reset samples buffers to default value.

Return

void.

void reset_buffer()
void reset_report_buffer()
void command_task()

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void tests()

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

void commands()

Performs specific operations based on the received command.

Return

void.

file i2c-opc-config.h
#include <sensors_config.h>

Defines

MODULE_VERSION

Module version.

MODULE_TYPE

Type of module. It is defined in registers.h.

CONFIGURATION_DEFAULT_IS_ONESHOT

Oneshot mode for default.

CONFIGURATION_DEFAULT_IS_CONTINUOUS

Continuous mode for default.

CONFIGURATION_DEFAULT_I2C_ADDRESS

Default i2c address.

CONFIGURATION_RESET_PIN

Input pin for reset configuration at startup.

OPC_POWER_PIN

Output pin for power on and power off opc sensor.

OPC_SPI_POWER_PIN
OPC_CHIP_SELECT

Output pin for spi chip select opc sensor.

SDCARD_CHIP_SELECT_PIN

Chip select for SDcard SPI.

SPI_SPEED

Clock speed for SPI and SDcard.

USE_POWER_DOWN

Enable or disable power down.

DEBOUNCING_POWER_DOWN_TIME_MS

Debounce power down ms.

USE_TIMER_1

Enable or disable timer1.

USE_OPC_POWER_DOWN

Enable or disable power down for opc sensor.

WDT_TIMER

Watchdog timer for periodically check microprocessor block states.

Possible value for WDT_TIMER are: WDTO_15MS, WDTO_30MS, WDTO_60MS, WDTO_120MS, WDTO_250MS, WDTO_500MS, WDTO_1S, WDTO_2S, WDTO_4S, WDTO_8S

SENSORS_SAMPLE_TIME_MS

Milliseconds for sampling sensors: 100 - 60000 [ms] must be integer multiple of TIMER1_INTERRUPT_TIME_MS !!!

SENSORS_SAMPLE_COUNT_MIN

Sample count minimum in OBSERVATIONS_MINUTES minutes.

SENSORS_SAMPLE_COUNT_MAX

Sample count maximum in OBSERVATIONS_MINUTES minutes.

SENSORS_SAMPLE_COUNT_TOLERANCE

Maximum invalid sample count for generate a valid observations.

USE_SENSORS_COUNT

Sensors count.

TIMER1_INTERRUPT_TIME_MS

Value in milliseconds for generating timer1 interrupt: 100 - 8000 [ms].

TIMER1_OVERFLOW_TIME_MS

Timer1 timer overflow with 1024 prescaler at 8 or 16 MHz.

Timer1 timer overflow with 1024 prescaler at 8 MHz.

Timer1 timer overflow with 1024 prescaler at 16 MHz.

TIMER1_TCNT1_VALUE

Timer1 timer overflow with 1024 prescaler at 8 MHz.

TIMER1_VALUE_MAX_MS

Maximum timer1 counter value for timed tasks.

OPC_RETRY_COUNT_MAX

Maximum number of retry for opc reading.

file i2c-opc.h
#include "i2c-opc-config.h"#include <debug.h>#include <i2c_config.h>#include <avr/sleep.h>#include <avr/power.h>#include <avr/wdt.h>#include <i2c_utility.h>#include <rmap_utility.h>#include <eeprom_utility.h>#include <Wire.h>#include <TimeLib.h>#include <typedef.h>#include <registers-opc.h>#include <opcxx.h>#include <debug_config.h>#include <SdFat.h>#include <StreamUtils.h>#include <ArduinoLog.h>

Enums

enum state_t

Main loop finite state machine.

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enum opc_state_t

OPC setup and reading task finite state machine.

Values:

enumerator OPC_INIT
enumerator OPC_SWITCH_ON
enumerator OPC_SEND_COMMAND_FAN_DAC
enumerator OPC_WAIT_RESULT_FAN_DAC
enumerator OPC_SEND_COMMAND_FAN_ON
enumerator OPC_WAIT_RESULT_FAN_ON
enumerator OPC_SEND_COMMAND_LASER_ON
enumerator OPC_WAIT_RESULT_LASER_ON
enumerator OPC_SEND_COMMAND_READ_HISTOGRAM
enumerator OPC_WAIT_RESULT_READ_HISTOGRAM
enumerator OPC_READ_HISTOGRAM
enumerator OPC_END

performs end operations and deactivate task

enumerator OPC_WAIT_STATE

non-blocking waiting time

Functions

void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_system(void)

Init system.

Return

void.

void init_buffers(void)

Init buffers.

Return

void.

void init_tasks(void)

Init tasks variable and state.

Return

void.

void init_pins(void)

Init hardware pins.

Return

void.

void init_wire(void)

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

Return

void.

void init_spi(void)

Init SPI library.

Return

void.

void init_rtc(void)

Init RTC module.

Return

void.

void init_sensors(void)

Create and setup sensors.

Return

void.

void print_configuration(void)

Print current configuration.

Return

void.

void load_configuration(void)

Load configuration from EEPROM.

Return

void.

void save_configuration(bool)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void commands(void)

Performs specific operations based on the received command.

Return

void.

void reset_samples_buffer(void)

Reset samples buffers to default value.

Return

void.

void exchange_buffers(void)

Exchange reader and writer pointer to buffer.

Return

void.

template<typename sample_g, typename observation_g, typename values_v, typename value_v>
void addSample(sample_g *sample, observation_g *observation, values_v *values, value_v value)
template<typename observation_g, typename value_v>
value_v readCurrentObservation(observation_g *buffer)
template<typename observation_g, typename value_v>
void writeCurrentObservation(observation_g *buffer, value_v value)
template<typename observation_g, typename length_v>
void resetObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v>
void resetBackPmObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v>
void incrementObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v, typename value_v>
void addObservation(observation_g *buffer, length_v length, value_v value)
template<typename observation_g, typename length_v, typename value_v>
value_v readBackObservation(observation_g *buffer, length_v length)
void samples_processing(bool is_force_processing)

Main routine for processing the samples to calculate an observation.

Return

void.

Parameters
  • is_force_processing: if is true, force the calculation of the observation provided there is a minimum number of samples.

bool observations_processing(void)

Main routine for processing the observations to calculate a value for report.

Return

void.

template<typename sample_g, typename observation_g>
bool make_observation_from_samples(bool is_force_processing, sample_g *sample, observation_g *observation)
template<typename sample_g, typename observation_g, typename value_v, typename val_v>
bool make_value_from_samples_and_observations(sample_g *sample, observation_g *observation, value_v *value)
void opc_task(void)

Opc setup and reading Task. Read data from OPC.

Return

void.

void command_task(void)

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void i2c_request_interrupt_handler(void)

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(void)

Variables

configuration_t configuration
readable_data_t readable_data_1
readable_data_t readable_data_2
readable_data_t *readable_data_read_ptr
readable_data_t *readable_data_write_ptr
readable_data_t *readable_data_temp_ptr
writable_data_t writable_data
writable_data_t *writable_data_ptr
uint8_t readable_data_address
uint8_t readable_data_length
uint8_t i2c_rx_data[I2C_MAX_DATA_LENGTH]
uint8_t i2c_error
uint8_t ready_tasks_count
uint32_t awakened_event_occurred_time_ms
bool is_start
bool is_stop
bool is_oneshot
bool is_continuous
sample_t pm1_samples
sample_t pm25_samples
sample_t pm10_samples
sample_t bins_samples[OPC_BINS_LENGTH]
float_observation_t pm1_observations
float_observation_t pm25_observations
float_observation_t pm10_observations
uint16_observation_t bins_observations[OPC_BINS_LENGTH]
uint8_t samples_count
bool do_buffers_reset
uint16_t timer_counter

Timer counter variable for execute timed task with time multiple of base Timer1 time.

state_t state
opc_state_t opc_state

Current sensors reading task state.

bool is_opc_setted
bool is_opc_first_read
uint8_t histogram_error_count
bool is_event_opc_task

Enable or disable the OPC task.

bool is_event_command_task
file i2c-opc.ino
#include "i2c-opc.h"

Functions

void setup()
void loop()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_buffers()

Init buffers.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_pins()

Init hardware pins.

Return

void.

void init_wire()

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

Return

void.

void init_spi()

Init SPI library.

Return

void.

void init_rtc()

Init RTC module.

Return

void.

void init_system()

Init system.

Return

void.

void print_configuration()

Print current configuration.

Return

void.

void save_configuration(bool is_default)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void load_configuration()

Load configuration from EEPROM.

Return

void.

void init_sensors()

Create and setup sensors.

Return

void.

ISR(TIMER1_OVF_vect)
void i2c_request_interrupt_handler()

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

template<typename sample_g, typename observation_g, typename values_v, typename value_v>
void addSample(sample_g *sample, observation_g *observation, values_v *values, value_v value)
template<typename observation_g, typename value_v>
value_v readCurrentObservation(observation_g *buffer)
template<typename observation_g, typename value_v>
void writeCurrentObservation(observation_g *buffer, value_v value)
template<typename observation_g, typename length_v>
void resetObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v>
void resetBackObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v>
void incrementObservation(observation_g *buffer, length_v length)
template<typename observation_g, typename length_v, typename value_v>
void addObservation(observation_g *buffer, length_v length, value_v value)
template<typename observation_g, typename length_v, typename value_v>
value_v readBackObservation(observation_g *buffer, length_v length)
void samples_processing(bool is_force_processing)

Main routine for processing the samples to calculate an observation.

Return

void.

Parameters
  • is_force_processing: if is true, force the calculation of the observation provided there is a minimum number of samples.

template<typename sample_g, typename observation_g>
bool make_observation_from_samples(bool is_force_processing, sample_g *sample, observation_g *observation)
bool observations_processing()

Main routine for processing the observations to calculate a value for report.

Return

void.

template<typename sample_g, typename observation_g, typename value_v, typename val_v>
bool make_value_from_samples_and_observations(sample_g *sample, observation_g *observation, value_v *value)
void opc_task()

Opc setup and reading Task. Read data from OPC.

Return

void.

void exchange_buffers()

Exchange reader and writer pointer to buffer.

Return

void.

void reset_samples_buffer()

Reset samples buffers to default value.

Return

void.

void reset_observations_buffer()

Reset observations buffers to default value.

Return

void.

void command_task()

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void tests()

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

void commands()

Performs specific operations based on the received command.

Return

void.

file i2c-radiation-config.h
#include <sensors_config.h>

Defines

MODULE_VERSION

Module version.

MODULE_TYPE

Type of module. It is defined in registers.h.

IS_CALIBRATION
CONFIGURATION_DEFAULT_IS_ONESHOT

Oneshot mode for default.

CONFIGURATION_DEFAULT_IS_CONTINUOUS

Continuous mode for default.

CONFIGURATION_DEFAULT_I2C_ADDRESS

Default i2c address.

CONFIGURATION_RESET_PIN

Input pin for reset configuration at startup.

ADC_0
ADC_1
ADC_2
ADC_1_I2C_ADDRESS
ADC_2_I2C_ADDRESS
ADC_3_I2C_ADDRESS
ADC_4_I2C_ADDRESS
CONFIGURATION_DEFAULT_ADC_VOLTAGE_OFFSET_1
CONFIGURATION_DEFAULT_ADC_VOLTAGE_OFFSET_2
CONFIGURATION_DEFAULT_ADC_VOLTAGE_MIN
CONFIGURATION_DEFAULT_ADC_VOLTAGE_MAX
ACQUISITION_COUNT_FOR_POWER_RESET
SDCARD_CHIP_SELECT_PIN

Chip select for SDcard SPI.

SPI_SPEED

Clock speed for SPI and SDcard.

USE_POWER_DOWN

Enable or disable power down.

DEBOUNCING_POWER_DOWN_TIME_MS

Debounce power down ms.

USE_TIMER_1

Enable or disable timer1.

WDT_TIMER

Watchdog timer for periodically check microprocessor block states.

Possible value for WDT_TIMER are: WDTO_15MS, WDTO_30MS, WDTO_60MS, WDTO_120MS, WDTO_250MS, WDTO_500MS, WDTO_1S, WDTO_2S, WDTO_4S, WDTO_8S

SENSORS_SAMPLE_TIME_MS

Milliseconds for sampling sensors: 100 - 60000 [ms] must be integer multiple of TIMER1_INTERRUPT_TIME_MS !!!

OBSERVATION_SAMPLES_COUNT_MIN

Sample count minimum in OBSERVATIONS_MINUTES minutes.

OBSERVATION_SAMPLES_COUNT_MAX

Sample count maximum in OBSERVATIONS_MINUTES minutes.

RMAP_REPORT_SAMPLE_VALID
RMAP_REPORT_SAMPLES_COUNT
OBSERVATION_SAMPLE_ERROR_MAX

Maximum invalid sample count for generate a valid observations.

OBSERVATION_SAMPLE_VALID_MIN
RMAP_REPORT_SAMPLE_ERROR_MAX
RMAP_REPORT_SAMPLE_VALID_MIN
RMAP_REPORT_ERROR_MAX
RMAP_REPORT_VALID_MIN
SAMPLES_COUNT
RMAP_REPORT_INTERVAL_S
USE_SENSORS_COUNT

Sensors count.

TIMER1_INTERRUPT_TIME_MS

Value in milliseconds for generating timer1 interrupt: 100 - 8000 [ms].

TIMER1_TCNT1_VALUE

Timer1 timer overflow with 1024 prescaler at 16 MHz.

TIMER_COUNTER_VALUE_MAX_MS

Maximum timer1 counter value for timed tasks.

TIMER_COUNTER_VALUE_MAX_S
SOLAR_RADIATION_READ_DELAY_MS

Reading delay.

SOLAR_RADIATION_VALUES_READ_DELAY_MS

Reading delay.

SOLAR_RADIATION_READ_COUNT

number of read.

file i2c-radiation.h
#include "i2c-radiation-config.h"#include <debug.h>#include <i2c_config.h>#include <avr/sleep.h>#include <avr/power.h>#include <avr/wdt.h>#include <i2c_utility.h>#include <rmap_utility.h>#include <eeprom_utility.h>#include <Wire.h>#include <TimeLib.h>#include <typedef.h>#include <registers-radiation.h>#include <debug_config.h>#include <SdFat.h>#include <StreamUtils.h>#include <ArduinoLog.h>

Enums

enum state_t

Main loop finite state machine.

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enum solar_radiation_state_t

RADIATION setup and reading task finite state machine.

Values:

enumerator SOLAR_RADIATION_INIT
enumerator SOLAR_RADIATION_READING
enumerator SOLAR_RADIATION_ELABORATE
enumerator SOLAR_RADIATION_END

performs end operations and deactivate task

enumerator SOLAR_RADIATION_WAIT_STATE

non-blocking waiting time

enum solar_radiation_hr_state_t

Values:

enumerator SOLAR_RADIATION_HR_INIT
enumerator SOLAR_RADIATION_HR_SET
enumerator SOLAR_RADIATION_HR_READ
enumerator SOLAR_RADIATION_HR_EVALUATE
enumerator SOLAR_RADIATION_HR_PROCESS
enumerator SOLAR_RADIATION_HR_END

performs end operations and deactivate task

enumerator SOLAR_RADIATION_HR_WAIT_STATE

non-blocking waiting time

Functions

void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_system(void)

Init system.

Return

void.

void init_buffers(void)

Init buffers.

Return

void.

void init_tasks(void)

Init tasks variable and state.

Return

void.

void init_pins(void)

Init hardware pins.

Return

void.

void init_wire(void)

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

Return

void.

void init_spi(void)

Init SPI library.

Return

void.

void init_rtc(void)

Init RTC module.

Return

void.

void init_sensors(void)

Create and setup sensors.

Return

void.

void print_configuration(void)

Print current configuration.

Return

void.

void load_configuration(void)

Load configuration from EEPROM.

Return

void.

void save_configuration(bool)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void commands(void)

Performs specific operations based on the received command.

Return

void.

void tests(void)

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

void reset_samples_buffer(void)

Reset samples buffers to default value.

Return

void.

void reset_report_buffer(void)
void exchange_buffers(void)

Exchange reader and writer pointer to buffer.

Return

void.

template<typename buffer_g, typename length_v, typename value_v>
value_v bufferRead(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
value_v bufferReadBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename value_v>
void bufferWrite(buffer_g *buffer, value_v value)
template<typename buffer_g>
void bufferPtrReset(buffer_g *buffer)
template<typename buffer_g, typename length_v>
void bufferPtrResetBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v>
void incrementBuffer(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void bufferReset(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void addValue(buffer_g *buffer, length_v length, value_v value)
void samples_processing()

Main routine for processing the samples to calculate an observation.

Return

void.

void make_report()
void solar_radiation_task(void)

Wind setup and reading Task. Read data from RADIATION.

Return

void.

void command_task(void)

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void i2c_request_interrupt_handler(void)

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(void)

Variables

configuration_t configuration
readable_data_t readable_data_1
readable_data_t readable_data_2
readable_data_t *readable_data_read_ptr
readable_data_t *readable_data_write_ptr
readable_data_t *readable_data_temp_ptr
writable_data_t writable_data
writable_data_t *writable_data_ptr
uint8_t readable_data_address
uint8_t readable_data_length
uint8_t i2c_rx_data[I2C_MAX_DATA_LENGTH]
uint8_t i2c_error
uint8_t ready_tasks_count
uint32_t awakened_event_occurred_time_ms
bool is_start
bool is_stop
bool is_oneshot
bool is_continuous
bool is_test

Received command is in test mode.

If true, reading value from sensors for testing purpose.

Execute stop command in test mode.

uint8_t solar_radiation_acquisition_count
uint16_t timer_counter_ms
uint16_t timer_counter_s
state_t state
solar_radiation_state_t solar_radiation_state

Current sensors reading task state.

solar_radiation_hr_state_t solar_radiation_hr_state
bool is_event_solar_radiation_task

Enable or disable the RADIATION task.

bool is_event_command_task
file i2c-radiation.ino
#include "i2c-radiation.h"

Functions

void setup()
void loop()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_buffers()

Init buffers.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_pins()

Init hardware pins.

Return

void.

void init_wire()

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

Return

void.

void init_spi()

Init SPI library.

Return

void.

void init_rtc()

Init RTC module.

Return

void.

void init_system()

Init system.

Return

void.

void print_configuration()

Print current configuration.

Return

void.

void save_configuration(bool is_default)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void load_configuration()

Load configuration from EEPROM.

Return

void.

void init_sensors()

Create and setup sensors.

Return

void.

ISR(TIMER1_OVF_vect)
void i2c_request_interrupt_handler()

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

template<typename buffer_g, typename length_v, typename value_v>
value_v bufferRead(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
value_v bufferReadBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename value_v>
void bufferWrite(buffer_g *buffer, value_v value)
template<typename buffer_g>
void bufferPtrReset(buffer_g *buffer)
template<typename buffer_g, typename length_v>
void bufferPtrResetBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v>
void incrementBuffer(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void bufferReset(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void addValue(buffer_g *buffer, length_v length, value_v value)
void make_report()
void samples_processing()

Main routine for processing the samples to calculate an observation.

Return

void.

float getAdcAnalogValue(float adc_value, float min, float max)
float getSolarRadiation(float adc_value, float adc_voltage_min, float adc_voltage_max)
void exchange_buffers()

Exchange reader and writer pointer to buffer.

Return

void.

void reset_samples_buffer()

Reset samples buffers to default value.

Return

void.

void reset_report_buffer()
void command_task()

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void commands()

Performs specific operations based on the received command.

Return

void.

void tests()

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

file i2c-rain-config.h
#include <sensors_config.h>

Defines

MODULE_MAIN_VERSION

Module main version.

MODULE_MINOR_VERSION

Module minor version.

MODULE_CONFIGURATION_VERSION

Module version of compatibile configuration. If you change it, you have to reconfigure.

MODULE_TYPE

Type of module. It is defined in registers.h.

TIPPING_BUCKET_PIN

Interrupt pin for tipping bucket rain gauge.

CONFIGURATION_DEFAULT_TIPPING_BUCKET_TIME_MS

Tipping bucket time in milliseconds.

CONFIGURATION_DEFAULT_RAIN_FOR_TIP

brief How much mm of rain for one tip of tipping bucket rain gauge.

CONFIGURATION_DEFAULT_IS_ONESHOT

Oneshot mode for default.

CONFIGURATION_DEFAULT_IS_CONTINUOUS

Continuous mode for default.

CONFIGURATION_DEFAULT_I2C_ADDRESS

Default i2c address.

CONFIGURATION_RESET_PIN

Input pin for reset configuration at startup.

SDCARD_CHIP_SELECT_PIN

Chip select for SDcard SPI.

SPI_SPEED

Clock speed for SPI and SDcard.

I2C_MAX_TIME

Max i2c time in seconds before i2c restart.

USE_POWER_DOWN

Enable or disable power down.

DEBOUNCING_POWER_DOWN_TIME_MS

Debounce power down ms.

USE_TIMER_1

Enable or disable timer1.

WDT_TIMER

Watchdog timer for periodically check microprocessor block states.

Possible value for WDT_TIMER are: WDTO_15MS, WDTO_30MS, WDTO_60MS, WDTO_120MS, WDTO_250MS, WDTO_500MS, WDTO_1S, WDTO_2S, WDTO_4S, WDTO_8S

TIMER1_INTERRUPT_TIME_MS

Value in milliseconds for generating timer1 interrupt: 100 - 8000 [ms].

TIMER1_TCNT1_VALUE

Timer1 timer overflow with 1024 prescaler.

TRANSACTION_TIMEOUT_MS

Timeout for command transaction.

file i2c-rain.h
#include "i2c-rain-config.h"#include <debug.h>#include <i2c_config.h>#include <avr/sleep.h>#include <avr/power.h>#include <avr/wdt.h>#include <i2c_utility.h>#include <rmap_utility.h>#include <sdcard_utility.h>#include <eeprom_utility.h>#include <Wire.h>#include <typedef.h>#include <registers-rain.h>#include <debug_config.h>#include <SdFat.h>#include <StreamUtils.h>#include <ArduinoLog.h>

Enums

enum state_t

Main loop finite state machine.

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enum tipping_bucket_state_t

Tipping bucket task finite state machine.

Values:

enumerator TIPPING_BUCKET_INIT

init task variables and wait half debounce time

enumerator TIPPING_BUCKET_READ

read rain tips from variable shared with tipping bucket interrupt, validate it re-reading tipping bucket signal and wait double debounce time

enumerator TIPPING_BUCKET_END

wait for the tipping bucket switch return open and performs end operations and deactivate task

enumerator TIPPING_BUCKET_WAIT_STATE

non-blocking waiting time

Functions

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_system(void)

Init system.

Return

void.

void init_buffers(void)

Init buffers.

Return

void.

void init_tasks(void)

Init tasks variable and state.

Return

void.

void init_pins(void)

Init hardware pins.

Return

void.

void init_wire(void)

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

Return

void.

void init_spi(void)

Init SPI library.

Return

void.

void init_rtc(void)

Init RTC module.

Return

void.

void init_sensors(void)

Create and setup sensors.

Return

void.

void print_configuration(void)

Print current configuration.

Return

void.

void load_configuration(void)

Load configuration from EEPROM.

Return

void.

void save_configuration(bool)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void commands(void)

Performs specific operations based on the received command.

Return

void.

void tests(void)

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

void reset_buffers(void)

Reset buffers to default value.

Return

void.

void exchange_buffers(void)

Exchange reader and writer pointer to buffer.

Return

void.

void init_logging()

Init logging system.

Return

void.

void tipping_bucket_task(void)

Tipping bucket task.

Return

void.

void command_task(void)

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void i2c_request_interrupt_handler(void)

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

void tipping_bucket_interrupt_handler(void)

Tipping bucket interrupt handler.

Return

void.

Variables

configuration_t configuration
readable_data_t readable_data_1
readable_data_t readable_data_2
readable_data_t *readable_data_read_ptr
readable_data_t *readable_data_write_ptr
readable_data_t *readable_data_temp_ptr
writable_data_t writable_data
writable_data_t *writable_data_ptr
uint8_t readable_data_address
uint8_t readable_data_length
uint8_t i2c_rx_data[I2C_MAX_DATA_LENGTH]
uint8_t lastcommand

command to be executed.

last command received.

uint8_t i2c_error
uint8_t i2c_time

Time in seconds from last I2C reset.

uint8_t ready_tasks_count
uint32_t awakened_event_occurred_time_ms
bool inside_transaction

Status of command transaction.

uint16_t transaction_time

Timer counter variable for compute command transaction timeout.

bool is_start
bool is_stop
bool is_test
bool is_started

Start command is active and measure is active.

uint32_t rain_tips_event_occurred_time_ms

System time (in millisecond) when rain tips occured.

rain_t rain

Rain data.

state_t state
tipping_bucket_state_t tipping_bucket_state

Current tipping bucket task state.

bool is_event_tipping_bucket

Enable or disable the Tipping Bucket task.

bool is_event_command_task
file i2c-rain.ino
#include "i2c-rain.h"

Functions

void setup()
void loop()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_buffers()

Init buffers.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_pins()

Init hardware pins.

Return

void.

void init_wire()

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

Return

void.

void init_spi()

Init SPI library.

Return

void.

void init_rtc()

Init RTC module.

Return

void.

void init_system()

Init system.

Return

void.

void init_sensors()

Create and setup sensors.

Return

void.

void print_configuration()

Print current configuration.

Return

void.

void save_configuration(bool is_default)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void load_configuration()

Load configuration from EEPROM.

Return

void.

void tipping_bucket_interrupt_handler()

Tipping bucket interrupt handler.

Return

void.

void i2c_request_interrupt_handler()

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

void tipping_bucket_task()

Tipping bucket task.

Return

void.

void exchange_buffers()

Exchange reader and writer pointer to buffer.

Return

void.

void reset_buffers()

Reset buffers to default value.

Return

void.

void command_task()

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void commands()

Performs specific operations based on the received command.

Return

void.

file i2c-th-config.h
#include <sensors_config.h>

Defines

MODULE_MAIN_VERSION

Module main version.

MODULE_MINOR_VERSION

Module minor version.

MODULE_CONFIGURATION_VERSION

Module version of compatibile configuration. If you change it, you have to reconfigure.

MODULE_TYPE

Type of module. It is defined in registers.h.

CONFIGURATION_DEFAULT_IS_ONESHOT

Oneshot mode for default.

CONFIGURATION_DEFAULT_I2C_ADDRESS

Default i2c address.

CONFIGURATION_DEFAULT_TEMPERATURE_ADDRESS

Default i2c temperature address.

CONFIGURATION_DEFAULT_HUMIDITY_ADDRESS

Default i2c humidity address.

CONFIGURATION_RESET_PIN

Input pin for reset configuration at startup.

SDCARD_CHIP_SELECT_PIN

Chip select for SDcard SPI.

SPI_SPEED

Clock speed for SPI and SDcard.

USE_POWER_DOWN

Enable or disable power down.

DEBOUNCING_POWER_DOWN_TIME_MS

Debounce power down ms.

USE_TIMER_1

Enable or disable timer1.

WDT_TIMER

Watchdog timer for periodically check microprocessor block states.

Possible value for WDT_TIMER are: WDTO_15MS, WDTO_30MS, WDTO_60MS, WDTO_120MS, WDTO_250MS, WDTO_500MS, WDTO_1S, WDTO_2S, WDTO_4S, WDTO_8S

SENSOR_ERROR_COUNT_MAX
OBSERVATIONS_MINUTES

How much minutes for calculate an observations by processing sampling. Tipically 1-10 minutes.

SENSORS_SAMPLE_TIME_MS

Milliseconds for sampling sensors: 2000 - 8000 [ms] setting it to 3980 ms we gain 20 ms every sample, 300 ms every observation, 4500 every report (15minutes)

SAMPLES_COUNT_MAX
OBSERVATION_SAMPLES_COUNT

Sample count in OBSERVATIONS_MINUTES minutes.

OBSERVATION_SAMPLE_ERROR_MAX

Maximum invalid sample count for generate a valid observations.

RMAP_REPORT_ERROR_MAX
RMAP_REPORT_VALID_MIN
TIMER1_INTERRUPT_TIME_MS

Value in milliseconds for generating timer1 interrupt.

TIMER1_TCNT1_VALUE

Timer1 timer overflow with 1024 prescaler.

TIMER1_VALUE_MAX_MS

Maximum timer1 counter value for timed tasks.

SENSORS_RETRY_COUNT_MAX

Maximum number of retry for sensors reading.

SENSORS_RETRY_DELAY_MS

Waiting for reading between two attempts.

TRANSACTION_TIMEOUT_MS

Timeout for command transaction.

file i2c-th.h
#include "i2c-th-config.h"#include <debug.h>#include <i2c_config.h>#include <avr/sleep.h>#include <avr/power.h>#include <avr/wdt.h>#include <i2c_utility.h>#include <rmap_utility.h>#include <sdcard_utility.h>#include <eeprom_utility.h>#include <Wire.h>#include <TimeLib.h>#include <typedef.h>#include <registers-th.h>#include <SensorDriver.h>#include <debug_config.h>#include <SdFat.h>#include <StreamUtils.h>#include <ArduinoLog.h>

Enums

enum state_t

Main loop finite state machine.

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enum sensors_reading_state_t

Sensors reading task finite state machine.

Values:

enumerator SENSORS_READING_INIT

init task variables

enumerator SENSORS_READING_SETUP_CHECK

check errors and if required try a sensor setup

enumerator SENSORS_READING_PREPARE

prepare sensor

enumerator SENSORS_READING_IS_PREPARED

check if the sensor has been prepared

enumerator SENSORS_READING_GET

read and get values from sensor

enumerator SENSORS_READING_IS_GETTED

check if the sensor has been readed

enumerator SENSORS_READING_READ

intermediate state (future implementation...)

enumerator SENSORS_READING_NEXT

go to next sensor

enumerator SENSORS_READING_END

performs end operations and deactivate task

enumerator SENSORS_READING_WAIT_STATE

non-blocking waiting time

enumerator SENSORS_READING_INIT

init task variables

enumerator SENSORS_SETUP_CHECK

check errors and if required try a sensor setup

enumerator SENSORS_READING_PREPARE

prepare sensor

enumerator SENSORS_READING_IS_PREPARED

check if the sensor has been prepared

enumerator SENSORS_READING_GET

read and get values from sensor

enumerator SENSORS_READING_IS_GETTED

check if the sensor has been readed

enumerator SENSORS_READING_READ

intermediate state (future implementation...)

enumerator SENSORS_READING_NEXT

go to next sensor

enumerator SENSORS_READING_END

performs end operations and deactivate task

enumerator SENSORS_READING_WAIT_STATE

non-blocking waiting time

enumerator SENSORS_READING_INIT
enumerator SENSORS_READING_PREPARE
enumerator SENSORS_READING_IS_PREPARED
enumerator SENSORS_READING_GET
enumerator SENSORS_READING_IS_GETTED
enumerator SENSORS_READING_READ
enumerator SENSORS_READING_NEXT
enumerator SENSORS_READING_END
enumerator SENSORS_READING_WAIT_STATE

Functions

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_system(void)

Init system.

Return

void.

void init_buffers(void)

Init buffers.

Return

void.

void init_tasks(void)

Init tasks variable and state.

Return

void.

void init_pins(void)

Init hardware pins.

Return

void.

void init_wire(void)

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

Return

void.

void init_spi(void)

Init SPI library.

Return

void.

void init_rtc(void)

Init RTC module.

Return

void.

void init_sensors(void)

Create and setup sensors.

Return

void.

void print_configuration(void)

Print current configuration.

Return

void.

void load_configuration(void)

Load configuration from EEPROM.

Return

void.

void save_configuration(bool)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void commands(void)

Performs specific operations based on the received command.

Return

void.

void reset_samples_buffer(void)

Reset samples buffers to default value.

Return

void.

void reset_observations_buffer(void)

Reset observations buffers to default value.

Return

void.

void exchange_buffers(void)

Exchange reader and writer pointer to buffer.

Return

void.

void samples_processing(bool is_force_processing)

Main routine for processing the samples to calculate an observation.

Return

void.

Parameters
  • is_force_processing: if is true, force the calculation of the observation provided there is a minimum number of samples.

void init_logging()

Init logging system.

Return

void.

void sensors_reading_task(void)

Sensors reading Task. Read data from sensors.

Return

void.

void command_task(void)

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void i2c_request_interrupt_handler(void)

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(void)

Variables

configuration_t configuration
readable_data_t readable_data_1
readable_data_t readable_data_2
readable_data_t *readable_data_read_ptr
readable_data_t *readable_data_write_ptr
readable_data_t *readable_data_temp_ptr
writable_data_t writable_data
writable_data_t *writable_data_ptr
uint8_t readable_data_address
uint8_t readable_data_length
uint8_t i2c_rx_data[I2C_MAX_DATA_LENGTH]
uint8_t lastcommand
uint8_t i2c_error
uint8_t ready_tasks_count
uint32_t awakened_event_occurred_time_ms
bool inside_transaction
uint16_t transaction_time
bool is_start
bool is_stop
bool is_test_read

Received command is in continuous mode.

SensorDriver *sensors[SENSORS_MAX]

SensorDriver buffer for storing sensors parameter.

SensorDriver array structure.

uint8_t sensors_count

Configured sensors number.

number of created sensors drivers.

sample_t temperature_samples

Temperature samples.

sample_t humidity_samples

Humidity samples.

uint16_t timer_counter
state_t state
sensors_reading_state_t sensors_reading_state

Current sensors reading task state.

Sensors reading task state.

bool is_event_sensors_reading

Enable or disable the Sensors reading task.

bool is_event_command_task
file i2c-th.ino
#include "i2c-th.h"

Functions

void setup()
void loop()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_buffers()

Init buffers.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_pins()

Init hardware pins.

Return

void.

void init_wire()

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

Return

void.

void init_spi()

Init SPI library.

Return

void.

void init_rtc()

Init RTC module.

Return

void.

void init_system()

Init system.

Return

void.

void print_configuration()

Print current configuration.

Return

void.

void save_configuration(bool is_default)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void load_configuration()

Load configuration from EEPROM.

Return

void.

void init_sensors()

Create and setup sensors.

Return

void.

ISR(TIMER1_OVF_vect)
void i2c_request_interrupt_handler()

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

void sensors_reading_task()

Sensors reading Task. Read data from sensors.

Return

void.

template<typename buffer_g, typename length_v, typename value_v>
value_v bufferRead(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
value_v bufferReadBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v>
void bufferPtrResetBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void bufferReset(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v>
void incrementBuffer(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void addValue(buffer_g *buffer, length_v length, value_v value)
void make_report(bool init = false)
void samples_processing()

Main routine for processing the samples to calculate an observation.

Return

void.

void exchange_buffers()

Exchange reader and writer pointer to buffer.

Return

void.

void reset_samples_buffer()

Reset samples buffers to default value.

Return

void.

void reset_data(volatile readable_data_t *ptr)
void command_task()

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void copy_buffers()
void commands()

Performs specific operations based on the received command.

Return

void.

file i2c-thr-config.h
#include <sensors_config.h>

Defines

MODULE_MAIN_VERSION

Module main version.

MODULE_MINOR_VERSION

Module minor version.

MODULE_CONFIGURATION_VERSION

Module version of compatibile configuration. If you change it, you have to reconfigure.

CONFIGURATION_DEFAULT_TEMPERATURE_ADDRESS

Default i2c temperature address.

CONFIGURATION_DEFAULT_HUMIDITY_ADDRESS

Default i2c humidity address.

CONFIGURATION_RESET_PIN

Input pin for reset configuration at startup.

I2C_MAX_TIME

Max i2c time in seconds before i2c restart.

USE_POWER_DOWN

Enable or disable power down.

DEBOUNCING_POWER_DOWN_TIME_MS

Debounce power down ms.

USE_TIMER_1

Enable or disable timer1.

WDT_TIMER

Watchdog timer for periodically check microprocessor block states.

Possible value for WDT_TIMER are: WDTO_15MS, WDTO_30MS, WDTO_60MS, WDTO_120MS, WDTO_250MS, WDTO_500MS, WDTO_1S, WDTO_2S, WDTO_4S, WDTO_8S

TIMER1_INTERRUPT_TIME_MS

Value in milliseconds for generating timer1 interrupt: from 100 to TIMER1_OVERFLOW_TIME_MS.

TIMER1_TCNT1_VALUE

Timer1 timer overflow with 1024 prescaler at 8 MHz.

TIMER_COUNTER_VALUE_MAX_MS

Maximum timer1 counter value for timed tasks.

SDCARD_CHIP_SELECT_PIN

Chip select for SDcard SPI.

SPI_SPEED

Clock speed for SPI and SDcard.

SENSOR_ERROR_COUNT_MAX
SENSORS_SAMPLE_TIME_MS

Milliseconds for sampling sensors: 100 - 60000 [ms] must be integer multiple of TIMER1_INTERRUPT_TIME_MS !!!

OBSERVATION_SAMPLES_COUNT_MIN

Sample count minimum in OBSERVATIONS_MINUTES minutes.

OBSERVATION_SAMPLES_COUNT_MAX

Sample count maximum in OBSERVATIONS_MINUTES minutes.

RMAP_REPORT_SAMPLE_VALID
RMAP_REPORT_SAMPLES_COUNT
OBSERVATION_SAMPLE_ERROR_MAX

Maximum invalid sample count for generate a valid observations.

OBSERVATION_SAMPLE_VALID_MIN
RMAP_REPORT_SAMPLE_ERROR_MAX
RMAP_REPORT_SAMPLE_VALID_MIN
RMAP_REPORT_ERROR_MAX
RMAP_REPORT_VALID_MIN
SAMPLES_COUNT
RMAP_REPORT_INTERVAL_S
USE_SENSORS_COUNT

Sensors count.

USE_SENSOR_DRIVER_COUNT
SENSORS_RETRY_COUNT_MAX

Maximum number of retry for sensors reading.

SENSORS_RETRY_DELAY_MS

Waiting for reading between two attempts.

file i2c-thr.h
#include "i2c-thr-config.h"#include <debug.h>#include <i2c_config.h>#include <avr/sleep.h>#include <avr/power.h>#include <avr/wdt.h>#include <i2c_utility.h>#include <rmap_utility.h>#include <sdcard_utility.h>#include <eeprom_utility.h>#include <Wire.h>#include <TimeLib.h>#include <typedef.h>#include <SensorDriver.h>#include <debug_config.h>#include <SdFat.h>#include <StreamUtils.h>#include <ArduinoLog.h>

Enums

enum state_t

Main loop finite state machine.

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

Functions

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_system(void)

Init system.

Return

void.

void init_buffers(void)

Init buffers.

Return

void.

void init_tasks(void)

Init tasks variable and state.

Return

void.

void init_pins(void)

Init hardware pins.

Return

void.

void init_wire(void)

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

Return

void.

void init_spi(void)

Init SPI library.

Return

void.

void init_rtc(void)

Init RTC module.

Return

void.

void init_sensors(void)

Create and setup sensors.

Return

void.

void print_configuration(void)

Print current configuration.

Return

void.

void load_configuration(void)

Load configuration from EEPROM.

Return

void.

void save_configuration(bool)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void commands(void)

Performs specific operations based on the received command.

Return

void.

void tests(void)

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

void reset_samples_buffer(void)

Reset samples buffers to default value.

Return

void.

void reset_report_buffer(void)
void reset_buffer(void)
void exchange_buffers(void)

Exchange reader and writer pointer to buffer.

Return

void.

template<typename buffer_g, typename length_v, typename value_v>
value_v bufferRead(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
value_v bufferReadBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename value_v>
void bufferWrite(buffer_g *buffer, value_v value)
template<typename buffer_g>
void bufferPtrReset(buffer_g *buffer)
template<typename buffer_g, typename length_v>
void bufferPtrResetBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v>
void incrementBuffer(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void bufferReset(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void addValue(buffer_g *buffer, length_v length, value_v value)
void samples_processing()

Main routine for processing the samples to calculate an observation.

Return

void.

void make_report()
void copy_oneshot_data()
void command_task(void)

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void i2c_request_interrupt_handler(void)

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(void)

Variables

configuration_t configuration
readable_data_t readable_data_1
readable_data_t readable_data_2
readable_data_t *readable_data_read_ptr
readable_data_t *readable_data_write_ptr
readable_data_t *readable_data_temp_ptr
writable_data_t writable_data
writable_data_t *writable_data_ptr
uint8_t readable_data_address
uint8_t readable_data_length
uint8_t i2c_rx_data[I2C_MAX_DATA_LENGTH]
uint8_t i2c_error
uint8_t i2c_time
uint8_t ready_tasks_count
uint32_t awakened_event_occurred_time_ms
bool is_start
bool is_stop
bool is_oneshot
bool is_continuous
uint16_t timer_counter_ms
SensorDriver *sensors[SENSORS_MAX]
uint8_t sensors_count
state_t state
bool is_event_command_task
file i2c-thr.ino
#include "i2c-thr.h"

Functions

void setup()
void loop()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_buffers()

Init buffers.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_pins()

Init hardware pins.

Return

void.

void init_wire()

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

Return

void.

void init_spi()

Init SPI library.

Return

void.

void init_rtc()

Init RTC module.

Return

void.

void init_system()

Init system.

Return

void.

void print_configuration()

Print current configuration.

Return

void.

void save_configuration(bool is_default)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void load_configuration()

Load configuration from EEPROM.

Return

void.

void init_sensors()

Create and setup sensors.

Return

void.

ISR(TIMER1_OVF_vect)
void i2c_request_interrupt_handler()

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

copy_oneshot_data()
void samples_processing()

Main routine for processing the samples to calculate an observation.

Return

void.

void exchange_buffers()

Exchange reader and writer pointer to buffer.

Return

void.

void reset_samples_buffer()

Reset samples buffers to default value.

Return

void.

void reset_buffer()
void reset_report_buffer()
void command_task()

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void commands()

Performs specific operations based on the received command.

Return

void.

void tests()

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

file i2c-wind-config.h
#include <sensors_config.h>

Defines

MODULE_VERSION

Module version.

MODULE_TYPE

Type of module. It is defined in registers.h.

CONFIGURATION_DEFAULT_IS_ONESHOT

Oneshot mode for default.

CONFIGURATION_DEFAULT_IS_CONTINUOUS

Continuous mode for default.

CONFIGURATION_DEFAULT_I2C_ADDRESS

Default i2c address.

CONFIGURATION_RESET_PIN

Input pin for reset configuration at startup.

USE_POWER_DOWN

Enable or disable power down.

DEBOUNCING_POWER_DOWN_TIME_MS

Debounce power down ms.

USE_TIMER_1

Enable or disable timer1.

SDCARD_CHIP_SELECT_PIN

Chip select for SDcard SPI.

SPI_SPEED

Clock speed for SPI and SDcard.

WDT_TIMER

Watchdog timer for periodically check microprocessor block states.

Possible value for WDT_TIMER are: WDTO_15MS, WDTO_30MS, WDTO_60MS, WDTO_120MS, WDTO_250MS, WDTO_500MS, WDTO_1S, WDTO_2S, WDTO_4S, WDTO_8S

OBSERVATIONS_MINUTES
SENSORS_SAMPLE_TIME_MS
OBSERVATION_SAMPLES_COUNT_MIN

Sample count minimum in OBSERVATIONS_MINUTES minutes.

OBSERVATION_SAMPLES_COUNT_MAX

Sample count maximum in OBSERVATIONS_MINUTES minutes.

RMAP_REPORT_SAMPLE_VALID
RMAP_REPORT_SAMPLES_COUNT
WMO_REPORT_SAMPLES_COUNT
OBSERVATION_SAMPLE_ERROR_MAX

Maximum invalid sample count for generate a valid observations.

OBSERVATION_SAMPLE_VALID_MIN
RMAP_REPORT_SAMPLE_ERROR_MAX
WMO_REPORT_SAMPLE_ERROR_MAX
RMAP_REPORT_SAMPLE_VALID_MIN
WMO_REPORT_SAMPLE_VALID_MIN
RMAP_REPORT_ERROR_MAX
RMAP_REPORT_VALID_MIN
SAMPLES_COUNT
WIND_CLASS_1_MAX
WIND_CLASS_2_MAX
WIND_CLASS_3_MAX
WIND_CLASS_4_MAX
WIND_CLASS_5_MAX
USE_SENSORS_COUNT

Sensors count.

TIMER1_TCNT1_VALUE

Timer1 timer overflow with 1024 prescaler at 16 MHz.

TIMER_COUNTER_VALUE_MAX_MS

Maximum timer1 counter value for timed tasks.

TIMER_COUNTER_VALUE_MAX_S
WIND_SETUP_DELAY_MS

Reading delay.

WIND_POWER_ON_DELAY_MS
WIND_READ_DELAY_MS

Reading delay.

WIND_RETRY_DELAY_MS
WIND_READ_COUNT

number of read.

WIND_RETRY_MAX
file i2c-wind.h
#include "i2c-wind-config.h"#include <debug.h>#include <i2c_config.h>#include <avr/sleep.h>#include <avr/power.h>#include <avr/wdt.h>#include <i2c_utility.h>#include <rmap_utility.h>#include <eeprom_utility.h>#include <Wire.h>#include <TimeLib.h>#include <typedef.h>#include <registers-wind.h>#include <debug_config.h>#include <SdFat.h>#include <StreamUtils.h>#include <ArduinoLog.h>

Enums

enum state_t

Main loop finite state machine.

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enum wind_state_t

WIND setup and reading task finite state machine.

Values:

enumerator WIND_INIT
enumerator WIND_READING
enumerator WIND_ELABORATE
enumerator WIND_END

performs end operations and deactivate task

enumerator WIND_WAIT_STATE

non-blocking waiting time

Functions

void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_system(void)

Init system.

Return

void.

void init_buffers(void)

Init buffers.

Return

void.

void init_tasks(void)

Init tasks variable and state.

Return

void.

void init_pins(void)

Init hardware pins.

Return

void.

void init_wire(void)

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

Return

void.

void init_spi(void)

Init SPI library.

Return

void.

void init_rtc(void)

Init RTC module.

Return

void.

void init_sensors(void)

Create and setup sensors.

Return

void.

void print_configuration(void)

Print current configuration.

Return

void.

void load_configuration(void)

Load configuration from EEPROM.

Return

void.

void save_configuration(bool)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void commands(void)

Performs specific operations based on the received command.

Return

void.

void tests(void)

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

void reset_samples_buffer(void)

Reset samples buffers to default value.

Return

void.

void reset_report_buffer(void)
void exchange_buffers(void)

Exchange reader and writer pointer to buffer.

Return

void.

template<typename buffer_g, typename length_v, typename value_v>
value_v bufferRead(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
value_v bufferReadBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename value_v>
void bufferWrite(buffer_g *buffer, value_v value)
template<typename buffer_g>
void bufferPtrReset(buffer_g *buffer)
template<typename buffer_g, typename length_v>
void bufferPtrResetBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v>
void incrementBuffer(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void bufferReset(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void addValue(buffer_g *buffer, length_v length, value_v value)
void samples_processing()

Main routine for processing the samples to calculate an observation.

Return

void.

void make_report()
void getSDFromUV(float, float, float*, float*)
bool windsonic_interpreter(float *speed, float *direction)
void wind_task(void)

Wind setup and reading Task. Read data from WIND.

Return

void.

void command_task(void)

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void i2c_request_interrupt_handler(void)

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(void)

Variables

configuration_t configuration
readable_data_t readable_data_1
readable_data_t readable_data_2
readable_data_t *readable_data_read_ptr
readable_data_t *readable_data_write_ptr
readable_data_t *readable_data_temp_ptr
writable_data_t writable_data
writable_data_t *writable_data_ptr
uint8_t readable_data_address
uint8_t readable_data_length
uint8_t i2c_rx_data[I2C_MAX_DATA_LENGTH]
uint8_t i2c_error
uint8_t ready_tasks_count
uint32_t awakened_event_occurred_time_ms
bool is_start
bool is_stop
bool is_oneshot
bool is_continuous
bool is_test
uint16_t timer_counter_ms
uint16_t timer_counter_s
state_t state
wind_state_t wind_state

Current sensors reading task state.

uint16_t uart_rx_buffer_length
uint8_t uart_rx_buffer[UART_RX_BUFFER_LENGTH]
bool is_event_wind_task

Enable or disable the WIND task.

bool is_event_command_task
file i2c-wind.ino
#include "i2c-wind.h"

Functions

void setup()
void loop()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_buffers()

Init buffers.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_pins()

Init hardware pins.

Return

void.

void init_wire()

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

Return

void.

void init_spi()

Init SPI library.

Return

void.

void init_rtc()

Init RTC module.

Return

void.

void init_system()

Init system.

Return

void.

void print_configuration()

Print current configuration.

Return

void.

void save_configuration(bool is_default)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void load_configuration()

Load configuration from EEPROM.

Return

void.

void init_sensors()

Create and setup sensors.

Return

void.

ISR(TIMER1_OVF_vect)
void i2c_request_interrupt_handler()

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

template<typename buffer_g, typename length_v, typename value_v>
value_v bufferRead(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
value_v bufferReadBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename value_v>
void bufferWrite(buffer_g *buffer, value_v value)
template<typename buffer_g>
void bufferPtrReset(buffer_g *buffer)
template<typename buffer_g, typename length_v>
void bufferPtrResetBack(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v>
void incrementBuffer(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void bufferReset(buffer_g *buffer, length_v length)
template<typename buffer_g, typename length_v, typename value_v>
void addValue(buffer_g *buffer, length_v length, value_v value)
void getSDFromUV(float u, float v, float *speed, float *direction)
void make_report()
void samples_processing()

Main routine for processing the samples to calculate an observation.

Return

void.

void exchange_buffers()

Exchange reader and writer pointer to buffer.

Return

void.

void reset_samples_buffer()

Reset samples buffers to default value.

Return

void.

void reset_report_buffer()
void command_task()

Command Task. Execute the command received on i2c bus by reading i2c received data buffer.

Execute the command received on i2c bus by reading i2c received data buffer.

Return

void.

void commands()

Performs specific operations based on the received command.

Return

void.

void tests()

Performs specific operations based on the received command.

Performs tests operations based on the received command.

Return

void.

file SdFormatter.ino
#include "SdFat.h"#include "sdios.h"

Defines

SDCARD_SS_PIN
SPI_CLOCK
SD_CONFIG
sdError(msg)

Functions

ArduinoOutStream cout(Serial)
void sdErrorHalt()
void clearSerialInput()
void eraseCard()
void formatCard()
void printConfig(SdSpiConfig config)
bool cidDmp()
bool csdDmp()
void errorPrint()
bool mbrDmp()
void dmpVol()
void printCardType()
void printConfig(SdioConfig config)
void setup()
void loop()

Variables

const int8_t DISABLE_CS_PIN = -1
const uint8_t SD_CS_PIN = SDCARD_SS_PIN
uint32_t cardSectorCount = 0
uint8_t sectorBuffer[512]
SdCardFactory cardFactory
SdCard *m_card = nullptr
SdFs sd
cid_t m_cid
csd_t m_csd
uint32_t m_eraseSize
uint32_t m_ocr
uint32_t const ERASE_SIZE = 262144L
file sensor_config.ino
#include "Wire.h"#include <Arduino.h>#include "registers-wind.h"#include "registers-th.h"#include "registers-rain.h"#include <i2c_utility.h>

Functions

void scanI2CBus(byte from_addr, byte to_addr, void (*callback)(byte address, byte result))
void scanFunc(byte addr, byte result)
char getCommand()
void displayHelp()
void setup()
void loop()

Variables

byte start_address = 1
byte end_address = 127
const char version[] = "1.1"
file constantdata_config.h

Defines

CONSTANTDATA_BTABLE_LENGTH

Maximum lenght of btable code plus terminator that describe one constant data.

CONSTANTDATA_VALUE_LENGTH

Maximum lenght of value plus terminator for one constant data.

file ethernet_config.h

Defines

ETHERNET_DEFAULT_DHCP_ENABLE

Default option for enable or disable DHCP protocol with ethernet.

ETHERNET_DEFAULT_MAC

Default mac address for ethernet device.

ETHERNET_DEFAULT_IP

Default ip address for ethernet device.

ETHERNET_DEFAULT_NETMASK

Default netmask for ethernet device.

ETHERNET_DEFAULT_GATEWAY

Default gateway for ethernet device.

ETHERNET_DEFAULT_PRIMARY_DNS

Default primary dns for ethernet device.

ETHERNET_DEFAULT_LOCAL_UDP_PORT

Default local udp port for ethernet device.

ETHERNET_ATTEMPT_MS

Set next ethernet library attempt delay in milliseconds after a failure.

ETHERNET_RETRY_TIME_MS

Set next ethernet task attempt delay in milliseconds after a failure.

ETHERNET_RETRY_COUNT

Maximum number of retry for ethernet task.

ETHERNET_MQTT_TIMEOUT_MS

MQTT timeout in milliseconds for ethernet device.

ETHERNET_MAC_LENGTH

Length in bytes for mac address.

ETHERNET_IP_LENGTH

Length in bytes for ip address.

file ethernet_config.h

Defines

ETHERNET_DEFAULT_DHCP_ENABLE

Default option for enable or disable DHCP protocol with ethernet.

ETHERNET_DEFAULT_MAC

Default mac address for ethernet device.

ETHERNET_DEFAULT_IP

Default ip address for ethernet device.

ETHERNET_DEFAULT_NETMASK

Default netmask for ethernet device.

ETHERNET_DEFAULT_GATEWAY

Default gateway for ethernet device.

ETHERNET_DEFAULT_PRIMARY_DNS

Default primary dns for ethernet device.

ETHERNET_DEFAULT_LOCAL_UDP_PORT

Default local udp port for ethernet device.

ETHERNET_ATTEMPT_MS

Set next ethernet library attempt delay in milliseconds after a failure.

ETHERNET_RETRY_TIME_MS

Set next ethernet task attempt delay in milliseconds after a failure.

ETHERNET_RETRY_COUNT

Maximum number of retry for ethernet task.

ETHERNET_MQTT_TIMEOUT_MS

MQTT timeout in milliseconds for ethernet device.

ETHERNET_MAC_LENGTH

Length in bytes for mac address.

ETHERNET_IP_LENGTH

Length in bytes for ip address.

file gsm_config.h

Defines

GSM_APN_TIM

APN for TIM.

GSM_APN_WIND

APN for WIND.

GSM_APN_VODAFONE

APN for VODAFONE.

GSM_DEFAULT_APN

Default GSM APN.

GSM_DEFAULT_USERNAME

Default GSM username.

GSM_DEFAULT_PASSWORD

Default GSM password.

GSM_APN_LENGTH

Length in bytes for apn.

GSM_USERNAME_LENGTH

Length in bytes for username.

GSM_PASSWORD_LENGTH

Length in bytes for password.

USE_SIM_800C

Enable if you want to use SIM800C.

USE_SIM_800L

Enable if you want to use SIM800L.

file gsm_config.h

Defines

GSM_APN_TIM

APN for TIM.

GSM_APN_WIND

APN for WIND.

GSM_APN_VODAFONE

APN for VODAFONE.

GSM_DEFAULT_APN

Default GSM APN.

GSM_DEFAULT_USERNAME

Default GSM username.

GSM_DEFAULT_PASSWORD

Default GSM password.

GSM_APN_LENGTH

Length in bytes for apn.

GSM_USERNAME_LENGTH

Length in bytes for username.

GSM_PASSWORD_LENGTH

Length in bytes for password.

USE_SIM_800C

Enable if you want to use SIM800C.

USE_SIM_800L

Enable if you want to use SIM800L.

file lcd_config.h

Defines

LCD_I2C_ADDRESS

LCD i2c address.

LCD_I2C_SECONDARY_ADDRESS

Try this I2C address for LCD if LCD_I2C_ADDRESS fail.

LCD_COLUMNS

Default LCD columns number.

LCD_ROWS

Default LCD rows number.

file lcd_config.h

Defines

LCD_I2C_ADDRESS

Default LCD i2c address.

LCD_COLUMNS

Default LCD columns number.

LCD_ROWS

Default LCD rows number.

file ntp_config.h

Defines

NTP_SERVER_LENGTH

Length in bytes for ntp server data buffer.

NTP_DEFAULT_SERVER

Default NTP server.

file ntp_config.h

Defines

NTP_SERVER_LENGTH

Length in bytes for ntp server data buffer.

NTP_DEFAULT_SERVER

Default NTP server.

file stima-config.h
#include <sensors_config.h>#include <constantdata_config.h>

Defines

MODULE_MAIN_VERSION

Module main version.

MODULE_MINOR_VERSION

Module minor version.

MODULE_CONFIGURATION_VERSION

Module version of compatibile configuration. If you change it, you have to reconfigure.

MODULE_TYPE

Type of module. It is defined in registers.h.

USE_MQTT

MQTT support.

USE_LCD

LCD support.

USE_SDCARD

SD-Card support.

USE_RTC

RTC support.

USE_TIMER_1

Timer 1 support instead of RTC.

USE_RPC_METHOD_CONFIGURE

RPC method for station configuration.

USE_RPC_METHOD_PREPARE

RPC method for prepare sensors.

USE_RPC_METHOD_PREPANDGET

RPC method for prepare and get data from sensors.

USE_RPC_METHOD_GETJSON

RPC method for get sensor's data.

USE_RPC_METHOD_REBOOT

RPC method for reboot station.

USE_RPC_METHOD_RECOVERY

RPC method for recovery data written on SD card from station.

CONFIGURATION_DEFAULT_TH_ADDRESS

Default i2c i2c-th address.

CONFIGURATION_DEFAULT_RAIN_ADDRESS

Default i2c i2c-rain address.

CONFIGURATION_RESET_PIN

Input pin for reset configuration at startup.

CONFIGURATION_DEFAULT_NTP_SERVER

Default ntp server.

CONFIGURATION_DEFAULT_ETHERNET_DHCP_ENABLE

Default DHCP status.

CONFIGURATION_DEFAULT_ETHERNET_MAC

Default mac address.

CONFIGURATION_DEFAULT_ETHERNET_IP

Default ip address.

CONFIGURATION_DEFAULT_ETHERNET_NETMASK

Default netmask address.

CONFIGURATION_DEFAULT_ETHERNET_GATEWAY

Default gateway address.

CONFIGURATION_DEFAULT_ETHERNET_PRIMARY_DNS

Default primary dns address.

SENSOR_ERROR_COUNT_MAX
USE_POWER_DOWN

Enable or disable power down.

DEBOUNCING_POWER_DOWN_TIME_MS

Debounce power down ms.

W5500_CHIP_SELECT_PIN

Chip select pin for Wiznet W5500 ethernet module.

WDT_TIMER

Watchdog timer for periodically check microprocessor block states.

Possible value for WDT_TIMER are: WDTO_15MS, WDTO_30MS, WDTO_60MS, WDTO_120MS, WDTO_250MS, WDTO_500MS, WDTO_1S, WDTO_2S, WDTO_4S, WDTO_8S

RTC_FREQUENCY

Real time clock frequency for generating interrupt for awaken the microprocessor and execute timed tasks.

RTC_INTERRUPT_PIN

Interrupt pin for rtc.

TIMER1_INTERRUPT_TIME_MS

Value in milliseconds for generating timer1 interrupt.

TIMER1_TCNT1_VALUE

Timer1 timer overflow with 1024 prescaler.

USE_CONSTANTDATA_COUNT

Constantdata count.

SENSORS_RETRY_COUNT_MAX

Maximum number of retry for sensors reading.

SENSORS_RETRY_DELAY_MS

Waiting for reading between two attempts.

SENSORS_READING_RETRY_COUNT_MAX

Maximum number of retry for sensors reading task with i2c error.

SENSORS_TESTING_DELAY_S
DATA_PROCESSING_RETRY_COUNT_MAX

Maximum number of retry for processing acquired data.

DATA_PROCESSING_RETRY_DELAY_MS

Wait time between two attempts.

DATA_SAVING_RETRY_COUNT_MAX

Maximum number of retry for saving data on SD-Card.

DATA_SAVING_DELAY_MS

Wait time between two attempts.

MQTT_RETRY_COUNT_MAX

Maximum number of retry for doing mqtt operations.

MQTT_DELAY_MS

Wait time between two attempts.

IP_STACK_TIMEOUT_MS

IPStack timeout.

SUPERVISOR_CONNECTION_RETRY_COUNT_MAX

Maximum number of retry for doing supervisor operations.

SUPERVISOR_CONNECTION_TIMEOUT_MS

Timeout for connecting.

NTP_RETRY_COUNT_MAX

Maximum number of retry for doing ntp operations.

NTP_RETRY_DELAY_MS

Wait time between two NTP attempts.

NTP_TIME_FOR_RESYNC_S

Maximum seconds for resync time over ntp.

NTP_MAX_DIFF_VALID_TIME_S
LCD_TIME_FOR_REINITIALIZE_S

Maximum seconds for reinitialize LCD.

ETHERNET_RETRY_COUNT_MAX

Maximum number of retry for doing ethernet operations.

ETHERNET_RETRY_DELAY_MS

Wait time between two attempts.

DATE_TIME_STRING_LENGTH

Length of datetime string %04u-%02u-%02uT%02u:%02u:%02u.

file stima.h
#include <stima_module.h>#include "stima-config.h"#include <typedef.h>#include <registers.h>#include <debug.h>#include <ArduinoLog.h>#include <StreamUtils.h>#include <i2c_config.h>#include <json_config.h>#include <ntp_config.h>#include <SPI.h>#include <Wire.h>#include <pcf8563.h>#include <rmap_utility.h>#include <TimeLib.h>#include <SensorDriver.h>#include <eeprom_utility.h>#include <i2c_utility.h>#include <arduinoJsonRPC.h>#include <ethernet_config.h>#include <Ethernet2.h>#include <IWatchdog.h>#include "STM32LowPower.h"#include <STM32RTC.h>#include <rtc.h>

Defines

WDTO_1S
SLEEP_MODE_PWR_DOWN

Enums

enum state_t

Main loop finite state machine.

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enum supervisor_state_t

Supervisor task finite state machine.

Values:

enumerator SUPERVISOR_INIT

init task variables

enumerator SUPERVISOR_CONNECTION_LEVEL_TASK

enable hardware related tasks for doing connection

enumerator SUPERVISOR_WAIT_CONNECTION_LEVEL_TASK

enable hardware related tasks for doing connection

enumerator SUPERVISOR_TIME_LEVEL_TASK

enable time task for sync time with ntp server

enumerator SUPERVISOR_MANAGE_LEVEL_TASK

enable tasks for manage data (mqtt)

enumerator SUPERVISOR_TEST_SDCARD
enumerator SUPERVISOR_END

performs end operations and deactivate task

enumerator SUPERVISOR_WAIT_STATE

non-blocking waiting time

enum ethernet_state_t

Ethernet task finite state machine.

Values:

enumerator ETHERNET_INIT

init task variables

enumerator ETHERNET_CONNECT

begin ethernet operations

enumerator ETHERNET_OPEN_UDP_SOCKET

open udp socket

enumerator ETHERNET_END

performs end operations and deactivate task

enumerator ETHERNET_WAIT_STATE

non-blocking waiting time

enum sensors_reading_state_t

Sensors reading task finite state machine.

Values:

enumerator SENSORS_READING_INIT

init task variables

enumerator SENSORS_READING_SETUP_CHECK

check errors and if required try a sensor setup

enumerator SENSORS_READING_PREPARE

prepare sensor

enumerator SENSORS_READING_IS_PREPARED

check if the sensor has been prepared

enumerator SENSORS_READING_GET

read and get values from sensor

enumerator SENSORS_READING_IS_GETTED

check if the sensor has been readed

enumerator SENSORS_READING_READ

intermediate state (future implementation...)

enumerator SENSORS_READING_NEXT

go to next sensor

enumerator SENSORS_READING_END

performs end operations and deactivate task

enumerator SENSORS_READING_WAIT_STATE

non-blocking waiting time

enumerator SENSORS_READING_INIT

init task variables

enumerator SENSORS_SETUP_CHECK

check errors and if required try a sensor setup

enumerator SENSORS_READING_PREPARE

prepare sensor

enumerator SENSORS_READING_IS_PREPARED

check if the sensor has been prepared

enumerator SENSORS_READING_GET

read and get values from sensor

enumerator SENSORS_READING_IS_GETTED

check if the sensor has been readed

enumerator SENSORS_READING_READ

intermediate state (future implementation...)

enumerator SENSORS_READING_NEXT

go to next sensor

enumerator SENSORS_READING_END

performs end operations and deactivate task

enumerator SENSORS_READING_WAIT_STATE

non-blocking waiting time

enumerator SENSORS_READING_INIT
enumerator SENSORS_READING_PREPARE
enumerator SENSORS_READING_IS_PREPARED
enumerator SENSORS_READING_GET
enumerator SENSORS_READING_IS_GETTED
enumerator SENSORS_READING_READ
enumerator SENSORS_READING_NEXT
enumerator SENSORS_READING_END
enumerator SENSORS_READING_WAIT_STATE
enum time_state_t

Time task finite state machine.

Values:

enumerator TIME_INIT

init task variables

enumerator TIME_SEND_ONLINE_REQUEST

send ntp request

enumerator TIME_WAIT_ONLINE_RESPONSE

wait ntp response

enumerator TIME_SET_SYNC_NTP_PROVIDER

set ntp time

enumerator TIME_SET_SYNC_RTC_PROVIDER

set rtc time

enumerator TIME_END

performs end operations and deactivate task

enumerator TIME_WAIT_STATE

non-blocking waiting time

enum rpc_state_t

RPC task finite state machine.

Values:

enumerator RPC_INIT

init task variables

enumerator RPC_EXECUTE

execute function loop

enumerator RPC_END

performs end operations

Functions

JsonRPC streamRpc (false)

Remote Procedure Call object.

void realreboot()
time_t getSystemTime()
void init_logging(void)

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_system(void)

Init system.

Return

void.

void init_rpc(void)

Register RPC.

Return

void.

void init_buffers(void)

Init buffers.

Return

void.

void init_tasks(void)

Init tasks variable and state.

Return

void.

void init_pins(void)

Init hardware pins.

Return

void.

void init_wire(void)

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

Return

void.

void init_spi(void)

Init SPI library.

Return

void.

void init_rtc(void)

Init RTC module.

Return

void.

void init_timer1(void)

Init Timer1 module.

Return

void.

void start_timer(void)

Start Timer1 module.

Return

void.

void stop_timer(void)

Stop Timer1 module.

Return

void.

void interrupt_task_1s(void)

1 seconds task.

Return

void.

void init_sensors(void)

Create and setup sensors.

Return

void.

void print_configuration(void)

Print current configuration.

Return

void.

void load_configuration(void)

Load configuration from EEPROM.

Return

void.

void save_configuration(bool)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void set_default_configuration(void)

Set default configuration to global configuration variable.

Return

void.

void setNextTimeForSensorReading(time_t *next_time, uint16_t time_s)
bool extractSensorsParams(JsonObject &params, char *driver, char *type, uint8_t *address, uint8_t *node)

Extract sensor's parameter.

Return

status code.

Parameters
  • [in] *params: json's params

  • [out] *driver: driver

  • [out] *type: type

  • [out] *address: address

  • [out] *node: node

int configure(JsonObject &params, JsonObject &result)

RPC configuration.

Return

status code.

Parameters
  • *params: json's params

  • &result: json's response

int prepare(JsonObject &params, JsonObject &result)

RPC prepare.

Return

status code.

Parameters
  • *params: json's params

  • &result: json's response

int getjson(JsonObject &params, JsonObject &result)

RPC get json.

Return

status code.

Parameters
  • *params: json's params

  • &result: json's response

int prepandget(JsonObject &params, JsonObject &result)

RPC prepare and get json.

Return

status code.

Parameters
  • *params: json's params

  • &result: json's response

int reboot(JsonObject &params, JsonObject &result)

RPC reboot.

Return

status code.

Parameters
  • *params: json's params

  • &result: json's response

void supervisor_task(void)

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

Return

void.

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

Sensors reading Task. Read data from sensors.

Return

void.

Parameters
  • do_prepare: if true, execute the prepare sensor's procedure

  • do_get: if true, execute the get sensor's procedure

  • *driver: sensor's driver

  • *type: sensor's type

  • *address: sensor's address

  • *node: sensor's node

  • *sensor_index: sensor's index

  • *wait_time: sensor's wait time

void rtc_task(void)

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

Return

void.

void time_task(void)

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

Return

void.

void ethernet_task(void)

Ethernet task. Manage Ethernet operation.

Return

void.

void rtc_interrupt_handler(void)

Real Time Clock interrupt handler.

Return

void.

HardwareSerial Serial1(PB11, PB10)
void wdt_enable(int wdt_timer)
void wdt_reset()
void wdt_disable()
void power_adc_disable()
void power_spi_disable()
void power_timer0_disable()
void power_timer1_disable()
void power_timer2_disable()
void power_adc_enable()
void power_spi_enable()
void power_timer0_enable()
void power_timer1_enable()
void power_timer2_enable()
void set_sleep_mode(int SLEEP_MODE_PWR_DOWN)
void sleep_enable()
void sleep_cpu()
void sleep_disable()

Variables

uint8_t sensors_count = 0
bool is_datetime_set

A valid date and time is setted and usable by station.

bool have_to_reboot

Request for a reboot as soon as possible.

configuration_t readable_configuration

Configuration for this module.

configuration_t writable_configuration

Configuration for this module.

uint8_t ready_tasks_count
uint32_t awakened_event_occurred_time_ms
EthernetUDP eth_udp_client

Ethernet UDP client structure.

EthernetClient eth_tcp_client

Ethernet TCP client structure.

SensorDriver *sensors[SENSORS_MAX]
bool is_first_run

If true, the first reading of the sensors was performed.

bool do_reset_first_run

If true, the first reading of the sensors was performed.

bool is_first_test

If true, the first reading of the sensors was performed.

bool is_test
bool is_time_set

If true, the time was readed from rtc or ntp and was setted in system.

bool is_time_for_sensors_reading_updated

If true, the next time has been calculated to read the sensors.

bool is_client_connected

If true, the client (ethernet or gsm) was connected to socket (TCP or UDP).

bool is_client_udp_socket_open

If true, the client (ethernet or gsm) was opened the UDP socket.

bool is_event_client_executed

If true, the client has executed its task.

bool is_event_time_executed

If true, the time task has executed.

bool do_ntp_sync

If true, you must update the time from ntp.

time_t last_ntp_sync

Last date and time when ntp sync was performed.

char json_sensors_data[SENSORS_MAX][JSON_BUFFER_LENGTH]

buffer containing the data read by sensors in json text format.

char json_sensors_data_test[JSON_BUFFER_LENGTH]

buffer containing the data read by sensors in json text format for test only.

time_t system_time

System time since 01/01/1970 00:00:00.

time_t next_ptr_time_for_sensors_reading

Next scheduled time (in seconds since 01/01/1970 00:0:00) for sensors reading.

time_t next_ptr_time_for_testing_sensors

Next scheduled time (in seconds since 01/01/1970 00:0:00) for sensors reading.

uint8_t sensor_reading_failed_count

Counter for failed and skipped sensors.

tmElements_t sensor_reading_time

Date and time corresponding to the last reading of the sensors.

time_t ptr_time_data

Readed data pointer stored on SD-Card for data send.

char stima_name[20]

Name of this module.

state_t state
supervisor_state_t supervisor_state

Supervisor task state.

ethernet_state_t ethernet_state

Ethernet task state.

uint8_t i2c_error
time_state_t time_state

Time task state.

sensors_reading_state_t sensors_reading_state
rpc_state_t rpc_state

RPC task state.

bool is_event_supervisor

Enable or disable the Supervisor task.

bool is_event_sensors_reading
bool is_event_sensors_reading_rpc

Enable or disable the Sensors reading task from RPC.

bool is_event_rtc

Enable or disable the Real Time Clock task.

bool is_event_time

Enable or disable the Time task.

bool is_event_ethernet

Enable or disable the Ethernet task.

bool is_event_rpc

Indicate if RPC is active or not.

STM32RTC &rtc = STM32RTC::getInstance()
file stima.ino
#include <debug_config.h>#include "stima.h"

Functions

void setup()
void loop()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_buffers()

Init buffers.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_pins()

Init hardware pins.

Return

void.

void init_wire()

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

Return

void.

void reset_wire()
void init_spi()

Init SPI library.

Return

void.

void init_system()

Init system.

Return

void.

void init_rpc()

Register RPC.

Return

void.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_timer1()

Init Timer1 module.

Return

void.

void start_timer()

Start Timer1 module.

Return

void.

void stop_timer()

Stop Timer1 module.

Return

void.

ISR(TIMER1_OVF_vect)
void init_sensors()

Create and setup sensors.

Return

void.

void setNextTimeForSensorReading(time_t *next_time, uint16_t time_s)
void print_configuration()

Print current configuration.

Return

void.

void set_default_configuration()

Set default configuration to global configuration variable.

Return

void.

void save_configuration(bool is_default)

Save configuration to EEPROM.

Return

void.

Parameters
  • is_default: if true save default configuration; if false save current configuration.

void load_configuration()

Load configuration from EEPROM.

Return

void.

time_t getSystemTime()
void realreboot()
void interrupt_task_1s()

1 seconds task.

Return

void.

void supervisor_task()

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

Return

void.

void rtc_task()

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

Return

void.

void time_task()

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

Return

void.

void ethernet_task()

Ethernet task. Manage Ethernet operation.

Return

void.

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.

Return

void.

Parameters
  • do_prepare: if true, execute the prepare sensor's procedure

  • do_get: if true, execute the get sensor's procedure

  • *driver: sensor's driver

  • *type: sensor's type

  • *address: sensor's address

  • *node: sensor's node

  • *sensor_index: sensor's index

  • *wait_time: sensor's wait time

file test_hyt271.ino
#include <hyt2x1.h>

Defines

POWER_PIN

Copyright (C) 2017 Marco Baldinetti m.baldinetti@digiteco.it authors: Marco Baldinetti m.baldinetti@digiteco.it

This program 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 2 of the License, or (at your option) any later version.

This program 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/.

Functions

void test_read_ht(int8_t address)
void setup()
void loop()
file hardware_config.h

Defines

I2C_BUS_CLOCK
I2C_MAX_DATA_LENGTH
file test_i2c_multimaster.ino
#include <Arduino.h>#include <debug_config.h>#include <i2c_config.h>#include <avr/sleep.h>#include <avr/power.h>#include <avr/wdt.h>#include <Wire.h>#include <i2c_utility.h>#include <ArduinoLog.h>

Defines

I2C_ADDRESS_1
I2C_ADDRESS_2
I2C_ADDRESS_3
I2C_ADDRESS_4
I2C_MY_ADDRESS
I2C_MAX_ERROR_COUNT
I2C_CHECK_DELAY_MS
I2C_REQUEST_MIN_DELAY_MS
I2C_REQUEST_MAX_DELAY_MS
I2C_SEND_DATA_MIN_DELAY_MS
I2C_SEND_DATA_MAX_DELAY_MS
PRINT_STATUS_DELAY_MS
WDT_TIMER

Enums

enum state_t

Values:

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

enumerator REBOOT

reboot the machine

enumerator INIT

init tasks and sensors

enumerator TASKS_EXECUTION

execute active tasks

enumerator END

go to ENTER_POWER_DOWN or TASKS_EXECUTION

Functions

uint8_t I2C_ClearBus_NEW()
bool check_i2c_bus()
void i2c_request_interrupt_handler()

I2C request interrupt handler.

Return

void.

void i2c_receive_interrupt_handler(int rx_data_length)

I2C receive interrupt handler.

Return

void.

Parameters
  • [in] rx_data_length: received data length in bytes.

void init_power_down(uint32_t *time_ms, uint32_t debouncing_ms)

Enter power down mode.

Return

void.

Parameters
  • time_ms: pointer to a variable to save the last instant you entered power down.

  • debouncing_ms: delay to power down.

void init_wdt(uint8_t wdt_timer)

Init watchdog.

Return

void.

Parameters
  • wdt_timer: a time value for init watchdog (WDTO_xxxx).

void init_wire()

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

Return

void.

void init_system()

Init system.

Return

void.

void init_tasks()

Init tasks variable and state.

Return

void.

void init_sensors()

Create and setup sensors.

Return

void.

void reset_i2c_buffer(void *buffer, uint8_t *length)
void received_data()
void send_data(uint8_t write_data_length, uint8_t i2c_other_address)
void request_data(uint8_t length, uint8_t i2c_other_address)
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void init_logging()

Init logging system.

Return

void.

void setup()
void loop()

Variables

state_t state
uint8_t ready_tasks_count
uint32_t awakened_event_occurred_time_ms
bool is_event_request_data
bool is_event_send_data
uint32_t start_print_status_delay_ms
uint32_t start_i2c_check_delay_ms
uint32_t i2c_request_delay_ms
uint32_t start_time_i2c_request_delay_ms
uint32_t i2c_send_delay_ms
uint32_t start_time_i2c_send_delay_ms
static uint8_t rx_buffer[I2C_MAX_DATA_LENGTH]
static uint8_t rx_buffer_length
uint8_t tx_buffer[I2C_MAX_DATA_LENGTH + 1]
uint8_t tx_buffer_length
uint8_t rq_buffer[I2C_MAX_DATA_LENGTH + 1]
uint8_t rq_buffer_length
uint16_t i2c_rx_error_count
uint16_t i2c_rx_success_count
uint16_t i2c_tx_error_count
uint16_t i2c_tx_success_count
uint16_t i2c_rq_error_count
uint16_t i2c_rq_success_count
file ToggleLED.ino
#include <arduinoJsonRPC.h>

Functions

JsonRPC rpc (false)
void setup()
int toggle(JsonObject params, JsonObject result)
void loop()

Variables

int led = 13
file HelloWorld.ino
#include <Wire.h>#include <hd44780.h>#include <hd44780ioClass/hd44780_I2Cexp.h>

Functions

hd44780_I2Cexp lcd(i2c_addr)
void setup()
void loop()

Variables

const int i2c_addr = 0x3F
const int LCD_COLS = 20
const int LCD_ROWS = 4
file SDlog.ino
#include <ArduinoLog.h>#include <SPI.h>#include <SdFat.h>#include <StreamUtils.h>

Defines

USE_SDCARD

This example sketch shows most of the features of the ArduinoLog library with SD card

USE_SDCARD RAM: [= ] 10.4% (used 1700 bytes from 16384 bytes) Flash: [== ] 16.7% (used 21668 bytes from 130048 bytes)

serial only logger RAM: [= ] 6.1% (used 996 bytes from 16384 bytes) Flash: [= ] 12.7% (used 16500 bytes from 130048 bytes)

DISABLE_LOGGING RAM: [= ] 5.8% (used 958 bytes from 16384 bytes) Flash: [= ] 8.8% (used 11426 bytes from 130048 bytes)

SDCARD_CHIP_SELECT_PIN
SPI_SPEED
SDCARD_LOGGING_FILE_NAME
LOG_LEVEL

Functions

WriteLoggingStream loggingStream(logFile, Serial)
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void setup()
void loop()

Variables

SdFat SD

SD-Card structure.

File logFile

File for logging on SD-Card.

int intValue1
int intValue2
long longValue1
long longValue2
bool boolValue1
bool boolValue2
const char *charArray = "this is a string"
String stringValue1 = "this is a string"
float floatValue
double doubleValue
file test_mqtt.ino
#include <debug_config.h>#include <sim800Client.h>#include <Sim800IPStack.h>#include <Countdown.h>#include <MQTTClient.h>#include <ArduinoLog.h>

Defines

TIMEOUT
REPEATWAIT
ENABLE_SUBSCRIBE
ENABLE_QOS0
ENABLE_QOS1
ENABLE_QOS2
MQTTCLIENT_QOS2
MQTTCLIENT_QOS
SERIAL_TRACE_LEVEL
SIM800_ON_OFF_PIN
GSM_APN
GSM_USERNAME
GSM_PASSWORD
TOPIC
HOSTNAME
DATE_TIME_STRING_LENGTH

Functions

HardwareSerial Serial1(PB11, PB10)
void messageArrived(MQTT::MessageData &md)
IPStack ipstack(s800)
bool initmodem(void)
bool connect(void)
bool publish(void)
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void setup()
void loop()

Variables

unsigned int arrivedcount = 0
sim800Client s800
MQTT::Client<IPStack, Countdown, 120, 2> client = MQTT::Client<IPStack, Countdown, 120, 2>(ipstack, TIMEOUT)
file test_mqtt_subscribe.ino
#include <sim800Client.h>#include <Sim800IPStack.h>#include <Countdown.h>#include <MQTTClient.h>

Defines

TIMEOUT
MQTTCLIENT_QOS
SIM800_ON_OFF_PIN
GSM_APN
GSM_USERNAME
GSM_PASSWORD
TOPICCOM
TOPICRES
HOSTNAME

Functions

HardwareSerial Serial1(PB11, PB10)
IPStack ipstack(s800)
bool publish(const char *topic, const char *payload)
void messageArrived(MQTT::MessageData &md)
bool initmodem(void)
bool connect(void)
void setup()
void loop()

Variables

sim800Client s800
MQTT::Client<IPStack, Countdown, 120, 1> client = MQTT::Client<IPStack, Countdown, 120, 1>(ipstack, TIMEOUT)
bool send_response = false
file test_ntp.ino
#include <debug_config.h>#include <sim800Client.h>#include <Sim800IPStack.h>#include <Countdown.h>#include <ArduinoLog.h>#include <ntp.h>

Defines

SIM800_ON_OFF_PIN
GSM_APN
GSM_USERNAME
GSM_PASSWORD
NTP_SERVER
DATE_TIME_STRING_LENGTH

Functions

HardwareSerial Serial1(PB11, PB10)
bool initmodem(void)
void getNtp()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void setup()
void loop()

Variables

sim800Client s800
file test_rtc.ino
#include <ArduinoLog.h>#include <TimeLib.h>#include <pcf8563.h>

Defines

DATE_TIME_STRING_LENGTH

Functions

void resetrtc()
void initrtc()
bool getrtc(time_t &time)
bool setrtc(const time_t time)
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void setup()
void loop()

Variables

time_t current_time
file test_sdcard.ino
#include <SPI.h>#include <SdFat.h>

Defines

SPI_DRIVER_SELECT
USE_SD_CRC
SDFAT_FILE_TYPE
USE_LONG_FILE_NAMES
SDCARD_CHIP_SELECT_PIN
SPI_SPEED

Functions

void setup()
void loop(void)

Variables

SdFat SD
File test_file
file Fat16Config.h

Configuration file

Defines

USE_ACMD41

Set USE_ACMD41 zero to initialize the card with CMD1. This will allowed limited use of MMC cards.

FAT16_DEBUG_SUPPORT

Set non-zero to allow access to Fat16 internals by cardInfo debug sketch

file mSPI.cpp
#include "mSPI.h"#include <inttypes.h>#include <avr/io.h>

Functions

void SPI_begin(void)
uint8_t SPI_transfer(uint8_t data)
file mSPI.h
#include <inttypes.h>#include <avr/io.h>

Defines

SPI_SPCR_CONFIG

Functions

void SPI_begin(void)
uint8_t SPI_transfer(uint8_t data)
file optiboot.ino
#include "SdCard.h"

Defines

BLOCK_SIZE
FAT16_ID_POS
MBR_FIRST_PART_POS
MBR_PART_LBA_POS
BLOCKS_PER_CLUSTER_POS
RESERVED_BLOCKS_COUNT_POS
ROOT_ENTRIES_COUNT_POS
BLOCKS_PER_FAT_POS
ROOT_ENTRY_SIZE
ROOT_ENTRY_FREE_TAG
ROOT_ENTRY_FILENAME_SIZE
ROOT_ENTRY_CLUSTER_POS
ROOT_ENTRY_SIZE_POS
FAT_ENTRY_SIZE
FAT_FILENAME_SIZE
FAT_EOF_TAG
FAT_FREE_TAG
WAIT_FOR_LINE_START
READ_LINE_SIZE
READ_ADDRESS
READ_LINE_TYPE
READ_DATA

Functions

bool fatTagFound(void)
uint8_t *find_firmware_data(FatFileDesc *fat, uint8_t cardType)
void write_page(uint16_t address)
int sdcard_loader(void)
void setup()
void loop()

Variables

uint8_t buff[1000]
file SdCard.cpp
#include "SdCard.h"#include <stdint.h>#include <avr/io.h>#include "Fat16Config.h"#include "mSPI.h"

Defines

RAMSTART
buff

Functions

uint8_t spiReceive(void)
bool waitNotBusy(void)
void chipSelectHigh(void)
void chipSelectLow(void)
uint8_t cardCommand(uint8_t cmd, uint32_t arg)
uint8_t cardAcmd(uint8_t cmd, uint32_t arg)
uint8_t SdCard_begin(void)
bool SdCard_readBlock(uint32_t blockNumber, uint8_t cardType)

Reads a 512 byte block from a storage device.

Return

The value one, true, is returned for success and the value zero, false, is returned for failure.

Parameters
  • [in] blockNumber: Logical block to be read.

  • [out] dst: Pointer to the location that will receive the data.

bool SdCard_writeBlock(uint32_t blockNumber, uint8_t cardType)

Writes a 512 byte block to a storage device.

Return

The value one, true, is returned for success and the value zero, false, is returned for failure.

Parameters
  • [in] blockNumber: Logical block to be written.

  • [in] src: Pointer to the location of the data to be written.

file SdCard.h
#include <stdint.h>#include <avr/io.h>#include "mSPI.h"

Defines

__STDC_LIMIT_MACROS
SD_SS_PORT
SD_SS_PIN
SD_SS_PORT_REG
SD_SS_DDR_REG
SPI_SCK_INIT_DIVISOR
SD_MAX_CMD0_TRIES
SD_MAX_TRANSFERTS
SD_MAX_COMMANDS
CMD0

GO_IDLE_STATE - init card in spi mode if CS low

CMD8

SEND_IF_COND - verify SD Memory Card interface operating condition.

CMD9

SEND_CSD - read the Card Specific Data (CSD register)

CMD10

SEND_CID - read the card identification information (CID register)

CMD12

STOP_TRANSMISSION - end multiple block read sequence

CMD13

SEND_STATUS - read the card status register

CMD17

READ_SINGLE_BLOCK - read a single data block from the card

CMD18

READ_MULTIPLE_BLOCK - read a multiple data blocks from the card

CMD24

WRITE_BLOCK - write a single data block to the card

CMD25

WRITE_MULTIPLE_BLOCK - write blocks of data until a STOP_TRANSMISSION

CMD32

ERASE_WR_BLK_START - sets the address of the first block to be erased

CMD33

ERASE_WR_BLK_END - sets the address of the last block of the continuous range to be erased

CMD38

ERASE - erase all previously selected blocks

CMD55

APP_CMD - escape for application specific command

CMD58

READ_OCR - read the OCR register of a card

CMD59

CRC_ON_OFF - enable or disable CRC checking

ACMD23

SET_WR_BLK_ERASE_COUNT - Set the number of write blocks to be pre-erased before writing

ACMD41

SD_SEND_OP_COMD - Sends host capacity support information and activates the card's initialization process

R1_READY_STATE

status for card in the ready state

R1_IDLE_STATE

status for card in the idle state

R1_ILLEGAL_COMMAND

status bit for illegal command

DATA_START_BLOCK

start data token for read or write single block

STOP_TRAN_TOKEN

stop token for write multiple blocks

WRITE_MULTIPLE_TOKEN

start data token for write multiple blocks

DATA_RES_MASK

mask for data response tokens after a write block operation

DATA_RES_ACCEPTED

write data accepted token

CARD_TYPE_SDV1

sd card type v1

CARD_TYPE_SDV2

sd card type v2

CARD_TYPE_SDHC

sd card type sdhc

Functions

uint8_t SdCard_begin()
bool SdCard_readBlock(uint32_t block, uint8_t cardType)

Reads a 512 byte block from a storage device.

Return

The value one, true, is returned for success and the value zero, false, is returned for failure.

Parameters
  • [in] blockNumber: Logical block to be read.

  • [out] dst: Pointer to the location that will receive the data.

bool SdCard_writeBlock(uint32_t block, uint8_t cardType)

Writes a 512 byte block to a storage device.

Return

The value one, true, is returned for success and the value zero, false, is returned for failure.

Parameters
  • [in] blockNumber: Logical block to be written.

  • [in] src: Pointer to the location of the data to be written.

file test_sensor_driver.ino
#include <i2c_config.h>#include <debug_config.h>#include <SensorDriver.h>#include <sensors_config.h>#include <ArduinoLog.h>

Defines

LOG_LEVEL
I2C_BUS_CLOCK
SENSORS_RETRY_COUNT_MAX
SENSORS_RETRY_DELAY_MS
DELAY_ACQ_MS
DELAY_TEST_MS

Enums

enum sensors_reading_state_t

Values:

enumerator SENSORS_READING_INIT

init task variables

enumerator SENSORS_READING_SETUP_CHECK

check errors and if required try a sensor setup

enumerator SENSORS_READING_PREPARE

prepare sensor

enumerator SENSORS_READING_IS_PREPARED

check if the sensor has been prepared

enumerator SENSORS_READING_GET

read and get values from sensor

enumerator SENSORS_READING_IS_GETTED

check if the sensor has been readed

enumerator SENSORS_READING_READ

intermediate state (future implementation...)

enumerator SENSORS_READING_NEXT

go to next sensor

enumerator SENSORS_READING_END

performs end operations and deactivate task

enumerator SENSORS_READING_WAIT_STATE

non-blocking waiting time

enumerator SENSORS_READING_INIT

init task variables

enumerator SENSORS_SETUP_CHECK

check errors and if required try a sensor setup

enumerator SENSORS_READING_PREPARE

prepare sensor

enumerator SENSORS_READING_IS_PREPARED

check if the sensor has been prepared

enumerator SENSORS_READING_GET

read and get values from sensor

enumerator SENSORS_READING_IS_GETTED

check if the sensor has been readed

enumerator SENSORS_READING_READ

intermediate state (future implementation...)

enumerator SENSORS_READING_NEXT

go to next sensor

enumerator SENSORS_READING_END

performs end operations and deactivate task

enumerator SENSORS_READING_WAIT_STATE

non-blocking waiting time

enumerator SENSORS_READING_INIT
enumerator SENSORS_READING_PREPARE
enumerator SENSORS_READING_IS_PREPARED
enumerator SENSORS_READING_GET
enumerator SENSORS_READING_IS_GETTED
enumerator SENSORS_READING_READ
enumerator SENSORS_READING_NEXT
enumerator SENSORS_READING_END
enumerator SENSORS_READING_WAIT_STATE

Functions

void init_sensors()

Create and setup sensors.

Return

void.

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

Sensors reading Task. Read data from sensors.

Return

void.

Parameters
  • do_prepare: if true, execute the prepare sensor's procedure

  • do_get: if true, execute the get sensor's procedure

  • *driver: sensor's driver

  • *type: sensor's type

  • *address: sensor's address

  • *node: sensor's node

  • *sensor_index: sensor's index

  • *wait_time: sensor's wait time

void reset_wire()
void init_wire()

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

Return

void.

void check_i2c_bus()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void setup()
void loop()

Variables

uint8_t sensors_count
SensorDriver *sensors[SENSORS_MAX]
bool is_first_run
bool is_test
bool is_event_sensors_reading
bool do_reset_first_run
int32_t values_readed_from_sensor[SENSORS_MAX][VALUES_TO_READ_FROM_SENSOR_COUNT]
sensors_reading_state_t sensors_reading_state
uint32_t acquiring_sensors_delay_ms
uint32_t testing_sensors_delay_ms
uint8_t i2c_error
file basic.ino
#include <gsm_config.h>#include <sim800Client.h>#include <ArduinoLog.h>

Defines

LOG_LEVEL
SIM800_ON_OFF_PIN
SIM800_GSM_APN
SIM800_GSM_USERNAME
SIM800_GSM_PASSWORD

Enums

enum gsm_state_t

Values:

enumerator GSM_INIT

init task variables

enumerator GSM_SWITCH_ON

gsm power on

enumerator GSM_AUTOBAUD

gsm autobaud procedure

enumerator GSM_SETUP

gsm setup

enumerator GSM_START_CONNECTION

gsm open connection

enumerator GSM_CHECK_OPERATION

check operations (ntp or mqtt)

enumerator GSM_OPEN_UDP_SOCKET

open udp socket for ntp sync

enumerator GSM_SUSPEND

wait other tasks for complete its operations with gsm

enumerator GSM_STOP_CONNECTION

gsm close connection

enumerator GSM_WAIT_FOR_SWITCH_OFF

wait gsm for power off

enumerator GSM_SWITCH_OFF

gsm power off

enumerator GSM_END

performs end operations and deactivate task

enumerator GSM_WAIT_STATE

non-blocking waiting time

Functions

HardwareSerial Serial1(PB11, PB10)
void gsm_task()
void logPrefix(Print *_logOutput)
void logSuffix(Print *_logOutput)
void setup()
void loop()

Variables

sim800Client s800
bool is_event_gsm
bool is_client_connected
bool is_client_udp_socket_open
bool is_event_client_executed
uint8_t ready_tasks_count
gsm_state_t gsm_state
group avr_boot

#include <avr/io.h>
#include <avr/boot.h>

The macros in this module provide a C language interface to the bootloader support functionality of certain AVR processors. These macros are designed to work with all sizes of flash memory.

Global interrupts are not automatically disabled for these macros. It is left up to the programmer to do this. See the code example below. Also see the processor datasheet for caveats on having global interrupts enabled during writing of the Flash.

Todo:

From email with Marek: On smaller devices (all except ATmega64/128), __SPM_REG is in the I/O space, accessible with the shorter "in" and "out" instructions - since the boot loader has a limited size, this could be an important optimization.

Note

Not all AVR processors provide bootloader support. See your processor datasheet to see if it provides bootloader support.

#include <inttypes.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>

void boot_program_page (uint32_t page, uint8_t *buf)
{
    uint16_t i;
    uint8_t sreg;

    // Disable interrupts.

    sreg = SREG;
    cli();

    eeprom_busy_wait ();

    boot_page_erase (page);
    boot_spm_busy_wait ();      // Wait until the memory is erased.

    for (i=0; i<SPM_PAGESIZE; i+=2)
    {
        // Set up little-endian word.

        uint16_t w = *buf++;
        w += (*buf++) << 8;
    
        boot_page_fill (page + i, w);
    }

    boot_page_write (page);     // Store buffer in flash page.
    boot_spm_busy_wait();       // Wait until the memory is written.

    // Reenable RWW-section again. We need this if we want to jump back
    // to the application after bootloading.

    boot_rww_enable ();

    // Re-enable interrupts (if they were ever enabled).

    SREG = sreg;
}
API Usage Example

The following code shows typical usage of the boot API.

#include <avr/io.h>
#include <avr/boot.h>

The macros in this module provide a C language interface to the bootloader support functionality of certain AVR processors. These macros are designed to work with all sizes of flash memory.

Global interrupts are not automatically disabled for these macros. It is left up to the programmer to do this. See the code example below. Also see the processor datasheet for caveats on having global interrupts enabled during writing of the Flash.

Todo:

From email with Marek: On smaller devices (all except ATmega64/128), __SPM_REG is in the I/O space, accessible with the shorter "in" and "out" instructions - since the boot loader has a limited size, this could be an important optimization.

Note

Not all AVR processors provide bootloader support. See your processor datasheet to see if it provides bootloader support.

#include <inttypes.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>

void boot_program_page (uint32_t page, uint8_t *buf)
{
    uint16_t i;
    uint8_t sreg;

    // Disable interrupts.

    sreg = SREG;
    cli();

    eeprom_busy_wait ();

    boot_page_erase (page);
    boot_spm_busy_wait ();      // Wait until the memory is erased.

    for (i=0; i<SPM_PAGESIZE; i+=2)
    {
        // Set up little-endian word.

        uint16_t w = *buf++;
        w += (*buf++) << 8;
    
        boot_page_fill (page + i, w);
    }

    boot_page_write (page);     // Store buffer in flash page.
    boot_spm_busy_wait();       // Wait until the memory is written.

    // Reenable RWW-section again. We need this if we want to jump back
    // to the application after bootloading.

    boot_rww_enable ();

    // Re-enable interrupts (if they were ever enabled).

    SREG = sreg;
}
API Usage Example

The following code shows typical usage of the boot API.

Defines

BOOTLOADER_SECTION

Used to declare a function or variable to be placed into a new section called .bootloader. This section and its contents can then be relocated to any address (such as the bootloader NRWW area) at link-time.

boot_spm_interrupt_enable()

Enable the SPM interrupt.

boot_spm_interrupt_disable()

Disable the SPM interrupt.

boot_is_spm_interrupt()

Check if the SPM interrupt is enabled.

boot_rww_busy()

Check if the RWW section is busy.

boot_spm_busy()

Check if the SPM instruction is busy.

boot_spm_busy_wait()

Wait while the SPM instruction is busy.

GET_LOW_FUSE_BITS

address to read the low fuse bits, using boot_lock_fuse_bits_get

GET_LOCK_BITS

address to read the lock bits, using boot_lock_fuse_bits_get

GET_EXTENDED_FUSE_BITS

address to read the extended fuse bits, using boot_lock_fuse_bits_get

GET_HIGH_FUSE_BITS

address to read the high fuse bits, using boot_lock_fuse_bits_get

boot_lock_fuse_bits_get(address)

Read the lock or fuse bits at address.

Parameter address can be any of GET_LOW_FUSE_BITS, GET_LOCK_BITS, GET_EXTENDED_FUSE_BITS, or GET_HIGH_FUSE_BITS.

Note

The lock and fuse bits returned are the physical values, i.e. a bit returned as 0 means the corresponding fuse or lock bit is programmed.

boot_signature_byte_get(addr)

Read the Signature Row byte at address. For some MCU types, this function can also retrieve the factory-stored oscillator calibration bytes.

Parameter address can be 0-0x1f as documented by the datasheet.

Note

The values are MCU type dependent.

boot_page_fill(address, data)

Fill the bootloader temporary page buffer for flash address with data word.

Note

The address is a byte address. The data is a word. The AVR writes data to the buffer a word at a time, but addresses the buffer per byte! So, increment your address by 2 between calls, and send 2 data bytes in a word format! The LSB of the data is written to the lower address; the MSB of the data is written to the higher address.

boot_page_erase(address)

Erase the flash page that contains address.

Note

address is a byte address in flash, not a word address.

boot_page_write(address)

Write the bootloader temporary page buffer to flash page that contains address.

Note

address is a byte address in flash, not a word address.

boot_rww_enable()

Enable the Read-While-Write memory section.

boot_lock_bits_set(lock_bits)

Set the bootloader lock bits.

For example, to disallow the SPM instruction from writing to the Boot Loader memory section of flash, you would use this macro as such:

Note

In this context, a 'set bit' will be written to a zero value. Note also that only BLBxx bits can be programmed by this command.

Parameters
  • lock_bits: A mask of which Boot Loader Lock Bits to set.

boot_lock_bits_set (_BV (BLB11));

Note

Like any lock bits, the Boot Loader Lock Bits, once set, cannot be cleared again except by a chip erase which will in turn also erase the boot loader itself.

boot_page_fill_safe(address, data)

Same as boot_page_fill() except it waits for eeprom and spm operations to complete before filling the page.

boot_page_erase_safe(address)

Same as boot_page_erase() except it waits for eeprom and spm operations to complete before erasing the page.

boot_page_write_safe(address)

Same as boot_page_write() except it waits for eeprom and spm operations to complete before writing the page.

boot_rww_enable_safe()

Same as boot_rww_enable() except waits for eeprom and spm operations to complete before enabling the RWW mameory.

boot_lock_bits_set_safe(lock_bits)

Same as boot_lock_bits_set() except waits for eeprom and spm operations to complete before setting the lock bits.

BOOTLOADER_SECTION

Used to declare a function or variable to be placed into a new section called .bootloader. This section and its contents can then be relocated to any address (such as the bootloader NRWW area) at link-time.

boot_spm_interrupt_enable()

Enable the SPM interrupt.

boot_spm_interrupt_disable()

Disable the SPM interrupt.

boot_is_spm_interrupt()

Check if the SPM interrupt is enabled.

boot_rww_busy()

Check if the RWW section is busy.

boot_spm_busy()

Check if the SPM instruction is busy.

boot_spm_busy_wait()

Wait while the SPM instruction is busy.

GET_LOW_FUSE_BITS

address to read the low fuse bits, using boot_lock_fuse_bits_get

GET_LOCK_BITS

address to read the lock bits, using boot_lock_fuse_bits_get

GET_EXTENDED_FUSE_BITS

address to read the extended fuse bits, using boot_lock_fuse_bits_get

GET_HIGH_FUSE_BITS

address to read the high fuse bits, using boot_lock_fuse_bits_get

boot_lock_fuse_bits_get(address)

Read the lock or fuse bits at address.

Parameter address can be any of GET_LOW_FUSE_BITS, GET_LOCK_BITS, GET_EXTENDED_FUSE_BITS, or GET_HIGH_FUSE_BITS.

Note

The lock and fuse bits returned are the physical values, i.e. a bit returned as 0 means the corresponding fuse or lock bit is programmed.

boot_signature_byte_get(addr)

Read the Signature Row byte at address. For some MCU types, this function can also retrieve the factory-stored oscillator calibration bytes.

Parameter address can be 0-0x1f as documented by the datasheet.

Note

The values are MCU type dependent.

boot_page_fill(address, data)

Fill the bootloader temporary page buffer for flash address with data word.

Note

The address is a byte address. The data is a word. The AVR writes data to the buffer a word at a time, but addresses the buffer per byte! So, increment your address by 2 between calls, and send 2 data bytes in a word format! The LSB of the data is written to the lower address; the MSB of the data is written to the higher address.

boot_page_erase(address)

Erase the flash page that contains address.

Note

address is a byte address in flash, not a word address.

boot_page_write(address)

Write the bootloader temporary page buffer to flash page that contains address.

Note

address is a byte address in flash, not a word address.

boot_rww_enable()

Enable the Read-While-Write memory section.

boot_lock_bits_set(lock_bits)

Set the bootloader lock bits.

For example, to disallow the SPM instruction from writing to the Boot Loader memory section of flash, you would use this macro as such:

Note

In this context, a 'set bit' will be written to a zero value. Note also that only BLBxx bits can be programmed by this command.

Parameters
  • lock_bits: A mask of which Boot Loader Lock Bits to set.

boot_lock_bits_set (_BV (BLB11));

Note

Like any lock bits, the Boot Loader Lock Bits, once set, cannot be cleared again except by a chip erase which will in turn also erase the boot loader itself.

boot_page_fill_safe(address, data)

Same as boot_page_fill() except it waits for eeprom and spm operations to complete before filling the page.

boot_page_erase_safe(address)

Same as boot_page_erase() except it waits for eeprom and spm operations to complete before erasing the page.

boot_page_write_safe(address)

Same as boot_page_write() except it waits for eeprom and spm operations to complete before writing the page.

boot_rww_enable_safe()

Same as boot_rww_enable() except waits for eeprom and spm operations to complete before enabling the RWW mameory.

boot_lock_bits_set_safe(lock_bits)

Same as boot_lock_bits_set() except waits for eeprom and spm operations to complete before setting the lock bits.

page md__home_pat1_git_rmap_platformio_stima_v3_digitecoboot_ihex_ihex_README

A small library for reading and writing the Intel HEX (or IHEX) format. The library is mainly intended for embedded systems and microcontrollers, such as Arduino, AVR, PIC, ARM, STM32, etc - hence the emphasis is on small size rather than features, generality, or error handling.

See the header file kk_ihex.h for documentation, or below for simple examples.

~ Kimmo Kulovesi, 2013-12-27

Writing

Basic usage for writing binary data as IHEX ASCII:

#include "kk_ihex_write.h"

struct ihex_state ihex;
ihex_init(&ihex);
ihex_write_at_address(&ihex, 0);
ihex_write_bytes(&ihex, my_data_bytes, my_data_size);
ihex_end_write(&ihex);
The function ihex_write_bytes may be called multiple times to pass any amount of data at a time.

The actual writing is done by a callback called ihex_flush_buffer, which must be implemented, e.g., as follows:

void ihex_flush_buffer(struct ihex_state *ihex, char *buffer, char *eptr) {
    *eptr = '\0';
    (void) fputs(buffer, stdout);
}
The length of the buffer can be obtained from eptr - buffer. The actual implementation may of course do with the IHEX data as it pleases, e.g., transmit it over a serial port.

For a complete example, see the included program bin2ihex.c.

Reading

Basic usage for reading ASCII IHEX into binary data:

#include "kk_ihex_read.h"

struct ihex_state ihex;
ihex_begin_read(&ihex);
ihex_read_bytes(&ihex, my_ascii_bytes, my_ascii_length);
ihex_end_read(&ihex);
The function ihex_read_bytes may be called multiple times to pass any amount of data at a time.

The reading functions call the function ihex_data_read, which must be implemented by the caller to store the binary data, e.g., as follows:

ihex_bool_t ihex_data_read (struct ihex_state *ihex,
                            ihex_record_type_t type,
                            ihex_bool_t checksum_error) {
    if (type == IHEX_DATA_RECORD) {
        unsigned long address = (unsigned long) IHEX_LINEAR_ADDRESS(ihex);
        (void) fseek(outfile, address, SEEK_SET);
        (void) fwrite(ihex->data, ihex->length, 1, outfile);
    } else if (type == IHEX_END_OF_FILE_RECORD) {
        (void) fclose(outfile);
    }
    return true;
}
Of course an actual implementation is free to do with the data as it chooses, e.g., burn it on an EEPROM instead of writing it to a file.

For an example complete with error handling, see the included program ihex2bin.c.

Example Programs

The included example programs, ihex2bin and bin2ihex, implement a very simple conversion between raw binary data and Intel HEX. Usage by example:

# Simple conversion from binary to IHEX:
bin2ihex <infile.bin >outfile.hex

# Add an offset to the output addresses (i.e., make the address
# of the first byte of the input other than zero):
bin2ihex -a 0x8000000 -i infile.bin -o outfile.hex

# Encode 64 input bytes per output IHEX line:
bin2ihex -b 64 <infile.bin >outfile.hex

# Simple conversion from IHEX to binary:
ihex2bin <infile.hex >outfile.bin

# Manually specify the initial address written (i.e., subtract
# an offset from the input addresses):
ihex2bin -a 0x8000000 -i infile.hex -o outfile.bin

# Start output at the first data byte (i.e., make the address offset
# equal to the address of the first data byte read from input):
ihex2bin -A -i infile.hex -o outfile.bin
Both programs also accept the option -v to increase verbosity.

When using ihex2bin on Intel HEX files produced by compilers and such, it is a good idea to specify the command-line option -A to autodetect the address offset. Otherwise the program will simply fill any unused addresses, starting from 0, with zero bytes, which may total mega- or even gigabytes.

Utilities

Four additional utilities are provided to help working with ROM images:

  • split16bit – splits a 16-bit ROM binary into two 8-bit halves

  • merge16bit – merges two 8-bit ROM binary halves into a single 16-bit file

  • split32bit – splits a 32-bit ROM binary into four 8-bit parts

  • merge32bit – merges four 8-bit ROM binary parts into a single 32-bit file

Both 16-bit utilities take the filenames of the high and low halves with the arguments -llow.bin and -hhigh.bin, respectively. The bytes are in little endian order, i.e., the one with the lowest address is the "low" half.

# Split 16bit.bin into low.bin and high.bin:
split16bit -i 16bit.bin -l low.bin -h high.bin

# Merge low.bin and high.bin into 16bit.bin:
merge16bit -o 16bit.bin -l low.bin -h high.bin
Both 32-bit utilities take the filenames of the four 8-bit files with the arguments -0, -1, -2, and -3, with byte 0 being the one with the lowest address, i.e., the bytes are in little endian order.
# Split 32bit.bin into a.bin, b.bin, c.bin, and d.bin
split32bit -i 32bit.bin -0 a.bin -1 b.bin -2 c.bin -3 d.bin

# Merge a.bin, b.bin, c.bin, and d.bin into 32bit.bin
merge32bit -o 32bit.bin -0 a.bin -1 b.bin -2 c.bin -3 d.bin
These utilities have nothing to with IHEX as such, but they are so small that it didn't seem worth the bother to release them separately.

page todo

Module avr_boot

From email with Marek: On smaller devices (all except ATmega64/128), __SPM_REG is in the I/O space, accessible with the shorter "in" and "out" instructions - since the boot loader has a limited size, this could be an important optimization.

From email with Marek: On smaller devices (all except ATmega64/128), __SPM_REG is in the I/O space, accessible with the shorter "in" and "out" instructions - since the boot loader has a limited size, this could be an important optimization.

dir /home/pat1/git/rmap/platformio/stima_v3/arduino_as_isp
dir /home/pat1/git/rmap/platformio/stima_v3/digitecoboot
dir /home/pat1/git/rmap/platformio/stima_v3/digitecoboot_ihex
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-leaf
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-opc
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-radiation
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-rain
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-th
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-thr
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-wind
dir /home/pat1/git/rmap/platformio/stima_v3/digitecoboot_ihex/ihex
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-opc/include
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-thr/include
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-wind/include
dir /home/pat1/git/rmap/platformio/stima_v3/test_mqtt_subscribe_sim800/include
dir /home/pat1/git/rmap/platformio/stima_v3/stima/include
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-th/include
dir /home/pat1/git/rmap/platformio/stima_v3/test_mqtt_sim800/include
dir /home/pat1/git/rmap/platformio/stima_v3/test_i2c_multimaster/include
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-rain/include
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-radiation/include
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-leaf/include
dir /home/pat1/git/rmap/platformio/stima_v3/test_ntp/include
dir /home/pat1/git/rmap/platformio/stima_v3/test_sensordriver/include
dir /home/pat1/git/rmap/platformio/stima_v3/test_sim800/include
dir /home/pat1/git/rmap/platformio/stima_v3/sensor_config/include
dir /home/pat1/git/rmap/platformio/stima_v3/digitecoboot_ihex/pff
dir /home/pat1/git/rmap/platformio/stima_v3/digitecoboot/pff
dir /home/pat1/git/rmap/platformio
dir /home/pat1/git/rmap/platformio/stima_v3/SdFormatter
dir /home/pat1/git/rmap/platformio/stima_v3/sensor_config
dir /home/pat1/git/rmap/platformio/stima_v3/test_sensordriver/src
dir /home/pat1/git/rmap/platformio/stima_v3/SdFormatter/src
dir /home/pat1/git/rmap/platformio/stima_v3/sensor_config/src
dir /home/pat1/git/rmap/platformio/stima_v3/stima/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_hyt271/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_i2c_multimaster/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_sim800/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_mqtt_subscribe_sim800/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_jsonrpc/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_sdfat16/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_lcd/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_sdcard/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_logging/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_rtc/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_mqtt_sim800/src
dir /home/pat1/git/rmap/platformio/stima_v3/test_ntp/src
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-thr/src
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-th/src
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-rain/src
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-radiation/src
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-wind/src
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-opc/src
dir /home/pat1/git/rmap/platformio/stima_v3/i2c-leaf/src
dir /home/pat1/git/rmap/platformio/stima_v3/arduino_as_isp/src
dir /home/pat1/git/rmap/platformio/stima_v3/digitecoboot/pff/src
dir /home/pat1/git/rmap/platformio/stima_v3/digitecoboot_ihex/pff/src
dir /home/pat1/git/rmap/platformio/stima_v3/stima
dir /home/pat1/git/rmap/platformio/stima_v3
dir /home/pat1/git/rmap/platformio/stima_v3/test_hyt271
dir /home/pat1/git/rmap/platformio/stima_v3/test_i2c_multimaster
dir /home/pat1/git/rmap/platformio/stima_v3/test_jsonrpc
dir /home/pat1/git/rmap/platformio/stima_v3/test_lcd
dir /home/pat1/git/rmap/platformio/stima_v3/test_logging
dir /home/pat1/git/rmap/platformio/stima_v3/test_mqtt_sim800
dir /home/pat1/git/rmap/platformio/stima_v3/test_mqtt_subscribe_sim800
dir /home/pat1/git/rmap/platformio/stima_v3/test_ntp
dir /home/pat1/git/rmap/platformio/stima_v3/test_rtc
dir /home/pat1/git/rmap/platformio/stima_v3/test_sdcard
dir /home/pat1/git/rmap/platformio/stima_v3/test_sdfat16
dir /home/pat1/git/rmap/platformio/stima_v3/test_sensordriver
dir /home/pat1/git/rmap/platformio/stima_v3/test_sim800
page index

Introduction

software to collect weather data contributed by citizens; to make these data available for weather services and homeland security; to provide feedback to the data contributors so that they have the tools to check and improve their data quality

http://doc.rmap.cc

Howto

STIMA over Ethernet:

../_images/ethernet.jpg../_images/ethernet.jpg

Hardware

1) Stima I2C-Base @ 5V

2) Microduino Ethernet WIZ

3) Microduino RJ45

4) Stima core+1284 @ 5V

5) Stima I2C-RTC @ 5V

6) Stima FT232RL

7) Stima SD-Card

Software

1) open sketch arduino/sketchbook/rmap/rmap/rmap.ino

2) in arduino/sketchbook/rmap/rmap/rmap-config.h set STIMA_MODULE_TYPE_REPORT_ETH or STIMA_MODULE_TYPE_SAMPLE_ETH in MODULE_VERSION define

3) open arduino/sketchbook/libraries/RmapConfig/sensors_config.h and set true or false sensors's define and json's define in order to enable or disable relative sensor's driver and library

4) compile and upload firmware

5) short-circuit the two configure pins with a jumper and configure it!

STIMA over GSM/GPRS:

../_images/gsm.jpg../_images/gsm.jpg

Hardware

1) Stima I2C-Base @ 5V

2) Stima SIM800C Power

3) Stima SIM800C Module

4) Stima core+1284 @ 5V

5) Stima I2C-RTC @ 5V

6) Stima FT232RL

7) Stima SD-Card

Software

1) open sketch arduino/sketchbook/rmap/rmap/rmap.ino

2) in arduino/sketchbook/rmap/rmap/rmap-config.h set STIMA_MODULE_TYPE_REPORT_GSM or STIMA_MODULE_TYPE_SAMPLE_GSM in MODULE_VERSION define

3) open arduino/sketchbook/libraries/RmapConfig/sensors_config.h and set true or false sensors's define and json's define in order to enable or disable relative sensor's driver and library

4) compile and upload firmware

5) short-circuit the two configure pins with a jumper and configure it!

STIMA Passive:

../_images/passive.jpg../_images/passive.jpg

Hardware

1) Stima I2C-Base @ 5V / 3.3V

2) Stima core+1284 @ 5V / Stima core+644 @ 3.3V

3) Stima I2C-RTC @ 5V / 3.3V

4) Stima FT232RL

Software

1) open sketch arduino/sketchbook/rmap/rmap/rmap.ino

2) in arduino/sketchbook/rmap/rmap/rmap-config.h set STIMA_MODULE_TYPE_PASSIVE in MODULE_VERSION define

3) open arduino/sketchbook/libraries/RmapConfig/sensors_config.h and set true or false sensors's define and json's define in order to enable or disable relative sensor's driver and library

4) compile and upload firmware

5) short-circuit the two configure pins with a jumper and configure it!

STIMA I2C-TH:

../_images/th.jpg../_images/th.jpg

Hardware

1) Stima I2C-Base @ 3.3V

2) Stima core+644 @ 3.3V

3) Stima FT232RL

4) Stima SD-Card

Software

1) open sketch arduino/sketchbook/rmap/i2c-th/i2c-th.ino

2) open arduino/sketchbook/libraries/RmapConfig/sensors_config.h and set true or false sensors's define and json's define in order to enable or disable relative sensor's driver and library

3) compile and upload firmware

STIMA I2C-Rain:

../_images/rain.jpg../_images/rain.jpg

Hardware

1) Stima I2C-Base @ 3.3V

2) Stima core+644 @ 3.3V

3) Stima I2C-Digital

4) Stima FT232RL

5) Stima SD-Card

Software

1) open sketch arduino/sketchbook/rmap/i2c-rain/i2c-rain.ino

2) open arduino/sketchbook/libraries/RmapConfig/sensors_config.h and set false in all sensors's define and json's define

3) compile and upload firmware

STIMA Meteo Station assembly

../_images/station.jpg../_images/station.jpg

1) Stima over Ethernet or Stima over GSM

--> connect with a cable at 5V hub port --> in GSM/GPRS version: connect SMA antenna and insert a SIM card --> in Ethernet version: connect ethernet/POE cable

2) Stima I2C-TH

--> connect with a cable at 3.3V hub port

3) Stima I2C-Rain

--> connect with a cable at 3.3V hub port

--> connect at tipping bucket rain on 2 external pins of Stima I2C-Digital

4) I2C sensor's:

--> connect with a cable at 3.3V or 5V hub port

5) I2C LCD Display

--> connect with a cable at 5V hub port

6) Stima I2C-HUB

Power up the station through one of the following ways:

1) USB power supply with USB type B connector

2) Plug a POE cable into RJ45 interface (only for ethernet version)

3) 5V DC power supply through hub input port

4) DigitecoPower through hub input port with capability of 12V battery backup, solar panel or 12-30V DC input source voltage

in that case, the pins on the DigitecoPower module are:

1) VCC_IN: 12-30V DC input source VCC (+)

2) GND_IN: 12-30V DC input source GND (-)

3) VCC_BAT: 12V DC input/otput battery backup VCC (+)

4) GND_BAT: 12V DC input/otput battery backup GND (-)

5) Status LED: green for battery charged, orange for medium charged battery, red for low battery

6) VCC_OUT: 5V DC output for input hub connector VCC (+)

7) SCL: I2C SCL for input hub connector

8) SDA: I2C SDA for input hub connector

9) GND_OUT: 5V DC output for input hub connector GND (-)

Project Library

For details, look at the specific library files.

RmapConfig

This library contains the definitions that are useful for configuring some default values. Below is a list of the files contained therein.

debug_config.h: Enable or disable debug in sketch and library

ethernet_config.h: Ethernet configuration's parameters (IP, DHCP, delay, ecc..)

gsm_config.h: GSM configuration's parameters (APN, username, ecc..)

hardware_config.h: Hardware configuration's parameters (I2C bus clock, ecc..)

json_config.h: JSON configuration's parameters (buffer length)

lcd_config.h: LCD configuration's parameters (rows, columns, ecc..)

mqtt_config.h: MQTT configuration's parameters (topic length, buffers length, ecc..)

ntp_config.h: NTP configuration's parameters (timezone, server, ecc..)

sdcard_config.h: SDCARD configuration's parameters (name length, ecc..)

sensors_config.h: Enable or disable sensor driver sensors for specific sketch

Rmap

This library contains generic utility features. Below is a list of the files contained therein.

debug.h debug.cpp: Debugging functions for print debug message on serial port or LCD

eeprom_utility.h eeprom_utility.cpp: EEPROM utility for write and read eeprom

i2c_utility.h i2c_utility.cpp: I2C utility for bus recovery

registers.h: General register's define

registers-th.h: I2C-TH register's define

registers-rain.h: I2C-Rain register's define

rmap_utility.h rmap_utility.cpp: RMAP useful functions

sdcard_utility.h sdcard_utility.cpp: SD-Card useful functions

stima_module.h: STIMA station's definition

typedef.h: Useful project typedef

SensorDriver

This library is provided to read measurements from I2C sensors.

SensorDriverSensors.h: define list with sensor names in SensorDriver

SensorDriver.h SensorDriver.cpp: SensorDriver library files

HYT2X1

This library implements functions for read and configure HYT271 and HYT221 sensors.

hyt2x1.h hyt2x1.cpp: HYT2X1 library files

NTP

This library implements NTP functions for read time over NTP server with ethernet client or sim800 client.

ntp.h ntp.cpp: NTP library files

PCF8563

This library implements PCF8563 functions for communicate with pcf8563 real time clock.

pcf8563.h pcf8563.cpp: PCF8563 library files

SIM800

This library implements SIM800 functions for communicate with SIM800C/SIM800L GSM/GPRS module.

sim800.h sim800.cpp: SIM800 library files

sim800Client.h: SIM800 library interface for Arduino Client.

SIM800C is fully supported, SIM800L is partially supported (coming soon...)

Implemented features

Transport

o) Serial: yes

o) Ethernet: partial (basic functions are present but need to interface with Ethernet Client)

o) MQTT: partial (subscribe functions are present but need to interface with rpc process function)

See ArduinoJsonRPC library

SD-Card files

On the sdcard there is a file called mqtt_ptr.txt containing a binary data in uint32_t format corresponding to the seconds passed since 00:00:00 01/01/1970 indicating the last data sent by MQTT.

The data is recorded on files (one file for each recording day) named in the format yyyy_mm_dd.txt and each data recorded on sd card is MQTT_SENSOR_TOPIC_LENGTH + MQTT_MESSAGE_LENGTH bytes long (look at the mqtt_config.h file).

Each recorded data has the format of the type: TRANGE/LEVEL/VAR { “v”: VALUE, “t”: TIME}

SensorDriver's sensors

o) ADT7420 (ADT)

o) HIH6100 (HIH)

o) HYT221 (HYT)

o) HYT271 (HYT)

o) DigitecoPower (DEP)

o) I2C-TH (STH, ITH, NTH, MTH, XTH)

o) I2C-Rain (TBS, TBR)

o) I2C-Wind (DW1)

other sensors can be easily integrated (see SensorDriver library).