static PyObject *py_set_green_led(PyObject *self, PyObject *args,PyObject *kwds) { int on=1, ret; static char *kwlist[] = {"on", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist, &on)) { PyErr_SetString(PyExc_Exception, "Bad arguments."); return NULL; } ret = set_green_led(on); if(ret < 0) { PyErr_SetString(PyExc_Exception, "Failed to set green LED."); return NULL; } Py_RETURN_NONE; }
void IR_range_blast(uint16_t power) { delay_ms(POST_BROADCAST_DELAY); //uint32_t timer[20]; //timer[0] = get_16bit_time(); //Top of the function. uint16_t pre_sync_op = get_16bit_time(); for(uint8_t dir = 0; dir < 6; dir++) { set_ir_power(dir, power); } while((get_16bit_time() - pre_sync_op) < TIME_FOR_SET_IR_POWERS); //set_rgb(128,0,64); //_delay_ms(1); //led_off(); //_delay_ms(10); for(uint8_t dir = 0; dir < 6; dir++) { //IR_emit(dir, DELAY_BETWEEN_RB_MEASUREMENTS*NUMBER_OF_RB_MEASUREMENTS); //timer[(3*dir + 0) + 1] = get_16bit_time();//Top of the for loop. delay_ms((DELAY_BETWEEN_RB_MEASUREMENTS + TIME_FOR_GET_IR_VALS)*(NUMBER_PRE_MEASUREMENTS)); IR_emit(dir, (DELAY_BETWEEN_RB_MEASUREMENTS + TIME_FOR_GET_IR_VALS)*(NUMBER_OF_RB_MEASUREMENTS - (NUMBER_PRE_MEASUREMENTS + NUMBER_POST_MEASUREMENTS + 1))); //The -1 is 'cause we shouldn't count the baseline measurements. delay_ms((DELAY_BETWEEN_RB_MEASUREMENTS + TIME_FOR_GET_IR_VALS)*(NUMBER_POST_MEASUREMENTS)); //timer[(3*dir + 1) + 1] = get_16bit_time();//post emit set_green_led(100); delay_ms(DELAY_BETWEEN_RB_TRANSMISSIONS); led_off(); //timer[(3*dir + 2) + 1] = get_16bit_time();//bottom of the for loop. //_delay_ms(10); //IR_emit(1, DELAY_BETWEEN_RB_MEASUREMENTS*NUMBER_OF_RB_MEASUREMENTS-20); // strictly for debugging the timing //_delay_ms(DELAY_BETWEEN_RB_TRANSMISSIONS+10); } //timer[19] = get_16bit_time();//End of function. //debug_print_timer(timer); }
void get_IR_range_readings() { delay_ms(POST_BROADCAST_DELAY); //uint32_t timer[20]; //timer[0] = get_16bit_time(); //Top of the function. delay_ms(TIME_FOR_SET_IR_POWERS); for(uint8_t emitter_dir = 0; emitter_dir < 6; emitter_dir++) // Transmitter goes through 6 directions, one at a time { //timer[(3*emitter_dir + 0) + 1] = get_16bit_time();//Top of the for loop. for(uint8_t meas_num = 1; meas_num < NUMBER_OF_RB_MEASUREMENTS; meas_num++) { uint16_t pre_sync_op = get_16bit_time(); for (uint8_t sensor_num = 0; sensor_num < 6; sensor_num++) { bright_meas[emitter_dir][sensor_num][meas_num] = get_IR_sensor(sensor_num); } while((get_16bit_time() - pre_sync_op) < TIME_FOR_GET_IR_VALS); //if (meas_num < NUMBER_OF_RB_MEASUREMENTS - 1) //{ delay_ms(DELAY_BETWEEN_RB_MEASUREMENTS); //} } //timer[(3*emitter_dir + 1) + 1] = get_16bit_time();//post emit set_green_led(100); delay_ms(DELAY_BETWEEN_RB_TRANSMISSIONS); led_off(); //timer[(3*emitter_dir + 2) + 1] = get_16bit_time(); //bottom of the for loop. }// end loop through PHYSICALLY LOOKING AT the 6 emitters, recording DATA //timer[19] = get_16bit_time();//End of function. //debug_print_timer(timer); }
JNIEXPORT jint JNICALL Java_com_buglabs_bug_jni_camera_CameraControl_ioctl_1BMI_1CAM_1GREEN_1LED_1ON(JNIEnv * env, jobject jobj) { return set_green_led(1); }