Here's a tiny sketch demonstrating conscious packet handling. It opens the south face in 'conscious mode', at 9600 8N1, but leaves the others (including north) to default to reflex mode. Then it polls for southern packets, and whenever it finds one, it embeds it in a northbound 'L'og packet.

(This sketch also demonstrates facePrintf, using the SFB-specific (and confusing-looking) '%#p' format code. In facePrintf, '%p' takes a packet pointer and appends the contents of that packet to the output. When the '#' "modifier" is added to '%p' (as in this case), it means append the packet contents, but print any 'non-printable' ASCII characters in hexadecimal.)

// log: Read packets consciously from SOUTH, log them to NORTH

void setup() {
  SouthFace.begin(9600,false);  // Open south in conscious packet mode, 9600 8N1
}                               // (NORTH unmentioned, defaults to reflex packet mode)

void loop() { 
  u8 * packet = SouthFace.readPacket(); // Check for packet from south

  if (packet)                  // Got one!
    facePrintf(NORTH,"Ld '%#p'\n",packet); // Wrap it in a Log packet and send it NORTH

Generated on Fri Apr 22 06:54:10 2011 for SFB by doxygen 1.5.9