paparazzi/paparazzi — pull request #635 by podhrmic (2014-01-27 19:54:37+00:00)
Title: [rt_logger] Added EventSources and EventListeners

* for subsystems not running at PERIODIC_FREQUENCY (such as radio, electrical, gps)

The idea is top have event sources associated with new data available for each subsystem (i.e. update on GPS position is received). This is defined in the callbacks for the subsystems.

The rest of data (i.e. control performance) is logged on periodic basis (at PERIODIC_FREQUENCY).

The optional logger is a module which saves the data (in this case to Gumstix via serial port - uart1). The module would have listening threads for each submodule, if event is triggered, data are saved - something like this:
```
__attribute__((noreturn)) msg_t thd_dummy(void *arg)
{
chRegSetThreadName("module_logger");
(void) arg;

EventListener elGpsData;
chEvtRegister(&eventGpsData, &elGpsData, EVT_GPS_DATA);

while (TRUE)
{
chEvtWaitAny(EVENT_MASK(EVT_GPS_DATA));
send_gps_data();
}
}
```

**Advantages**
- no need to have logger specific code, all is handled in the module and the event sources have minimal footprint, so they can stay on all the time

**Disadvantages**
- the logger would have to have a listening thread for each event source (e.g. gps, radio, electrical...), which is not very economical, but with lisa-mx it is not a big deal to have 3 extra threads (256bytes each)