Cleanup on AFSK-PacketTester example, verified working with current library and hardware v09
This commit is contained in:
		
							parent
							
								
									75e964289c
								
							
						
					
					
						commit
						868882f81e
					
				| 
						 | 
				
			
			@ -4,7 +4,6 @@
 | 
			
		|||
 *  
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define DDS_REFCLK_DEFAULT 9600
 | 
			
		||||
 | 
			
		||||
#include <HamShield.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +13,6 @@
 | 
			
		|||
#define RESET_PIN A3
 | 
			
		||||
#define SWITCH_PIN 2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
HamShield radio;
 | 
			
		||||
DDS dds;
 | 
			
		||||
String messagebuff = "";
 | 
			
		||||
| 
						 | 
				
			
			@ -47,16 +45,12 @@ void setup() {
 | 
			
		|||
  Serial.println("HELLO");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
String temp[1] = "";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  messagebuff = "KC7IBT,KC7IBT,:HAMSHIELD TEST";
 | 
			
		||||
  prepMessage();
 | 
			
		||||
  delay(10000);
 | 
			
		||||
} 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void prepMessage() { 
 | 
			
		||||
  radio.setModeTransmit();
 | 
			
		||||
  delay(500);
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +70,6 @@ void prepMessage() {
 | 
			
		|||
  packet->print(textmessage);
 | 
			
		||||
  packet->finish();
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
  bool ret = radio.afsk.putTXPacket(packet);
 | 
			
		||||
 | 
			
		||||
  if(radio.afsk.txReady()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -99,18 +92,14 @@ void prepMessage() {
 | 
			
		|||
    delay(50);
 | 
			
		||||
  }
 | 
			
		||||
  Serial.println("Done sending");
 | 
			
		||||
    delay(3000);
 | 
			
		||||
  radio.setModeReceive();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
ISR(TIMER2_OVF_vect) {
 | 
			
		||||
  TIFR2 = _BV(TOV2);
 | 
			
		||||
  static uint8_t tcnt = 0;
 | 
			
		||||
  if(++tcnt == 8) {
 | 
			
		||||
  digitalWrite(2, HIGH);
 | 
			
		||||
    dds.clockTick();
 | 
			
		||||
  digitalWrite(2, LOW);
 | 
			
		||||
    tcnt = 0;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +107,6 @@ ISR(TIMER2_OVF_vect) {
 | 
			
		|||
ISR(ADC_vect) {
 | 
			
		||||
  static uint8_t tcnt = 0;
 | 
			
		||||
  TIFR1 = _BV(ICF1); // Clear the timer flag
 | 
			
		||||
  PORTD |= _BV(2); // Diagnostic pin (D2)
 | 
			
		||||
  dds.clockTick();
 | 
			
		||||
  if(++tcnt == 1) {
 | 
			
		||||
    if(radio.afsk.encoder.isSending()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -126,7 +114,4 @@ ISR(ADC_vect) {
 | 
			
		|||
    }
 | 
			
		||||
    tcnt = 0;
 | 
			
		||||
  }
 | 
			
		||||
  PORTD &= ~(_BV(2)); // Pin D2 off again
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue