コード例 #1
0
int get_range() {
	int to_return;
	uint16_t adc_data = ACE_get_ppe_sample(adc_handler);
	double voltage = ((double)(adc_data))/4095 * 5;
	int inches = voltage * (512/5);
	to_return = inches;
	int feet = inches/12;
	inches %= 12;
	//printf("Adc_data: %d, voltage: %f, Distance: %d\' %d\"\n\r", adc_data, voltage, feet, inches);
	return inches;
}
コード例 #2
0
ファイル: httpd-cgi.c プロジェクト: Dzenik/FreeRTOS_TEST
static unsigned short generate_io_state( void *arg )
{
	extern long lParTestGetLEDState( unsigned long ulLED );
	unsigned short usRawVoltage;
	const ace_channel_handle_t xVoltageChannel = ( ace_channel_handle_t ) 0;

	( void ) arg;

	/* Are the dynamically setable LEDs currently on or off? */
	if( lParTestGetLEDState( 3 ) )
	{
		pcStatus = "checked";
	}
	else
	{
		pcStatus = "";
	}

	usRawVoltage = ( unsigned short ) ACE_get_ppe_sample( xVoltageChannel );	
	sprintf( uip_appdata, "<input type=\"checkbox\" name=\"LED0\" value=\"1\" %s>LED<p><p><p>Raw voltage input is %d", pcStatus, usRawVoltage );

	return strlen( uip_appdata );
}