2 * Copyright © 2012 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; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 #include <ao_telemetry.h>
29 #define AO_GPS_NUM_SAT_MASK (0xf << 0)
30 #define AO_GPS_NUM_SAT_SHIFT (0)
32 #define AO_GPS_VALID (1 << 4)
33 #define AO_GPS_RUNNING (1 << 5)
34 #define AO_GPS_DATE_VALID (1 << 6)
35 #define AO_GPS_COURSE_VALID (1 << 7)
37 struct ao_telemetry_location ao_gps_data;
38 struct ao_telemetry_satellite ao_gps_tracking_data;
42 typedef int16_t (*ao_radio_fill_func)(uint8_t *buffer, int16_t len);
47 ao_aprs_bit(uint8_t bit)
50 printf ("%6d %d\n", seq++, bit ? 1 : 0);
54 ao_aprs_bit(uint8_t bit)
56 putchar (bit ? 0xc0 : 0x40);
61 ao_radio_send_aprs(ao_radio_fill_func fill);
64 aprs_bit_debug(uint8_t tx_bit)
66 fprintf (stderr, "bit %d\n", tx_bit);
70 aprs_byte_debug(uint8_t tx_byte)
72 fprintf(stderr, "byte %02x\n", tx_byte);
74 #define APRS_BIT_DEBUG(x) aprs_bit_debug(x)
75 #define APRS_BYTE_DEBUG(y) aprs_byte_debug(y)
80 * @section copyright_sec Copyright
82 * Copyright (c) 2001-2009 Michael Gray, KD7LMO
87 * @section gpl_sec GNU General Public License
89 * This program is free software; you can redistribute it and/or modify
90 * it under the terms of the GNU General Public License as published by
91 * the Free Software Foundation; either version 2 of the License, or
92 * (at your option) any later version.
94 * This program is distributed in the hope that it will be useful,
95 * but WITHOUT ANY WARRANTY; without even the implied warranty of
96 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97 * GNU General Public License for more details.
99 * You should have received a copy of the GNU General Public License
100 * along with this program; if not, write to the Free Software
101 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
110 int samples = secs * 9600;
117 // This is where we go after reset.
118 int main(int argc, char **argv)
122 ao_gps_data.latitude = (45.0 + 28.25 / 60.0) * 10000000;
123 ao_gps_data.longitude = (-(122 + 44.2649 / 60.0)) * 10000000;
124 AO_TELEMETRY_LOCATION_SET_ALTITUDE(&ao_gps_data, 84);
125 ao_gps_data.flags = (AO_GPS_VALID|AO_GPS_RUNNING);
127 /* Transmit one packet */
130 tncBuffer[strlen((char *) tncBuffer) - 2] = '\0';
131 fprintf(stderr, "packet: %s\n", tncBuffer);
137 ao_radio_send_aprs(ao_radio_fill_func fill)
141 uint8_t buf[16], *b, c;
145 len = (*fill)(buf, sizeof (buf));
153 for (bit = 0; bit < 8; bit++) {
154 ao_aprs_bit(c & 0x80);