Changeset - 9716361162e0
[Not reviewed]
default
0 5 0
ethanzonca@CL-SEC241-08.cedarville.edu - 12 years ago 2012-11-08 15:40:33
ethanzonca@CL-SEC241-08.cedarville.edu
ax25 implementation complete (compiles)
5 files changed with 27 insertions and 6 deletions:
0 comments (0 inline, 0 general)
master/master/config.h
Show inline comments
 
@@ -3,13 +3,25 @@
 
 *
 
 * Created: 10/25/2012 3:28:22 PM
 
 *  Author: ethanzonca
 
 */ 
 
 
 
#ifndef CONFIG_H_
 
#define CONFIG_H_
 
 
#define F_CPU 11059200
 
#define MODULE_ID '1'
 
 
// --------------------------------------------------------------------------
 
// AX.25 config (ax25.c)
 
// --------------------------------------------------------------------------
 

	
 
// TX delay in milliseconds
 
#define TX_DELAY      300
 

	
 
// Maximum packet delay
 
#define MAX_PACKET_LEN 512  // bytes
 
 
 
 
#endif /* CONFIG_H_ */
 
\ No newline at end of file
master/master/lib/afsk.c
Show inline comments
 
/*
 
 * fsk.c
 
 *
 
 * Created: 10/29/2012 7:40:34 PM
 
 *  Author: ethanzonca
 
 */
 

	
 
#define F_CPU 11059200
 

	
 
#include "../config.h"
 

	
 
#include <stdint.h>
 
#include <stdbool.h>
 
#include <avr/io.h>
 
#include <avr/interrupt.h> 
 
#include <util/delay.h>
 
#include <avr/pgmspace.h>
 

	
 

	
 
PROGMEM extern const uint8_t afsk_sine_table[512] = {
 
  127, 129, 130, 132, 133, 135, 136, 138, 139, 141, 143, 144, 146, 147, 149, 150, 152, 153, 155, 156, 158, 
 
  159, 161, 163, 164, 166, 167, 168, 170, 171, 173, 174, 176, 177, 179, 180, 182, 183, 184, 186, 187, 188, 
master/master/lib/afsk.h
Show inline comments
 
/*
 
 * afsk.h
 
 *
 
 * Created: 10/29/2012 7:43:03 PM
 
 *  Author: ethanzonca
 
 */ 
 
 
 
#ifndef AFSK_H_
 
#define AFSK_H_
 
 
// Private
 
void afsk_output_sample(uint8_t s);
 
void afsk_timer_stop();
 
 
// Public
 
void afsk_setup();
 
void afsk_test();
 
void afsk_send(const uint8_t *buffer, int len);
 
int afsk_busy();
 
void afsk_start();
 
 
#endif /* AFSK_H_ */
 
\ No newline at end of file
master/master/lib/ax25.c
Show inline comments
 
/*
 
 * ax25.c
 
 *
 
 * Created: 10/30/2012 12:16:41 PM
 
 *  Author: ethanzonca
 
 */ 
 
 
/*
 

	
 
#include <inttypes.h>
 
#include "../config.h"
 
#include "ax25.h"
 
#include "afsk.h"
 

	
 
// Module constants
 
#define MAX_PACKET_LEN 512  // bytes
 

	
 
// Module globals
 
static uint16_t crc;
 
static uint8_t ones_in_a_row;
 
static uint8_t packet[MAX_PACKET_LEN];
 
static unsigned int packet_size;
 

	
 
// Module functions
 
void update_crc(uint8_t a_bit)
 
{
 
	crc ^= a_bit;
 
	if (crc & 1)
 
	crc = (crc >> 1) ^ 0x8408;  // X-modem CRC poly
 
@@ -125,13 +124,12 @@ void ax25_send_footer()
 
	send_byte(~(final_crc & 0xff));
 
	
 
	// Signal the end of frame
 
	ax25_send_flag();
 
}
 

	
 
void ax25_flush_frame()
 
{
 
	// Key the transmitter and send the frame
 
	afsk_send(packet, packet_size);
 
	afsk_start();
 
}
 
*/
 
\ No newline at end of file
master/master/lib/ax25.h
Show inline comments
 
/*
 
 * ax25.h
 
 *
 
 * Created: 10/30/2012 12:14:05 PM
 
 *  Author: ethanzonca
 
 */ 
 
 
 
#ifndef AX25_H_
 
#define AX25_H_
 
 
struct s_address {
 
	char callsign[7];
 
	unsigned char ssid;
 
};
 
 
void ax25_send_byte(uint8_t a_byte);
 
void ax25_send_flag();
 
void ax25_send_string(const char *string);
 
void ax25_send_header(const struct s_address *addresses, int num_addresses);
 
void ax25_send_footer();
 
void ax25_flush_frame();
 
 
#endif /* AX25_H_ */
 
\ No newline at end of file
0 comments (0 inline, 0 general)