
AqHome Node Base System
=======================

This is a very simple base system especially for old AVR devices like ATtiny and ATmega MCUs
written in pure AVR assembler.

It doesn't use administration objects in RAM, it just defines some routine calls which
have to be added into the system to add new drivers and modules.

Without any modules/drivers included the base system uses:
- <500 words of FLASH (<1KB)
- 6 bytes of SDRAM

With full AqHome network stack (including address assignment protocol):
- about 1700 words of FLASH
- <300 bytes SDRAM (including network buffers)


Currently supported (and in use) are:
- ATtiny 84A
- ATtiny 85
- ATtiny 841
- AtMega 8515
- AtMega 644P


A full system consists of these elements:
- device main app (main device code provided by the user allowing full control by the developer)
- modules (basically drivers implementing support for hardware devices like sensors or displays)
- apps (internal apps combining and extending functionality of driver modules)


The following system routine types are defined:

Function   I  Description                                    I required I add to file
-----------+-------------------------------------------------+----------+----------------------------------
INIT       I  init module/app                                I yes      I modules_init.asm or apps_init.asm
RUN        I  called from the main loop                      I no       I modules_run.asm or apps_run.asm
MSGRECVD   I  called when new messages arrive                I no       I modules_msg.asm or apps_msg.asm
EVERY100MS I  called every 100 millisecs (system timer tick) I no       I modules_100ms.asm or apps_100ms.asm


If the CLOCK module is enabled the following routines are also available:

Function  I  Description                                   I  required I add to file
----------+------------------------------------------------+-----------+----------------------------------
EVERY1S   I  called every second                           I  no       I modules_1s.asm or apps_1s.asm
EVERY1M   I  called every minute                           I  no       I modules_1m.asm or apps_1m.asm
EVERY1H   I  called every hour                             I  no       I modules_1h.asm or apps_1h.asm
EVERY1D   I  called every day                              I  no       I modules_1d.asm or apps_1d.asm


Not all modules implement all those functions. Some modules only need to be called
once every main loop, others need to be called periodically every once in a while.

If a module implements a function a call to that routine must be inserted into the appropriate
file in "avr/devices/all/".

In order to make it easier for devices to optionally include modules/apps those calls need to be
between preprocessor directives like in:

----------------------------------X8
#ifdef MODULES_DS18B20
  bigcall Ds18b20_OnEverySecond
#endif
----------------------------------X8


This way it is very easy to use a module (like that DS18B20 module) by using the
following line in your main code:

----------------------------------X8
#define MODULES_DS18B20
----------------------------------X8

This enables all the function calls for this module. Nothing else needs to be changed in your main
code file in order to enable that module.



For a purely minimal system (without any drivers and apps) see "devices/minimal".
For a system which uses a two-wire-protocol to communicate with a temp/humidity sensor, has a motion sensor
and a photo diode to measure environmental light see "devices/n29". This device uses 5312 bytes FLASH (including
full AqHome network stack with statistics and value reporting) and 295 bytes SDRAM (including network buffers).

