Ejemplo n.º 1
0
void sendCalibration()
{
    serialBegin();
    dumpCalibration();
    printNL();
    dumpCalibration();
    printNL();
    serialEnd();
}
Ejemplo n.º 2
0
void printV(char c,uint8_t nr, AnalogInputs::ValueType value)
{
    printChar(c);
    printUInt(nr);
    printChar('=');
    printUInt(value);
    printNL();
}
Ejemplo n.º 3
0
void dumpCalibration()
{
    printString("V=" CHEALI_CHARGER_VERSION_STRING);
    printNL();
    printV('E',0,CHEALI_CHARGER_EEPROM_CALIBRATION_VERSION);
    printV('E',1,CHEALI_CHARGER_EEPROM_PROGRAMDATA_VERSION);
    printV('E',2,CHEALI_CHARGER_EEPROM_SETTINGS_VERSION);

    AnalogInputs::CalibrationPoint p;
    FOR_ALL_PHY_INPUTS(it) {
        AnalogInputs::getCalibrationPoint(p,it,0);
        printV('a',it, p.x);
        printV('r',it, p.y);
        AnalogInputs::getCalibrationPoint(p,it,1);
        printV('A',it, p.x);
        printV('R',it, p.y);
    }
}
Ejemplo n.º 4
0
static enum dfu_status setup_write( size_t off, size_t len, void **buf )
{
	static int last = 0;

#ifdef FLASH_DEBUG
	// Debug
	print("Setup Write: offset(");
	printHex( off );
	print(") len(");
	printHex( len );
	print(") last(");
	printHex( last );
	printNL(")");
#endif

	if ( len > sizeof(staging) )
	{
		return DFU_STATUS_errADDRESS;
	}

	// We only allow the last write to be less than one sector size.
	if ( off == 0 )
	{
		last = 0;
	}
	if ( last && len != 0 )
	{
		return DFU_STATUS_errADDRESS;
	}
	if ( len != USB_DFU_TRANSFER_SIZE )
	{
		last = 1;
		memset( staging, 0xff, sizeof(staging) );
	}

	*buf = staging;
	return DFU_STATUS_OK;
}
Ejemplo n.º 5
0
void sendEnd()
{
    //checksum
    printUInt(CRC);
    printNL();
}