/* * Initialize the specified port to be used for I2C communication * NOTE: user defined I2C sensor initialize function should be implemented * in user defined an OSEK initialization Task (not in LEJOS OSEK device init hook). * because device init hook is invoked in a loop while the button instruction screen is appeared. */ void init_nxtcam(U8 port_id) { nxt_avr_set_input_power(port_id, 2); i2c_enable(port_id); int i; for (i = 0; i < 41; i++) nxtcamdata[i] = 0; }
/* * Initialize the specified port to be used for I2C communication * NOTE: user defined I2C sensor initialize function should be implemented * in user defined an OSEK initialization Task (not in LEJOS OSEK device init hook). * because device init hook is invoked in a loop while the button instruction screen is appeared. */ void init_genericI2C_sensor(U8 port_id) { nxt_avr_set_input_power(port_id,2); i2c_enable(port_id); }
void sp_set_power(int port, int val) { nxt_avr_set_input_power(port, val); }
/** * Initiate Arduino driver, don't forget to call i2c_init() after. * Set up i2c port, tram communication and *power* supply. * @param[in] i2c_port NXT port where Arduino is connected */ void init_camduino(int i2c_port){ arduino_port = i2c_port; enum i2c_conf conf[] = {I2C_CONF_GETDATA}; nxt_avr_set_input_power(arduino_port, 2); i2c_start(arduino_port, conf, 0); }