add delay after power on to examples, minor bugfixing
This commit is contained in:
		
							parent
							
								
									45527b826f
								
							
						
					
					
						commit
						450d05fdea
					
				| 
						 | 
					@ -44,13 +44,14 @@ void setup() {
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  // turn on pwr to the radio
 | 
					  // turn on pwr to the radio
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  radio.initialize();
 | 
					  radio.initialize();
 | 
				
			||||||
  radio.frequency(144390);
 | 
					  radio.frequency(144390);
 | 
				
			||||||
  radio.setRfPower(0);
 | 
					  radio.setRfPower(0);
 | 
				
			||||||
  radio.bypassPreDeEmph(); // needed for digital modes
 | 
					  // radio.bypassPreDeEmph();
 | 
				
			||||||
  dds.start();
 | 
					  dds.start();
 | 
				
			||||||
  afsk.start(&dds);
 | 
					  afsk.start(&dds);
 | 
				
			||||||
  delay(100);
 | 
					  delay(100);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,7 @@ void setup() {
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  // turn on the radio
 | 
					  // turn on the radio
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,7 +59,7 @@ void setup() {
 | 
				
			||||||
  radio.setSQHiThresh(-100);
 | 
					  radio.setSQHiThresh(-100);
 | 
				
			||||||
  radio.setSQLoThresh(-100);
 | 
					  radio.setSQLoThresh(-100);
 | 
				
			||||||
  radio.setSQOn();
 | 
					  radio.setSQOn();
 | 
				
			||||||
  radio.bypassPreDeEmph();
 | 
					  //radio.bypassPreDeEmph();
 | 
				
			||||||
  dds.start();
 | 
					  dds.start();
 | 
				
			||||||
  afsk.start(&dds);
 | 
					  afsk.start(&dds);
 | 
				
			||||||
  delay(100);
 | 
					  delay(100);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,6 +36,7 @@ void setup() {
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  // turn on radio
 | 
					  // turn on radio
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,7 +55,7 @@ void setup() {
 | 
				
			||||||
  Serial.print(F(" / "));
 | 
					  Serial.print(F(" / "));
 | 
				
			||||||
  Serial.println(radio.getSQLoThresh());
 | 
					  Serial.println(radio.getSQLoThresh());
 | 
				
			||||||
  radio.setModeReceive();
 | 
					  radio.setModeReceive();
 | 
				
			||||||
  radio.bypassPreDeEmph(); // needed for digital modes
 | 
					  //radio.bypassPreDeEmph();
 | 
				
			||||||
  Serial.println(F("DDS Start"));
 | 
					  Serial.println(F("DDS Start"));
 | 
				
			||||||
  delay(100);
 | 
					  delay(100);
 | 
				
			||||||
  dds.start();
 | 
					  dds.start();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
 | 
					  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,6 +38,7 @@ void setup() {
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  // turn on radio
 | 
					  // turn on radio
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,6 +36,7 @@ void setup() {
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  // turn on radio
 | 
					  // turn on radio
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  radio.initialize();
 | 
					  radio.initialize();
 | 
				
			||||||
  radio.setRfPower(0);
 | 
					  radio.setRfPower(0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // Set up the serial port at 9600 Baud
 | 
					  // Set up the serial port at 9600 Baud
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,6 +38,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Set up the serial port at 9600 Baud
 | 
					  // Set up the serial port at 9600 Baud
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
 | 
					  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,6 +35,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  analogReference(DEFAULT);
 | 
					  analogReference(DEFAULT);
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,7 +24,6 @@ HamShield radio;
 | 
				
			||||||
#define LED_PIN 13
 | 
					#define LED_PIN 13
 | 
				
			||||||
#define RSSI_REPORT_RATE_MS 5000
 | 
					#define RSSI_REPORT_RATE_MS 5000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//TODO: move these into library
 | 
					 | 
				
			||||||
#define PWM_PIN 3
 | 
					#define PWM_PIN 3
 | 
				
			||||||
#define RESET_PIN A3
 | 
					#define RESET_PIN A3
 | 
				
			||||||
#define SWITCH_PIN 2
 | 
					#define SWITCH_PIN 2
 | 
				
			||||||
| 
						 | 
					@ -57,6 +56,7 @@ void setup() {
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // let the AU ot of reset
 | 
					  // let the AU ot of reset
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.println("beginning radio setup");
 | 
					  Serial.println("beginning radio setup");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
| 
						 | 
					@ -56,7 +57,7 @@ void setup() {
 | 
				
			||||||
  radio.setSQLoThresh(-100);
 | 
					  radio.setSQLoThresh(-100);
 | 
				
			||||||
  radio.setSQOn();
 | 
					  radio.setSQOn();
 | 
				
			||||||
  radio.frequency(144390);
 | 
					  radio.frequency(144390);
 | 
				
			||||||
  radio.bypassPreDeEmph();
 | 
					  //radio.bypassPreDeEmph();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  dds.start();
 | 
					  dds.start();
 | 
				
			||||||
  afsk.start(&dds);
 | 
					  afsk.start(&dds);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  // put your setup code here, to run once:
 | 
					  // put your setup code here, to run once:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  Serial.print("Radio status: ");
 | 
					  Serial.print("Radio status: ");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,6 +41,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,6 +80,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  Serial.println(";;;;;;;;;;;;;;;;;;;;;;;;;;");
 | 
					  Serial.println(";;;;;;;;;;;;;;;;;;;;;;;;;;");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,6 +99,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  Serial.print("Radio status: ");
 | 
					  Serial.print("Radio status: ");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -239,6 +239,7 @@ void setup() {
 | 
				
			||||||
  // set up the reset control pin
 | 
					  // set up the reset control pin
 | 
				
			||||||
  pinMode(RESET_PIN, OUTPUT);
 | 
					  pinMode(RESET_PIN, OUTPUT);
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
 | 
					  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
 | 
				
			||||||
| 
						 | 
					@ -269,7 +270,6 @@ void setup() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void loop() {
 | 
					void loop() {
 | 
				
			||||||
  //radio.bypassPreDeEmph();
 | 
					 | 
				
			||||||
  radio.frequency(144025);
 | 
					  radio.frequency(144025);
 | 
				
			||||||
  radio.setModeTransmit();
 | 
					  radio.setModeTransmit();
 | 
				
			||||||
  for(;;) { }
 | 
					  for(;;) { }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -992,8 +992,6 @@ void HamShield::enableDTMFReceive(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  HSwriteBitsW(devAddr, A1846S_DTMF_ENABLE_REG, A1846S_DTMF_ENABLE_BIT, 1, 1);
 | 
					  HSwriteBitsW(devAddr, A1846S_DTMF_ENABLE_REG, A1846S_DTMF_ENABLE_BIT, 1, 1);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  //HSwriteBitsW(devAddr, A1846S_DTMF_ENABLE_REG, A18462_DTMF_DET_TIME_BIT, A18462_DTMF_DET_TIME_LEN, 24);
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  //HSwriteBitsW(devAddr, 0x57, 0, 1, 1); // send dtmf to speaker out
 | 
					  //HSwriteBitsW(devAddr, 0x57, 0, 1, 1); // send dtmf to speaker out
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // bypass pre/de-emphasis
 | 
					  // bypass pre/de-emphasis
 | 
				
			||||||
| 
						 | 
					@ -1197,7 +1195,7 @@ void HamShield::usePreDeEmph(){
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
bool HamShield::getPreDeEmphEnabled(){
 | 
					bool HamShield::getPreDeEmphEnabled(){
 | 
				
			||||||
    HSreadBitW(devAddr, A1846S_EMPH_FILTER_REG, A1846S_EMPH_FILTER_EN, radio_i2c_buf);
 | 
					    HSreadBitW(devAddr, A1846S_EMPH_FILTER_REG, A1846S_EMPH_FILTER_EN, radio_i2c_buf);
 | 
				
			||||||
    return (radio_i2c_buf[0] != 0);
 | 
					    return (radio_i2c_buf[0] == 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Read Only Status Registers
 | 
					// Read Only Status Registers
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue