Defines | |
#define | TNC_TX_DELAY 45 |
The number of start flag bytes to send before the packet message. (360bits * 1200bps = 300mS). | |
#define | TNC_BUFFER_SIZE 80 |
The size of the TNC output buffer. | |
Enumerations | |
enum | TNC_TX_1200BPS_STATE { TNC_TX_READY, TNC_TX_SYNC, TNC_TX_HEADER, TNC_TX_DATA, TNC_TX_END } |
States that define the current mode of the 1200 bps (A-FSK) state machine. More... | |
enum | TNC_MESSAGE_TYPE { TNC_BOOT_MESSAGE, TNC_STATUS, TNC_GGA, TNC_RMC } |
Enumeration of the messages we can transmit. More... | |
Functions | |
void | tncInit () |
Initialize the TNC internal variables. | |
bool_t | tncIsFree () |
Determine if the hardware if ready to transmit a 1200 baud packet. | |
void | tncHighRate (bool_t state) |
void | tncSetMode (TNC_DATA_MODE dataMode) |
Configure the TNC for the desired data mode. | |
bool_t | tncIsTimeSlot (uint8_t timeSeconds) |
Determine if the seconds value timeSeconds is a valid time slot to transmit a message. | |
void | tnc1200TimerTick () |
Method that is called every 833uS to transmit the 1200bps A-FSK data stream. | |
void | tnc9600TimerTick () |
Method that is called every 104uS to transmit the 9600bps FSK data stream. | |
void | tncTxByte (uint8_t character) |
Write character to the TNC buffer. | |
void | tncNMEATime () |
Generate the GPS NMEA standard UTC time stamp. | |
void | tncNMEAFix () |
Generate the GPS NMEA standard latitude/longitude fix. | |
void | tncGPGGAPacket () |
Generate the GPS NMEA-0183 $GPGGA packet. | |
void | tncGPRMCPacket () |
Generate the GPS NMEA-0183 $GPRMC packet. | |
void | tncStatusPacket (int16_t temperature) |
Generate the plain text status packet. | |
void | tncTxPacket (TNC_DATA_MODE dataMode) |
Prepare an AX.25 data packet. | |
Variables | |
uint8_t | TNC_AX25_HEADER [30] |
AX.25 compliant packet header that contains destination, station call sign, and path. | |
uint8_t | tncTxBit |
The next bit to transmit. | |
TNC_TX_1200BPS_STATE | tncMode |
Current mode of the 1200 bps state machine. | |
uint8_t | tncBitCount |
Counter for each bit (0 - 7) that we are going to transmit. | |
uint8_t | tncShift |
A shift register that holds the data byte as we bit shift it for transmit. | |
uint8_t | tncIndex |
Index into the APRS header and data array for each byte as we transmit it. | |
uint8_t | tncLength |
The number of bytes in the message portion of the AX.25 message. | |
uint8_t | tncBitStuff |
A copy of the last 5 bits we've transmitted to determine if we need to bit stuff on the next bit. | |
uint8_t * | tncBufferPnt |
Pointer to TNC buffer as we save each byte during message preparation. | |
TNC_MESSAGE_TYPE | tncPacketType |
The type of message to tranmit in the next packet. | |
uint8_t | tncBuffer [TNC_BUFFER_SIZE] |
Buffer to hold the message portion of the AX.25 packet as we prepare it. | |
bool_t | tncHighRateFlag |
Flag that indicates we want to transmit every 5 seconds. |
#define TNC_BUFFER_SIZE 80 |
#define TNC_TX_DELAY 45 |
The number of start flag bytes to send before the packet message. (360bits * 1200bps = 300mS).
Definition at line 2290 of file PicoBeacon.c.
Referenced by tnc1200TimerTick().
enum TNC_MESSAGE_TYPE |
Enumeration of the messages we can transmit.
Definition at line 2315 of file PicoBeacon.c.
enum TNC_TX_1200BPS_STATE |
States that define the current mode of the 1200 bps (A-FSK) state machine.
Definition at line 2296 of file PicoBeacon.c.
void tnc1200TimerTick | ( | ) |
Method that is called every 833uS to transmit the 1200bps A-FSK data stream.
The provides the pre and postamble as well as the bit stuffed data stream.
Definition at line 2461 of file PicoBeacon.c.
References DDS_MODE_POWERDOWN, ddsSetMode(), IO_OSK, IO_PTT, timeNCOFreq, TNC_AX25_HEADER, TNC_MODE_STANDBY, TNC_TX_DATA, TNC_TX_DELAY, TNC_TX_END, TNC_TX_HEADER, TNC_TX_READY, TNC_TX_SYNC, tncBitCount, tncBitStuff, tncBuffer, tncDataMode, tncIndex, tncLength, tncMode, tncShift, and tncTxBit.
Referenced by timeUpdate().
void tnc9600TimerTick | ( | ) |
Method that is called every 104uS to transmit the 9600bps FSK data stream.
Definition at line 2632 of file PicoBeacon.c.
Referenced by timeUpdate().
void tncGPGGAPacket | ( | ) |
Generate the GPS NMEA-0183 $GPGGA packet.
Data is written through the tncTxByte callback function.
Definition at line 2704 of file PicoBeacon.c.
References GPSPOSITION_STRUCT::altitudeCM, GPSPOSITION_STRUCT::dop, GPS_NO_FIX, gpsGetFixType(), gpsNMEAChecksum(), tncBuffer, tncLength, tncNMEAFix(), tncNMEATime(), tncTxByte(), and GPSPOSITION_STRUCT::trackedSats.
Referenced by tncTxPacket().
void tncGPRMCPacket | ( | ) |
Generate the GPS NMEA-0183 $GPRMC packet.
Data is written through the tncTxByte callback function.
Definition at line 2738 of file PicoBeacon.c.
References GPSPOSITION_STRUCT::day, GPS_NO_FIX, gpsGetFixType(), gpsNMEAChecksum(), GPSPOSITION_STRUCT::heading, GPSPOSITION_STRUCT::hSpeed, GPSPOSITION_STRUCT::month, tncBuffer, tncLength, tncNMEAFix(), tncNMEATime(), tncTxByte(), and GPSPOSITION_STRUCT::year.
Referenced by tncTxPacket().
void tncHighRate | ( | bool_t | state | ) |
void tncInit | ( | ) |
Initialize the TNC internal variables.
Definition at line 2376 of file PicoBeacon.c.
References TNC_BOOT_MESSAGE, TNC_TX_READY, tncHighRateFlag, tncMode, tncPacketType, and tncTxBit.
Referenced by main().
bool_t tncIsFree | ( | ) |
Determine if the hardware if ready to transmit a 1200 baud packet.
Definition at line 2389 of file PicoBeacon.c.
References TNC_TX_READY, and tncMode.
Determine if the seconds value timeSeconds is a valid time slot to transmit a message.
Time seconds is in UTC.
timeSeconds | UTC time in seconds |
Definition at line 2434 of file PicoBeacon.c.
References tncHighRateFlag.
Referenced by main().
void tncNMEAFix | ( | ) |
Generate the GPS NMEA standard latitude/longitude fix.
Data is written through the tncTxByte callback function.
Definition at line 2664 of file PicoBeacon.c.
References GPSPOSITION_STRUCT::latitude, GPSPOSITION_STRUCT::longitude, and tncTxByte().
Referenced by tncGPGGAPacket(), and tncGPRMCPacket().
void tncNMEATime | ( | ) |
Generate the GPS NMEA standard UTC time stamp.
Data is written through the tncTxByte callback function.
Definition at line 2654 of file PicoBeacon.c.
References GPSPOSITION_STRUCT::hours, GPSPOSITION_STRUCT::minutes, GPSPOSITION_STRUCT::seconds, and tncTxByte().
Referenced by tncGPGGAPacket(), and tncGPRMCPacket().
void tncSetMode | ( | TNC_DATA_MODE | dataMode | ) |
Configure the TNC for the desired data mode.
dataMode | enumerated type that specifies 1200bps A-FSK or 9600bps FSK |
Definition at line 2407 of file PicoBeacon.c.
References DDS_MODE_AFSK, DDS_MODE_FSK, ddsSetFSKFreq(), ddsSetMode(), TNC_MODE_1200_AFSK, TNC_MODE_9600_FSK, and tncDataMode.
Referenced by tncTxPacket().
void tncStatusPacket | ( | int16_t | temperature | ) |
Generate the plain text status packet.
Data is written through the tncTxByte callback function.
Definition at line 2772 of file PicoBeacon.c.
References adcGetMainBusVolt(), GPSPOSITION_STRUCT::altitudeFeet, GPSPOSITION_STRUCT::dop, GPS_2D_FIX, GPS_3D_FIX, GPS_NO_FIX, gpsGetFixType(), gpsGetPeakAltitude(), timeHours, timeMinutes, timeSeconds, tncTxByte(), and GPSPOSITION_STRUCT::trackedSats.
Referenced by tncTxPacket().
void tncTxByte | ( | uint8_t | character | ) |
Write character to the TNC buffer.
Maintain the pointer and length to the buffer. The pointer tncBufferPnt and tncLength must be set before calling this function for the first time.
character | to save to telemetry buffer |
Definition at line 2644 of file PicoBeacon.c.
References tncBufferPnt, and tncLength.
Referenced by tncGPGGAPacket(), tncGPRMCPacket(), tncNMEAFix(), tncNMEATime(), tncStatusPacket(), and tncTxPacket().
void tncTxPacket | ( | TNC_DATA_MODE | dataMode | ) |
Prepare an AX.25 data packet.
Each time this method is called, it automatically rotates through 1 of 3 messages.
dataMode | enumerated type that specifies 1200bps A-FSK or 9600bps FSK |
Definition at line 2827 of file PicoBeacon.c.
References IO_OSK, IO_PTT, lm92GetTemp(), LOG_TEMPERATURE, logInt16(), logType(), sysCRC16(), sysLogVoltage(), TNC_AX25_HEADER, TNC_BOOT_MESSAGE, TNC_GGA, TNC_RMC, TNC_STATUS, TNC_TX_READY, TNC_TX_SYNC, tncBitCount, tncBuffer, tncBufferPnt, tncGPGGAPacket(), tncGPRMCPacket(), tncIndex, tncLength, tncMode, tncPacketType, tncSetMode(), tncShift, tncStatusPacket(), tncTxBit, and tncTxByte().
Referenced by main().
Initial value:
{ 'A' << 1, 'P' << 1, 'R' << 1, 'S' << 1, ' ' << 1, ' ' << 1, 0x60, 'K' << 1, 'D' << 1, '7' << 1, 'L' << 1, 'M' << 1, 'O' << 1, 0x76, 'G' << 1, 'A' << 1, 'T' << 1, 'E' << 1, ' ' << 1, ' ' << 1, 0x60, 'W' << 1, 'I' << 1, 'D' << 1, 'E' << 1, '3' << 1, ' ' << 1, 0x67, 0x03, 0xf0 }
0x76 for SSID-11, 0x78 for SSID-12
Definition at line 2332 of file PicoBeacon.c.
Referenced by tnc1200TimerTick(), and tncTxPacket().
Counter for each bit (0 - 7) that we are going to transmit.
Definition at line 2347 of file PicoBeacon.c.
Referenced by tnc1200TimerTick(), and tncTxPacket().
A copy of the last 5 bits we've transmitted to determine if we need to bit stuff on the next bit.
Definition at line 2359 of file PicoBeacon.c.
Referenced by tnc1200TimerTick().
Buffer to hold the message portion of the AX.25 packet as we prepare it.
Definition at line 2368 of file PicoBeacon.c.
Referenced by tnc1200TimerTick(), tncGPGGAPacket(), tncGPRMCPacket(), and tncTxPacket().
Pointer to TNC buffer as we save each byte during message preparation.
Definition at line 2362 of file PicoBeacon.c.
Referenced by tncTxByte(), and tncTxPacket().
Flag that indicates we want to transmit every 5 seconds.
Definition at line 2371 of file PicoBeacon.c.
Referenced by tncHighRate(), tncInit(), and tncIsTimeSlot().
Index into the APRS header and data array for each byte as we transmit it.
Definition at line 2353 of file PicoBeacon.c.
Referenced by tnc1200TimerTick(), and tncTxPacket().
The number of bytes in the message portion of the AX.25 message.
Definition at line 2356 of file PicoBeacon.c.
Referenced by tnc1200TimerTick(), tncGPGGAPacket(), tncGPRMCPacket(), tncTxByte(), and tncTxPacket().
Current mode of the 1200 bps state machine.
Definition at line 2344 of file PicoBeacon.c.
Referenced by tnc1200TimerTick(), tncInit(), tncIsFree(), and tncTxPacket().
The type of message to tranmit in the next packet.
Definition at line 2365 of file PicoBeacon.c.
Referenced by tncInit(), and tncTxPacket().
A shift register that holds the data byte as we bit shift it for transmit.
Definition at line 2350 of file PicoBeacon.c.
Referenced by tnc1200TimerTick(), and tncTxPacket().
The next bit to transmit.
Definition at line 2341 of file PicoBeacon.c.
Referenced by tnc1200TimerTick(), tncInit(), and tncTxPacket().