Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Defines | Typedefs | Functions

common.h File Reference

Commonly used functions used by drivers. More...

#include "firmwareVersion.h"

Go to the source code of this file.

Defines

#define __COMMON_H_SENSOR_CHECK__   1
#define MAX_ARR_SIZE   17
#define min2(a, b)   (a < b ? a : b)
#define min3(a, b, c)   (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c)
#define max2(a, b)   (a > b ? a : b)
#define max3(a, b, c)   (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c)
#define clip(a, b, c)   min2(c, max2(b, a))
#define STRTOK_MAX_TOKEN_SIZE   20
#define STRTOK_MAX_BUFFER_SIZE   50

Typedefs

typedef ubyte tByteArray [MAX_ARR_SIZE]
typedef sbyte tsByteArray [MAX_ARR_SIZE]
typedef ubyte tMassiveArray [128]
typedef ubyte tHugeByteArray [64]
typedef ubyte tBigByteArray [32]
typedef ubyte tIPaddr [4]
typedef int tIntArray [MAX_ARR_SIZE]

Functions

void clearI2CError (tSensors link, ubyte address)
void clearI2Cbus (tSensors link)
bool waitForI2CBus (tSensors link)
bool writeI2C (tSensors link, tByteArray &request, tByteArray &reply, int replylen)
bool writeI2C (tSensors link, tByteArray &request)
long getUID ()
bool strtok (char *buffer, char *token, char *seperator)

Detailed Description

Commonly used functions used by drivers.

common.h provides a number of frequently used functions that are useful for writing drivers. License: You may use this code as you wish, provided you give credit where its due.

THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.

Changelog:

Author:
Xander Soldaat (xander_at_botbench.com)
Date:
27 April 2011
Version:
0.16

Definition in file common.h.