Changeset - 83e403019e80
[Not reviewed]
default
0 2 0
ethanzonca@CL-SEC241-08.cedarville.edu - 12 years ago 2012-12-04 12:30:30
ethanzonca@CL-SEC241-08.cedarville.edu
AFSK now generated on pin matching PCB
2 files changed with 9 insertions and 10 deletions:
0 comments (0 inline, 0 general)
master/master/lib/afsk.c
Show inline comments
 
@@ -87,11 +87,14 @@ volatile const uint8_t *afsk_packet;
 
void afsk_ptt_off() 
 
{
 
	// turn ptt off
 
	PORTA &= ~(1<<PA5);
 
}
 

	
 
void afsk_ptt_on() 
 
{
 
	// turn the ptt on... possibly delay based on spec
 
	PORTA |= (1<<PA5);
 
	_delay_ms(5); // from datasheet
 
}
 

	
 
ISR(TIMER2_OVF_vect) 
 
@@ -140,7 +143,7 @@ ISR(TIMER2_OVF_vect)
 

	
 
void afsk_output_sample(uint8_t s) 
 
{
 
	OCR2B = s;
 
	OCR2A = s;
 
}
 

	
 
void afsk_timer_start()
 
@@ -157,7 +160,7 @@ void afsk_timer_stop()
 
{
 
	// Resting duty cycle
 
	// Output 0v (could be 255/2, which is 0v after coupling... doesn't really matter)
 
	OCR2B = 0x80;
 
	OCR2A = 0x80;
 

	
 
	// Disable playback interrupt
 
	TIMSK2 &= ~_BV(TOIE2);
 
@@ -206,10 +209,8 @@ void afsk_setup()
 
	TCCR2A |= _BV(WGM21) | _BV(WGM20);
 
	TCCR2B &= ~_BV(WGM22);
 

	
 
	// Do non-inverting PWM on pin OC2B (arduino pin 3) (p.159).
 
	// OC2A (arduino pin 11) stays in normal port operation:
 
	// COM2B1=1, COM2B0=0, COM2A1=0, COM2A0=0
 
	TCCR2A = (TCCR2A | _BV(COM2B1)) & ~(_BV(COM2B0) | _BV(COM2A1) | _BV(COM2A0));
 
	// Do non-inverting PWM on pin OC2A
 
	TCCR2A = (TCCR2A | _BV(COM2A1)) & ~(_BV(COM2A0) | _BV(COM2B1) | _BV(COM2B0));
 

	
 
	// No prescaler (p.162)
 
	TCCR2B = (TCCR2B & ~(_BV(CS22) | _BV(CS21))) | _BV(CS20);
 
@@ -218,6 +219,7 @@ void afsk_setup()
 
	//TIMSK2 |= _BV(TOIE2);
 
	TIMSK2 |= 0b00000001;
 
	
 
	// FIXME TODO
 
	DDRD = 0xff;
 
	PORTD = 0xff;
 
	
master/master/lib/led.c
Show inline comments
 
@@ -15,14 +15,13 @@
 
#include <util/delay.h>
 
#include "led.h"
 
 
 
// Configure port direction and initial state of LEDs
 
void led_setup() 
 
{
 
	for(int i=0; i<NUM_LEDS; i++)  {
 
		*(ledList[i].direction) |= (1<<ledList[i].pin); // set pin to output
 
		*(ledList[i].port) &= ~(1<<ledList[i].pin); // set pin low
 
	}
 
	
 
}
 
 
// Turn the specified LED on
 
@@ -37,8 +36,6 @@ void led_off(uint8_t led)
 
	*(ledList[led].direction) &= ~(1<<ledList[led].pin);
 
}
 
 
 
 
// Flashes error LED a set amount of times, then leaves it on
 
void led_errorcode(uint8_t code) 
 
{
0 comments (0 inline, 0 general)