2015-04-13 10:59:47 +02:00
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
#include "cw.h"
|
2015-04-13 10:59:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cw_put_image_data(uint8_t *dst,FILE *infile)
|
|
|
|
{
|
|
|
|
int bytes = fread(dst+1,1,1024,infile);
|
|
|
|
|
|
|
|
if (ferror(infile)){
|
2018-03-25 10:35:53 +02:00
|
|
|
cw_set_byte(dst+0,5);
|
2015-04-13 10:59:47 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( feof(infile)){
|
|
|
|
/* Last image block */
|
2018-03-25 10:35:53 +02:00
|
|
|
cw_set_byte(dst,2);
|
2015-04-13 10:59:47 +02:00
|
|
|
}
|
|
|
|
else{
|
2018-03-25 10:35:53 +02:00
|
|
|
cw_set_byte(dst,1);
|
2015-04-13 10:59:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return bytes+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|