2 * Copyright © 2013 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 static uint8_t log_year, log_month, log_day;
23 static uint8_t log_open;
24 static uint8_t log_mutex;
32 sprintf(name,"%04d%02d%02dLOG", 2000 + log_year, log_month, log_day);
33 status = ao_fat_open(name, AO_FAT_OPEN_WRITE);
36 ao_fat_seek(0, AO_FAT_SEEK_END);
40 status = ao_fat_creat(name);
41 if (status == AO_FAT_SUCCESS)
61 ao_log_mega(struct ao_log_mega *log)
64 ao_mutex_get(&log_mutex);
65 if (log->type == AO_LOG_GPS_TIME) {
67 (log_year != log->u.gps.year ||
68 log_month != log->u.gps.month ||
69 log_day != log->u.gps.day)) {
73 log_year = log->u.gps.year;
74 log_month = log->u.gps.month;
75 log_day = log->u.gps.day;
80 wrote = ao_fat_write(log, sizeof (*log)) == AO_FAT_SUCCESS;
83 ao_mutex_put(&log_mutex);