EXG

This module defines a PacketStreamReader for reading packets from an Olimex-EKG-EMG shield.

Details describing how an Olimex-EKG-EMG shield packet is organized are below:

///////////////////////////////////////////////
////////// Packet Format Version 2 ////////////
///////////////////////////////////////////////
17-byte packets are transmitted from Olimexino328 at 256Hz,
using 1 start bit, 8 data bits, 1 stop bit, no parity,
57600 bits per second.

Minimial transmission speed is
256Hz * sizeof(Olimexino328_packet) * 10 = 43520 bps.

struct Olimexino328_packet
{
  uint8_t    sync0;    // = 0xa5
  uint8_t    sync1;    // = 0x5a
  uint8_t    version;  // = 2 (packet version)
  uint8_t    count;    // packet counter. Increases by 1 each packet.
  uint16_t   data[6];  // 10-bit sample (= 0 - 1023) in big endian (Motorola) format.
  uint8_t    switches; // State of PD5 to PD2, in bits 3 to 0.
};
class olimex.exg.PacketStreamReader(port)

Instantiations of this class are iterators and can be passed to the next() function to retrieve the next available Olimex-EKG-EMG packet.

For example:

reader = PacketStreamReader('/path/to/port')
packet = next(reader)

Previous topic

olimex-ekg-emg

Next topic

GUI

This Page