Pico-IrDA Manual

Overview

Pico-IrDA is a minimalistic IrDA stack for microcontrollers.
It supports IrOBEX in primary and secondary IrDA mode and IrCOMM in secondary mode only.
Pico-IrDA works with a fixed baudrate of 9600 bps and is restricted to two communication peers.

Library Initialization

An application needs to reset the physical layer and initialize an IrLAP_Context, which holds state information about the session.
IrLAP_Context ctx;

irphy_reset();
irlap_init_context(&ctx);

Physical Interface

The library uses four functions defined in "irphy.h" to interface with the physical IrDA transceiver.

IrOBEX Interface

The simplest form of using the library is to send and/or receive data via IrOBEX.
Sending data is done by selecting the IrDA primary mode, receiving data puts the device into IrDA secondary mode.

IrCOMM Interface

The IrCOMM protocol is only supported in IrDA secondary mode.

Selecting Protocol

In IrDA secondary mode, it is possible to distinguish between incoming IrOBEX and IrCOMM messages using the "irttp2_accept" function.
You need to announce the availability of the IrIAS LsapSel values that relate to the corresponding protocols and set the proper IrLMP hints.
Example:
IrLAP_Context ctx;
IrIAS_Node *ias_nodes[3];
int16_t dlsap_sel;

irphy_reset();
irlap_init_context(&ctx);

/* ias_nodes contains all the IrIAS LsapSel values we support */
ias_nodes[0]=&irobex_ias_node;
ias_nodes[1]=&ircomm_ias_node;
ias_nodes[2]=0;

for(;;) {
  irphy_wait(-1);
  if((dlsap_sel=irttp2_accept(&ctx, IRLMP_HINT1_OBEX | IRLMP_HINT1_COMM, ias_nodes))<0)
    continue;
  switch(dlsap_sel) {
  case IRCOMM_LSAP_SEL_VAL:
    handle_ircomm();
    break;
  case IROBEX_LSAP_SEL_VAL:
    handle_irobex();
    break;
  }
}

Copyright Notice

Copyright © 2002-2003 Gerd Rausch, BlauLogic
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Except as contained in this notice, neither the name of BlauLogic nor the name(s) of the author(s) may be used to endorse or promote products derived from this software without specific prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) OR BLAULOGIC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.