Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 507 → Rev 506

/C-OSD/trunk/main.c
160,8 → 160,6
* timer stuff
* ##########################################################################*/
 
static uint8_t delay_spi = 0;
 
/**
* timer kicks in every 1000uS ^= 1ms
*/
172,12 → 170,8
seconds_since_last_data++;
}
// in case there is still some spi data to send do it now
// delay to give the slave some time to compute values
if (spi_ready && icnt) {
if (!delay_spi--) {
delay_spi = 8;
spi_send_next();
}
SPDR = *iptr;
}
}
#endif // ends !(ALLCHARSDEBUG|(WRITECHARS != -1))#endif // ends !(ALLCHARSDEBUG|(WRITECHARS != -1))
325,11 → 319,18
// in case SPI is ready and there is nothing to send right now
if (!icnt && spi_ready) {
// correct transfer ends with d (done)
if (SPI_buffer.buffer.chk == 'd') {
ampere = SPI_buffer.data.ampere;
ampere_wasted = SPI_buffer.data.mah;
s_volt = SPI_buffer.data.volt;
 
if (spi_cmd_buffer[0] == 'd') {
ampere = spi_cmd_buffer[1] << 8;
ampere |= spi_cmd_buffer[2];
ampere_wasted = spi_cmd_buffer[3];
ampere_wasted = ampere_wasted << 8;
ampere_wasted |= spi_cmd_buffer[4];
ampere_wasted = ampere_wasted << 8;
ampere_wasted |= spi_cmd_buffer[5];
ampere_wasted = ampere_wasted << 8;
ampere_wasted |= spi_cmd_buffer[6];
//ampere = *((int16_t *) spi_cmd_buffer + 1);
//ampere_wasted = *((int32_t *) &spi_cmd_buffer + 3);
// if this is the first receival we should print the small A
if (!(COSD_FLAGS2 & COSD_FLAG_STROMREC)) {
clear();
337,11 → 338,20
// update this flag
COSD_FLAGS2 |= COSD_FLAG_STROMREC;
}
//write_ascii_char(8+4*30, 'v'); // valid
} else {
// update flags
COSD_FLAGS2 &= ~COSD_FLAG_STROMREC;
//write_ascii_char(8+4*30, 'i'); // invalid
}
StartTransfer(9);
spi_cmd_buffer[0] = 'A';
spi_cmd_buffer[1] = 'B';
spi_cmd_buffer[2] = 'C';
spi_cmd_buffer[3] = 'D';
spi_cmd_buffer[4] = 'E';
spi_cmd_buffer[5] = 'F';
spi_cmd_buffer[6] = 'G';
StartTransfer((unsigned char*) spi_cmd_buffer, 7);
}
if (rxd_buffer_locked) {
#if FCONLY