Tak pořád bojuju.
Nyní řeším, jak vytáhnout data, která jsou uložené ve funkci:
Mám funkci plynomer:
Kód: Vybrať všetko
uint8_t PLYNOMETR_read( uint8_t id[], int16_t *hodnota )
{
uint8_t sp[PLYNOMETR_SP_SIZE];
uint8_t ret;
ow_reset();
ret = read_scratchpad( id, sp, PLYNOMETR_SP_SIZE );
return ret;
}
Kód: Vybrať všetko
/*cte sratchpad*/
static uint8_t read_scratchpad( uint8_t id[], uint8_t sp[], uint8_t n )
{
uint8_t i;
uint8_t ret;
ow_command( PLYNOMETR_READ, id );
for ( i = 0; i < n; i++ ) {
sp[i] = ow_byte_rd();
}
if ( crc8( &sp[0], PLYNOMETR_SP_SIZE ) ) {
ret = PLYNOMETR_ERROR_CRC;
} else {
ret = PLYNOMETR_OK;
}
return ret;
}
Takže třeba by mě zajímal obsah sp[1]. Napoví někdo?