Skip to content
This repository was archived by the owner on Jul 31, 2018. It is now read-only.

Library

sirwolfgang edited this page Apr 24, 2011 · 6 revisions

Communication

Communication is handled over a i2c connection.

Current Protocol Definition

The data is wrapped in a Packet class. This is a templated class and will allow for the following data types to exist in the library.

#define TYPENULL    0      // To be used for No data, packet is not sent.
#define TYPEBOOL    1      // Boolean
#define TYPEINT     2      // Integer
#define TYPEFLOAT   3      // Floating Point Number
#define TYPELONG    4      // Long Integer
#define TYPEBYTE    5      // Byte, Custom usage
#define TYPETIME    6      // Unsigned Long Integer, Can store milliseconds from startup for 50 days before overflow

Along with that data is a unit data section that consist of 5 characters plus a null terminator. This allows you to "m/s^2" as your unit. Changing this is as easy as changing line 11 in packet.h:

#define UNIT_LEN   5       // Note: The +1 for Null isn't included in this number, but added by the class

The third section of data is a status bool. Currently there isn't a document use for this bool. It is planned in later versions of the Sensing to change this bool into a bit masked byte. This would allow for use of 8 bool flags. The first one to be used as a ready or not ready, while the last one is to be used for multi data sensors.

0 - Not Ready / Ready
1 -
2 -
3 -
4 -
5 -
6 -
7 - More Data

Clone this wiki locally