o: ActiveSupport::Cache::Entry :@compressedF:@value"þ'"ø'
| main.c | ||
|---|---|---|
| 182 | 182 |
rxfifo.idx_r = i; |
| 183 | 183 |
|
| 184 | 184 |
return d; |
| 185 |
} |
|
| 185 |
} |
|
| 186 |
|
|
| 187 |
/* Put a character to transmit */ |
|
| 188 |
static |
|
| 189 |
void uart_put (uint8_t d) |
|
| 190 |
{
|
|
| 191 |
while (bit_is_clear(UCSR0A, UDRE0)); |
|
| 192 |
UDR0 = d; |
|
| 193 |
} |
|
| 194 |
|
|
| 195 |
|
|
| 196 | 186 |
/* USART0 RXC interrupt */ |
| 197 | 187 |
ISR(USART_RX_vect) |
| 198 | 188 |
{
|
| ... | ... | |
| 272 | 262 |
return c; |
| 273 | 263 |
} |
| 274 | 264 |
|
| 275 |
|
|
| 276 |
|
|
| 277 |
/* Initialize GPS module (depends on each product) */ |
|
| 278 |
static |
|
| 279 |
void gp_init (void) |
|
| 280 |
{
|
|
| 281 |
const prog_char *s = |
|
| 282 |
PSTR("$PSRF106,21*0F\r\n"); // Select datum of WGS84 (for EM-406A)
|
|
| 283 |
char c; |
|
| 284 |
|
|
| 285 |
while ((c = pgm_read_byte(s++)) != 0) uart_put(c); |
|
| 286 |
} |
|
| 287 |
|
|
| 288 |
|
|
| 289 |
|
|
| 290 | 265 |
/* Get a column item */ |
| 291 | 266 |
static |
| 292 | 267 |
BYTE* gp_col ( /* Returns pointer to the item (returns a NULL when not found) */ |
| ... | ... | |
| 365 | 340 |
|
| 366 | 341 |
beep(5, 1); // Single beep. Start to get current time. |
| 367 | 342 |
uart_init(); |
| 368 |
gp_init(); // Initialize GPS module to let output data in NMEA-0183 format. |
|
| 369 | 343 |
do { // Wait for valid RMC sentence.
|
| 370 | 344 |
b = get_line(); |
| 371 | 345 |
if (!b) break; |
| ... | ... | |
| 396 | 370 |
) |
| 397 | 371 |
{
|
| 398 | 372 |
if (f_write(&file1, Buff, b, &s) || b != s) { err = 5; break; };
|
| 399 |
itoa(battery,&Value1,10);
|
|
| 373 |
/* itoa(battery,&Value1,10); // convert binary number to character
|
|
| 400 | 374 |
itoa(intensity,&Value2,10); |
| 401 | 375 |
strcpy(&Buff[0], Value1); |
| 402 | 376 |
strcpy_P(&Buff[4], PSTR(","));
|
| 403 | 377 |
strcpy(&Buff[5], Value2); |
| 404 | 378 |
strcpy_P(&Buff[9], PSTR("\r\n"));
|
| 405 |
if (f_write(&file1, Buff, 11, &s) || 11 != s) { err = 5; break; };
|
|
| 406 |
} |
|
| 379 |
if (f_write(&file1, Buff, 11, &s) || 11 != s) { err = 8; break; };
|
|
| 380 |
*/ }
|
|
| 407 | 381 |
if ((Stat & 4) == 0) continue; |
| 408 | 382 |
if (f_sync(&file1)) { err = 6; break; };// Synchronize the file in interval of 300 sec.
|
| 409 | 383 |
cli(); Stat &= 0xFB; sei(); // Clear sync request |