User manual

AREXX Engineering & JM3 Engineering
Version: 1.20 Apr. 20, 2014 page: 11
Here an example how to add in C-code in the C++ world (taken from the Demo Program):
/**********************************************************************\
* IO Extension Demo Program
* main.cpp
* v 1.1.0
\**********************************************************************/
extern "C"
{
#include "RP6M256.h"
#include "RP6M256Lib.h"
#include "RP6M256uart.h"
#include "RP6I2CmasterTWI.h"
#include "Yourcode.h" <- include your C-code modules inside 'extern "C"'!
}
#include "ioExt.h" <- include your C++-code modules outside of 'extern "C"'!
. . . . // some code is not shown here
int main() __attribute__((noreturn));
int main()
{
initRP6M256(); <- function calls of C-code modules
I2CTWI_initMaster(400);
initLCD();
clearLCD();
// init RP6 Io Extension
ioExt::Initialize(); <- function calls of C++-code modules (with namespaces)
// set RTC test date and time in local structure
ioExt::rtc.setDay(07);
ioExt::rtc.setMonth(03);
ioExt::rtc.setYear(2013);
ioExt::rtc.setHour(23);
ioExt::rtc.setMinute(59);
ioExt::rtc.setSecond(55);
. . . // more code
2.2 I2C bus addresses
Sensor
Address
LSM303 Accelerometer
0x32
LSM303 Magnetometer
0x3C
MAX7311AUG / TCA9555 IO-Expansion
0x40
TCA6507 LED Driver
0x8A
LM75 Temperature Sensor
0x90
DS1339U Real Time Clock
0xD0
PCA9685 PWM Controller
0x88