Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of jro by
Diff: JroDDS.cpp
- Revision:
- 3:f0e6c145b075
- Parent:
- 2:3d8d52e9751c
- Child:
- 4:de495ce256b8
--- a/JroDDS.cpp Thu Feb 05 19:01:42 2015 +0000
+++ b/JroDDS.cpp Thu Feb 05 21:31:37 2015 +0000
@@ -451,19 +451,24 @@
}
int DDS::defaultSettings(SerialDriver *screen){
- screen->putc(0x37);
- screen->putc(0x30);
+
+ if (!(screen == NULL)){
+ screen->putc(0x37);
+ screen->putc(0x30);
+ }
this->wrMultiplier(1, 0.0);
- this->wrAmplitudeI("\x0A\x5B", screen); //0xFC0 produces best SFDR than 0xFFF
+ this->wrAmplitudeI("\x0F\xC0", screen); //0xFC0 produces best SFDR than 0xFFF
this->wrAmplitudeQ("\x0F\xC0"); //0xFC0 produces best SFDR than 0xFFF
this->wrFrequency1("\x00\x00\x00\x00\x00\x00"); // 49.92 <> 0x3f 0xe5 0xc9 0x1d 0x14 0xe3 <> 49.92/clock*(2**48) \x3f\xe5\xc9\x1d\x14\xe3
this->wrFrequency2("\x00\x00\x00\x00\x00\x00");
this->wrPhase1("\x00\x00"); //0 grados
this->wrPhase2("\x20\x00"); //180 grados <> 0x20 0x00 <> 180/360*(2**14)
- screen->putc(0x37);
- screen->putc(0x31);
+ if (!(screen == NULL)){
+ screen->putc(0x37);
+ screen->putc(0x31);
+ }
return this->wrMode(4); //BPSK mode
@@ -494,11 +499,11 @@
switch ( cmd )
{
- case CMD_RESET:
+ case DDS_CMD_RESET:
success = this->init();
break;
- case CMD_ENABLE_RF:
+ case DDS_CMD_ENABLE_RF:
if (payload_len == 1){
if (payload[0] == 0)
success = this->disableRF();
@@ -507,56 +512,56 @@
}
break;
- case CMD_MULTIPLIER:
+ case DDS_CMD_MULTIPLIER:
if (payload_len == 3){
unsigned short clock = payload[1]*256 + payload[2];
success = this->wrMultiplier(payload[0], (float)clock);
}
break;
- case CMD_MODE:
+ case DDS_CMD_MODE:
if (payload_len == 1){
success = this->wrMode(payload[0]);
}
break;
- case CMD_FREQUENCY1:
+ case DDS_CMD_FREQUENCY1:
if (payload_len == 6){
success = this->wrFrequency1(payload);
}
break;
- case CMD_FREQUENCY2:
+ case DDS_CMD_FREQUENCY2:
if (payload_len == 6){
success = this->wrFrequency2(payload);
}
break;
- case CMD_PHASE1:
+ case DDS_CMD_PHASE1:
if (payload_len == 2){
success = this->wrPhase1(payload);
}
break;
- case CMD_PHASE2:
+ case DDS_CMD_PHASE2:
if (payload_len == 2){
success = this->wrPhase2(payload);
}
break;
- case CMD_AMPLITUDEI:
+ case DDS_CMD_AMPLITUDEI:
if (payload_len == 2){
success = this->wrAmplitudeI(payload);
}
break;
- case CMD_AMPLITUDEQ:
+ case DDS_CMD_AMPLITUDEQ:
if (payload_len == 2){
success = this->wrAmplitudeQ(payload);
}
break;
- case CMD_READ | CMD_ENABLE_RF:
+ case DDS_CMD_READ | DDS_CMD_ENABLE_RF:
if (rf_enabled == 1)
tx_msg = "\x01";
else
@@ -566,42 +571,42 @@
break;
- case CMD_READ | CMD_MULTIPLIER:
+ case DDS_CMD_READ | DDS_CMD_MULTIPLIER:
tx_msg = this->rdMultiplier();
tx_msg_len = 3;
break;
- case CMD_READ | CMD_MODE:
+ case DDS_CMD_READ | DDS_CMD_MODE:
tx_msg = this->rdMode();
tx_msg_len = 1;
break;
- case CMD_READ | CMD_FREQUENCY1:
+ case DDS_CMD_READ | DDS_CMD_FREQUENCY1:
tx_msg = this->rdFrequency1();
tx_msg_len = 6;
break;
- case CMD_READ | CMD_FREQUENCY2:
+ case DDS_CMD_READ | DDS_CMD_FREQUENCY2:
tx_msg = this->rdFrequency2();
tx_msg_len = 6;
break;
- case CMD_READ | CMD_PHASE1:
+ case DDS_CMD_READ | DDS_CMD_PHASE1:
tx_msg = this->rdPhase1();
tx_msg_len = 2;
break;
- case CMD_READ | CMD_PHASE2:
+ case DDS_CMD_READ | DDS_CMD_PHASE2:
tx_msg = this->rdPhase2();
tx_msg_len = 2;
break;
- case CMD_READ | CMD_AMPLITUDEI:
+ case DDS_CMD_READ | DDS_CMD_AMPLITUDEI:
tx_msg = this->rdAmplitudeI();
tx_msg_len = 2;
break;
- case CMD_READ | CMD_AMPLITUDEQ:
+ case DDS_CMD_READ | DDS_CMD_AMPLITUDEQ:
tx_msg = this->rdAmplitudeQ();
tx_msg_len = 2;
break;
