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 round(x)   (int)(x + 0.5)

Typedefs

typedef ubyte tByteArray [MAX_ARR_SIZE]
typedef sbyte tsByteArray [MAX_ARR_SIZE]
typedef int tIntArray [MAX_ARR_SIZE]

Functions

void clearI2CError (tSensors link, ubyte address)
bool waitForI2CBus (tSensors link)
bool writeI2C (tSensors link, tByteArray &data, int replylen)
bool readI2C (tSensors link, tByteArray &data, int replylen)

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 2.00 AND HIGHER.

Changelog:

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

Definition in file common.h.