コード例 #1
0
ファイル: ev3api_sensor.c プロジェクト: yuyaotsuka/etrobo
void _initialize_ev3api_sensor() {
	// TODO: Thread safe
	if (pUartSensorData == NULL) {
		sensors[EV3_PORT_1]   = NONE_SENSOR;
		sensors[EV3_PORT_2]   = NONE_SENSOR;
		sensors[EV3_PORT_3]   = NONE_SENSOR;
		sensors[EV3_PORT_4]   = NONE_SENSOR;
		brickinfo_t brickinfo;
		ER ercd = fetch_brick_info(&brickinfo);
		assert(ercd == E_OK);
		pUartSensorData = brickinfo.uart_sensors;
		pAnalogSensorData = brickinfo.analog_sensors;
		assert(pUartSensorData != NULL);
		assert(pAnalogSensorData != NULL);
	}
}
コード例 #2
0
void _initialize_ev3api_motor() {
	// TODO: Thread safe
	assert(pMotorData == NULL);
	if (pMotorData == NULL) {
		mts[EV3_PORT_A]   = NONE_MOTOR;
		mts[EV3_PORT_B]   = NONE_MOTOR;
		mts[EV3_PORT_C]   = NONE_MOTOR;
		mts[EV3_PORT_D]   = NONE_MOTOR;
		brickinfo_t brickinfo;
		ER ercd = fetch_brick_info(&brickinfo);
		assert(ercd == E_OK);
		pMotorReadyStatus = brickinfo.motor_ready;
		pMotorData        = brickinfo.motor_data;
		assert(pMotorData != NULL);
		assert(pMotorReadyStatus != NULL);
	}
}
コード例 #3
0
ファイル: ev3api_newlib.c プロジェクト: yuyaotsuka/etrobo
void _initialize_ev3api_newlib() {
#if 0
	ER ercd;
	ID domid;
	ercd = get_did(&domid);
	assert(ercd == E_OK);
	assert(domid == TDOM_APP); // Newlib should not be used by CSL.
#endif

	// TODO: Thread safe
	assert(mem_pool == NULL);
	if (mem_pool == NULL) {
		brickinfo_t brickinfo;
		ER ercd = fetch_brick_info(&brickinfo);
		assert(ercd == E_OK);
		mem_pool = brickinfo.app_heap;
		assert(mem_pool != NULL);
	}
}