TNC (Terminal Node Controller)

Functions that provide a subset of the TNC functions. More...


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_ttncBufferPnt
 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.


Detailed Description

Functions that provide a subset of the TNC functions.

Define Documentation

#define TNC_BUFFER_SIZE   80

The size of the TNC output buffer.

Definition at line 2293 of file PicoBeacon.c.

#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().


Enumeration Type Documentation

Enumeration of the messages we can transmit.

Enumerator:
TNC_BOOT_MESSAGE  Startup message that contains software version information.
TNC_STATUS  Plain text status message.
TNC_GGA  Message that contains GPS NMEA-0183 $GPGGA message.
TNC_RMC  Message that contains GPS NMEA-0183 $GPRMC message.

Definition at line 2315 of file PicoBeacon.c.

States that define the current mode of the 1200 bps (A-FSK) state machine.

Enumerator:
TNC_TX_READY  Stand by state ready to accept new message.
TNC_TX_SYNC  0x7E bit stream pattern used to define start of APRS message.
TNC_TX_HEADER  Transmit the AX.25 header that contains the source/destination call signs, APRS path, and flags.
TNC_TX_DATA  Transmit the message data.
TNC_TX_END  Transmit the end flag sequence.

Definition at line 2296 of file PicoBeacon.c.


Function Documentation

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void tncHighRate ( bool_t  state  ) 

Definition at line 2397 of file PicoBeacon.c.

References tncHighRateFlag.

Referenced by diagPort().

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.

Returns:
true if ready; otherwise false

Definition at line 2389 of file PicoBeacon.c.

References TNC_TX_READY, and tncMode.

bool_t tncIsTimeSlot ( uint8_t  timeSeconds  ) 

Determine if the seconds value timeSeconds is a valid time slot to transmit a message.

Time seconds is in UTC.

Parameters:
timeSeconds UTC time in seconds
Returns:
true if valid time slot; otherwise false

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void tncSetMode ( TNC_DATA_MODE  dataMode  ) 

Configure the TNC for the desired data mode.

Parameters:
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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.

Parameters:
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.

Parameters:
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().

Here is the call graph for this function:


Variable Documentation

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 }
AX.25 compliant packet header that contains destination, station call sign, and path.

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().

uint8_t tncBuffer[TNC_BUFFER_SIZE]

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().


Generated on Sun Oct 5 11:25:52 2008 for Pico Beacon by  doxygen 1.5.7