X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=notes.txt;h=aac6707b6a61c2ec365ba1344315bd0f448febba;hp=f8c697a94e62679fbf9c116cfe138a64b2a120e2;hb=8e219fe02de38683879295e5bd42b67ce9d5b849;hpb=77bb6b12d54cdf65955a57cb897727b156685a82 diff --git a/notes.txt b/notes.txt index f8c697a..aac6707 100644 --- a/notes.txt +++ b/notes.txt @@ -105,10 +105,13 @@ interrupt, software interrupts and background tasks problem description ------------------- -Today, Both command line code, xbee char reception and callout events +Today, both command line code, xbee char reception and callout events are handled in the main loop, with the lowest priority. Therefore, the command line cannot block, else the timers + xbee rx won't be executed. +A typical example where the command line blocks is the completion with +many choices. + solution -------- @@ -136,7 +139,6 @@ From highest to lowest priority. - Events, called from timer interrupt after a call to sei(): - LED_PRIO: led blink - - TIME_PRIO: monitor time - BEEP_PRIO: process beep requests and modifies the beep_mask - SPI_PRIO: send and receive SPI data to the atmega168p - CS_PRIO: do the control system of the wing, reading infos from a @@ -159,3 +161,59 @@ Rules Calling a xbee function needs to set prio to XBEE_PRIO only. Calling i2c_send_command must be done from a lower prio than I2C_PRIO. + +libxbee / xbee module +===================== + +Library +------- + +xbee_dev = structure describing an xbee device +xbee_channel = structure describing a channel, used to associates a req + with its answer + +xbee.[ch]: main interface to libxbee, creation of dev, registeration of channels +xbee_atcmd.[ch]: get an AT command from its name or small id string +xbee_buf.[ch]: not used +xbee_neighbor.[ch]: helper to add/delete neighbors, use malloc()/free() +xbee_rxtx.[ch]: parse rx frames, provides xbee_proto_xmit() +xbee_stats.[ch]: helper to maintain stats + +App +--- + +move this in library ? + +xbeeapp_send(addr, data, len, timeout, cb, arg) +XXX to detail + +Timeout for xbee commands +========================= + +- send_atcmd or send_msg (xbee_prio) + + - allocate a channel and a context + - fill the context with info + - send the message + - load a timeout (xbee_prio) + +- on timeout (xbee_prio) + + - log error + - call the cb with retcode == TIMEOUT + - unregister channel + - remove timer + - this could be a critical error + - if it's a comm error, it's ok + - but if the channel is registered again and 1st callback finally occurs... + +- on rx (xbee_prio) + + - if there is a context, it's related to a query: + - remove the timeout + - unregister channel + - do basic checks on the frame + - log (hexdump) + - the frame must be checked in the cb, we can provide helpers + +