Compare commits

...

10 commits

Author SHA1 Message Date
48f034f0a4 'README.me' ändern
Added a new link to control the ili9341 using a arduino.
2016-11-09 13:34:54 +01:00
klaute
fd6e80a746 Some improvements done in the schematics. 2016-10-20 14:46:09 +02:00
d774850054 Update 'firmware/firmware.ino'
Main loop speed increased 10 times.
2016-10-14 21:25:31 +02:00
461ce740a4 Update 'firmware/firmware.ino'
Bug fixed - the EEPROM read 16 bit value doesn't return a value before (shouldn't the compiler recognize this error!?).
2016-10-14 21:15:43 +02:00
klaute
48c40411d0 Last pins connected to the TFT port. Some parts moved around the schematic. 2016-10-14 16:46:41 +02:00
klaute
d8b7b767e2 ILI9351 TFT pinheader connected (incomplete). 2016-10-14 10:47:50 +02:00
klaute
37aef95e34 Send 16/32 bit functions and read 16/32 bit from buffer functions added - to reduce complexity. 2016-10-14 10:21:14 +02:00
klaute
d12c75fa00 Complexity of the cc measurement function reduced by using an early return. 2016-10-14 10:08:56 +02:00
klaute
075c570cae Some more duplicat code refactorized / reduced. 2016-10-14 10:02:09 +02:00
klaute
03a0135f20 Some redundant core refactorized. 2016-10-14 09:46:04 +02:00
5 changed files with 1142 additions and 939 deletions

View file

@ -7,3 +7,4 @@ Ressources:
* http://community.silabs.com/t5/Timing-Knowledge-Base/Modifying-Output-Driver-Strength-of-the-Si5351/ta-p/112253 * http://community.silabs.com/t5/Timing-Knowledge-Base/Modifying-Output-Driver-Strength-of-the-Si5351/ta-p/112253
* https://github.com/etherkit/Si5351Arduino * https://github.com/etherkit/Si5351Arduino
* http://images.google.de/imgres?imgurl=http://www.kh-gps.de/si5351_4.jpg&imgrefurl=http://www.kh-gps.de/si5351.htm&h=483&w=1115&tbnid=p6ACt2AabOao6M:&tbnh=90&tbnw=208&docid=YzcwWac64G4VOM&usg=__tpZeibmT-PYky-rOAt6f3X7w_7s=&sa=X&ved=0ahUKEwjggd_4tI_PAhUEnRQKHQHdAVUQ9QEIJzAC * http://images.google.de/imgres?imgurl=http://www.kh-gps.de/si5351_4.jpg&imgrefurl=http://www.kh-gps.de/si5351.htm&h=483&w=1115&tbnid=p6ACt2AabOao6M:&tbnh=90&tbnw=208&docid=YzcwWac64G4VOM&usg=__tpZeibmT-PYky-rOAt6f3X7w_7s=&sa=X&ved=0ahUKEwjggd_4tI_PAhUEnRQKHQHdAVUQ9QEIJzAC
* https://github.com/gmtii/ili9341-arduino

View file

@ -101,82 +101,64 @@ uint8_t cc_cmd_data_read_cnt = 0;
/*****************************************************************************/ /*****************************************************************************/
uint32_t read32BitDataFromBuffer(uint8_t pos)
{
uint32_t tmp = (uint32_t)cc_read_data[pos ] << 24;
tmp += (uint32_t)cc_read_data[pos + 1] << 16;
tmp += (uint32_t)cc_read_data[pos + 2] << 8;
tmp += (uint32_t)cc_read_data[pos + 3];
return tmp;
}
uint16_t read16BitDataFromBuffer(uint8_t pos)
{
uint16_t tmp = (uint16_t)cc_read_data[pos ] << 8;
tmp += (uint16_t)cc_read_data[pos + 1];
return tmp;
}
/*****************************************************************************/
void cc_setStartFreq() void cc_setStartFreq()
{ {
uint32_t tmp_start_freq = (uint32_t)cc_read_data[0] << 24; uint32_t tmp_start_freq = read32BitDataFromBuffer(0);
tmp_start_freq += (uint32_t)cc_read_data[1] << 16;
tmp_start_freq += (uint32_t)cc_read_data[2] << 8;
tmp_start_freq += (uint32_t)cc_read_data[3];
if (tmp_start_freq < 1)
tmp_start_freq = 1;
if (tmp_start_freq > 150000000)
tmp_start_freq = 150000000;
start_freq = tmp_start_freq; start_freq = keepFreqRange(tmp_start_freq);
char* tmp = " "; sendSOM();
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2, Serial.write(MSG_TYPE_ANSWER_OK);
MSG_TYPE_ANSWER_OK, sendEOM();
MSG_EOM1, MSG_EOM2);
Serial.write(tmp);
} }
void cc_setEndFreq() void cc_setEndFreq()
{ {
uint32_t tmp_end_freq = (uint32_t)cc_read_data[0] << 24; uint32_t tmp_end_freq = read32BitDataFromBuffer(0);
tmp_end_freq += (uint32_t)cc_read_data[1] << 16;
tmp_end_freq += (uint32_t)cc_read_data[2] << 8;
tmp_end_freq += (uint32_t)cc_read_data[3];
if (tmp_end_freq < 1)
tmp_end_freq = 1;
if (tmp_end_freq > 150000000)
tmp_end_freq = 150000000;
end_freq = tmp_end_freq; end_freq = keepFreqRange(tmp_end_freq);
char* tmp = " "; sendSOM();
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2, Serial.write(MSG_TYPE_ANSWER_OK);
MSG_TYPE_ANSWER_OK, sendEOM();
MSG_EOM1, MSG_EOM2);
Serial.write(tmp);
} }
void cc_setFreqStep() void cc_setFreqStep()
{ {
uint32_t tmp_step_freq = (uint32_t)cc_read_data[0] << 24; uint32_t tmp_step_freq = read32BitDataFromBuffer(0);
tmp_step_freq += (uint32_t)cc_read_data[1] << 16;
tmp_step_freq += (uint32_t)cc_read_data[2] << 8;
tmp_step_freq += (uint32_t)cc_read_data[3];
if (tmp_step_freq < 1)
tmp_step_freq = 1;
if (tmp_step_freq > 150000000)
tmp_step_freq = 150000000;
step_freq = tmp_step_freq; step_freq = keepFreqRange(tmp_step_freq);
char* tmp = " "; sendSOM();
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2, Serial.write(MSG_TYPE_ANSWER_OK);
MSG_TYPE_ANSWER_OK, sendEOM();
MSG_EOM1, MSG_EOM2);
Serial.write(tmp);
} }
void cc_setIntervall() void cc_setIntervall()
{ {
uint16_t tmp_intervall = (uint16_t)cc_read_data[0] << 8; intervall = read16BitDataFromBuffer(0);
tmp_intervall += (uint16_t)cc_read_data[1];
if (tmp_intervall < 1)
tmp_intervall = 1;
if (tmp_intervall > 150000000)
tmp_intervall = 150000000;
intervall = tmp_intervall; sendSOM();
Serial.write(MSG_TYPE_ANSWER_OK);
char* tmp = " "; sendEOM();
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2,
MSG_TYPE_ANSWER_OK,
MSG_EOM1, MSG_EOM2);
Serial.write(tmp);
} }
void cc_setDriveStrength() void cc_setDriveStrength()
@ -189,18 +171,13 @@ void cc_setDriveStrength()
{ {
drive_str = tmp_ds; drive_str = tmp_ds;
char* tmp = " "; sendSOM();
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2, Serial.write(MSG_TYPE_ANSWER_OK);
MSG_TYPE_ANSWER_OK, sendEOM();
MSG_EOM1, MSG_EOM2);
Serial.write(tmp);
} else { } else {
sendSOM();
char* tmp = " "; Serial.write(MSG_TYPE_ANSWER_NOK);
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2, sendEOM();
MSG_TYPE_ANSWER_NOK,
MSG_EOM1, MSG_EOM2);
Serial.write(tmp);
} }
} }
@ -211,133 +188,111 @@ void cc_startMeasurement()
// MSG_TYPE_CONFIG // MSG_TYPE_CONFIG
cc_getConfig(); cc_getConfig();
// 2. start a for loop from the frequence to start to the end frequence if (start_freq == 0 || start_freq > 150000000 ||
if (start_freq > 0 && start_freq <= 150000000 && end_freq == 0 || end_freq > 150000000 ||
end_freq > 0 && end_freq <= 150000000 && step_freq == 0 || step_freq > 150000000 ||
start_freq < end_freq && start_freq >= end_freq ||
intervall > 0 && intervall == 0)
step_freq > 0)
{ {
si5351.drive_strength(SI5351_CLK0, drive_str); // 2 4 6 8ma
uint8_t t = 0;
for (t = 0; t < 100; t++)
{
uint16_t tmp = analogRead(A0);
tmp = analogRead(A1);
}
uint32_t freq = 0;
for (freq = start_freq; freq <= end_freq; freq += step_freq)
{
if (freq > end_freq)
{
// prevent to step over the end frequency
// maybe the user is not allowed to send data in the frequency band
freq = end_freq;
}
uint32_t a0_sum = 0;
uint32_t a1_sum = 0;
uint16_t i = 0;
si5351.set_freq((uint64_t)freq * 100, SI5351_PLL_FIXED, SI5351_CLK0);
si5351.output_enable(SI5351_CLK0, 1); // enable clock output 0
delay(1);
for (i = 0; i < intervall; i++)
{
// 3. on every loop read the analog input A0 and A1 for the in intervall (milliseconds)
// and generate the average value, read the ADC value every milli second.
uint8_t t = 0;
uint16_t ta0 = 0;
uint16_t ta1 = 0;
for (t = 0; t < MEAS_LOOP_CNT; t++)
{
ta0 += analogRead(A0);
ta1 += analogRead(A1);
}
a0_sum += (ta0 / MEAS_LOOP_CNT);
a1_sum += (ta1 / MEAS_LOOP_CNT);
delay(1);
}
a0_sum = a0_sum / intervall;
a1_sum = a1_sum / intervall;
// 4. send the current output frequency, the drive strength and the measured ADC values from A0 and A1 to the host
// MSG_TYPE_MEAS_FREQ_INFO
Serial.write(MSG_SOM1);
Serial.write(MSG_SOM2);
Serial.write(MSG_TYPE_MEAS_FREQ_INFO);
Serial.write((uint8_t)((freq & 0xff000000) >> 24));
Serial.write((uint8_t)((freq & 0x00ff0000) >> 16));
Serial.write((uint8_t)((freq & 0x0000ff00) >> 8));
Serial.write((uint8_t) (freq & 0x000000ff));
Serial.write((uint8_t)((a0_sum & 0xff00) >> 8));
Serial.write((uint8_t) (a0_sum & 0x00ff));
Serial.write((uint8_t)((a1_sum & 0xff00) >> 8));
Serial.write((uint8_t) (a1_sum & 0x00ff));
Serial.write(MSG_EOM1);
Serial.write(MSG_EOM2);
si5351.output_enable(SI5351_CLK0, 0); // disable clock output 0
if (freq >= end_freq)
break; // abort the loop because all is done
}
// 5. send a measurement end message to the host
// MSG_TYPE_MEAS_END_INFO
char* tmp = " ";
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2,
MSG_TYPE_MEAS_END_INFO,
MSG_EOM1, MSG_EOM2);
Serial.write(tmp);
} else {
// on error // on error
char* tmp = " ";
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2, sendSOM();
MSG_TYPE_ANSWER_NOK, Serial.write(MSG_TYPE_ANSWER_NOK);
MSG_EOM1, MSG_EOM2); sendEOM();
Serial.write(tmp);
return;
} }
// 2. start a for loop from the frequence to start to the end frequence
si5351.drive_strength(SI5351_CLK0, drive_str); // 2 4 6 8ma
uint8_t t = 0;
for (t = 0; t < 100; t++)
{
uint16_t tmp = analogRead(A0);
tmp = analogRead(A1);
}
uint32_t freq = 0;
for (freq = start_freq; freq <= end_freq; freq += step_freq)
{
if (freq > end_freq)
{
// prevent to step over the end frequency
// maybe the user is not allowed to send data in the frequency band
freq = end_freq;
}
uint32_t a0_sum = 0;
uint32_t a1_sum = 0;
uint16_t i = 0;
si5351.set_freq((uint64_t)freq * 100, SI5351_PLL_FIXED, SI5351_CLK0);
si5351.output_enable(SI5351_CLK0, 1); // enable clock output 0
delay(1);
for (i = 0; i < intervall; i++)
{
// 3. on every loop read the analog input A0 and A1 for the in intervall (milliseconds)
// and generate the average value, read the ADC value every milli second.
uint8_t t = 0;
uint16_t ta0 = 0;
uint16_t ta1 = 0;
for (t = 0; t < MEAS_LOOP_CNT; t++)
{
ta0 += analogRead(A0);
ta1 += analogRead(A1);
}
a0_sum += (ta0 / MEAS_LOOP_CNT);
a1_sum += (ta1 / MEAS_LOOP_CNT);
delay(1);
}
a0_sum = a0_sum / intervall;
a1_sum = a1_sum / intervall;
// 4. send the current output frequency, the drive strength and the measured ADC values from A0 and A1 to the host
// MSG_TYPE_MEAS_FREQ_INFO
sendSOM();
Serial.write(MSG_TYPE_MEAS_FREQ_INFO);
send32BitValue(freq);
send16BitValue(a0_sum);
send16BitValue(a1_sum);
sendEOM();
si5351.output_enable(SI5351_CLK0, 0); // disable clock output 0
if (freq >= end_freq)
break; // abort the loop because all is done
}
// 5. send a measurement end message to the host
// MSG_TYPE_MEAS_END_INFO
sendSOM();
Serial.write(MSG_TYPE_MEAS_END_INFO);
sendEOM();
si5351.output_enable(SI5351_CLK0, 0); // disable clock output 0 si5351.output_enable(SI5351_CLK0, 0); // disable clock output 0
} }
void cc_getConfig() void cc_getConfig()
{ {
Serial.write(MSG_SOM1); sendSOM();
Serial.write(MSG_SOM2);
Serial.write(MSG_TYPE_CONFIG); Serial.write(MSG_TYPE_CONFIG);
Serial.write((uint8_t)((start_freq & 0xff000000) >> 24)); send32BitValue(start_freq);
Serial.write((uint8_t)((start_freq & 0x00ff0000) >> 16)); send32BitValue(end_freq);
Serial.write((uint8_t)((start_freq & 0x0000ff00) >> 8)); send32BitValue(step_freq);
Serial.write((uint8_t) (start_freq & 0x000000ff)); send16BitValue(intervall);
Serial.write((uint8_t)((end_freq & 0xff000000) >> 24));
Serial.write((uint8_t)((end_freq & 0x00ff0000) >> 16));
Serial.write((uint8_t)((end_freq & 0x0000ff00) >> 8));
Serial.write((uint8_t) (end_freq & 0x000000ff));
Serial.write((uint8_t)((step_freq & 0xff000000) >> 24));
Serial.write((uint8_t)((step_freq & 0x00ff0000) >> 16));
Serial.write((uint8_t)((step_freq & 0x0000ff00) >> 8));
Serial.write((uint8_t) (step_freq & 0x000000ff));
Serial.write((uint8_t)((intervall & 0xff00) >> 8));
Serial.write((uint8_t) (intervall & 0x00ff));
Serial.write((uint8_t) drive_str); Serial.write((uint8_t) drive_str);
Serial.write(MSG_EOM1); sendEOM();
Serial.write(MSG_EOM2);
} }
/*****************************************************************************/ /*****************************************************************************/
void cc_enableClk(void) void cc_enableClk(void)
{ {
Serial.write(MSG_SOM1); sendSOM();
Serial.write(MSG_SOM2);
if (cc_read_data[0] == SI5351_CLK0) if (cc_read_data[0] == SI5351_CLK0)
{ {
si5351.set_freq((uint64_t)start_freq * 100, SI5351_PLL_FIXED, SI5351_CLK0); si5351.set_freq((uint64_t)start_freq * 100, SI5351_PLL_FIXED, SI5351_CLK0);
@ -358,16 +313,14 @@ void cc_enableClk(void)
} else { } else {
Serial.write(MSG_TYPE_ANSWER_NOK); Serial.write(MSG_TYPE_ANSWER_NOK);
} }
Serial.write(MSG_EOM1); sendEOM();
Serial.write(MSG_EOM2);
} }
/*****************************************************************************/ /*****************************************************************************/
void cc_disableClk(void) void cc_disableClk(void)
{ {
Serial.write(MSG_SOM1); sendSOM();
Serial.write(MSG_SOM2);
if (cc_read_data[0] == SI5351_CLK0) if (cc_read_data[0] == SI5351_CLK0)
{ {
si5351.output_enable(SI5351_CLK0, 0); // disable clock output 0 si5351.output_enable(SI5351_CLK0, 0); // disable clock output 0
@ -385,8 +338,7 @@ void cc_disableClk(void)
} else { } else {
Serial.write(MSG_TYPE_ANSWER_NOK); Serial.write(MSG_TYPE_ANSWER_NOK);
} }
Serial.write(MSG_EOM1); sendEOM();
Serial.write(MSG_EOM2);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -394,45 +346,33 @@ void cc_disableClk(void)
void cc_saveDefaults(void) void cc_saveDefaults(void)
{ {
saveEEPValues(); writeEEPROMConfig();
Serial.write(MSG_SOM1); sendSOM();
Serial.write(MSG_SOM2);
Serial.write(MSG_TYPE_ANSWER_OK); Serial.write(MSG_TYPE_ANSWER_OK);
Serial.write(MSG_EOM1); sendEOM();
Serial.write(MSG_EOM2);
} }
/*****************************************************************************/ /*****************************************************************************/
void cc_setClkCorrection(void) void cc_setClkCorrection(void)
{ {
uint32_t tmp_corr = (uint32_t)cc_read_data[0] << 24; uint32_t tmp_corr = read32BitDataFromBuffer(0);
tmp_corr += (uint32_t)cc_read_data[1] << 16;
tmp_corr += (uint32_t)cc_read_data[2] << 8;
tmp_corr += (uint32_t)cc_read_data[3];
si5351.set_correction(tmp_corr); si5351.set_correction(tmp_corr);
Serial.write(MSG_SOM1); sendSOM();
Serial.write(MSG_SOM2);
Serial.write(MSG_TYPE_ANSWER_OK); Serial.write(MSG_TYPE_ANSWER_OK);
Serial.write(MSG_EOM1); sendEOM();
Serial.write(MSG_EOM2);
} }
void cc_getClkCorrection(void) void cc_getClkCorrection(void)
{ {
uint32_t tmp_corr = si5351.get_correction(); uint32_t tmp_corr = si5351.get_correction();
Serial.write(MSG_SOM1); sendSOM();
Serial.write(MSG_SOM2); send32BitValue(tmp_corr);
Serial.write((uint8_t)((tmp_corr & 0xff000000) >> 24)); sendEOM();
Serial.write((uint8_t)((tmp_corr & 0x00ff0000) >> 16));
Serial.write((uint8_t)((tmp_corr & 0x0000ff00) >> 8));
Serial.write((uint8_t) (tmp_corr & 0x000000ff));
Serial.write(MSG_EOM1);
Serial.write(MSG_EOM2);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -450,11 +390,9 @@ void cc_init()
void cc_abort() void cc_abort()
{ {
// send abort message, then init // send abort message, then init
char* tmp = " "; sendSOM();
sprintf(tmp, "%c%c%c%c%c", MSG_SOM1, MSG_SOM2, Serial.write(MSG_TYPE_ANSWER_NOK);
MSG_TYPE_ANSWER_NOK, sendEOM();
MSG_EOM1, MSG_EOM2);
Serial.write(tmp);
cc_init(); cc_init();
} }
@ -560,3 +498,33 @@ void cc_clearReadDataBuffer()
/*****************************************************************************/ /*****************************************************************************/
void sendSOM()
{
Serial.write(MSG_SOM1);
Serial.write(MSG_SOM2);
}
void sendEOM()
{
Serial.write(MSG_EOM1);
Serial.write(MSG_EOM2);
}
/*****************************************************************************/
void send32BitValue(uint32_t value)
{
Serial.write((uint8_t)((value & 0xff000000) >> 24));
Serial.write((uint8_t)((value & 0x00ff0000) >> 16));
Serial.write((uint8_t)((value & 0x0000ff00) >> 8));
Serial.write((uint8_t) (value & 0x000000ff));
}
void send16BitValue(uint16_t value)
{
Serial.write((uint8_t)((value & 0xff00) >> 8));
Serial.write((uint8_t) (value & 0x00ff));
}
/*****************************************************************************/

View file

@ -90,75 +90,72 @@ void loop()
cc_processData(c); cc_processData(c);
} }
//cc_abort(); //delay(100);
delay(10);
delay(100);
} }
/*****************************************************************************/ /*****************************************************************************/
void saveEEPValues() void write32BitEEPROM(uint8_t addr, uint32_t value)
{ {
EEPROM.write(addr , (uint8_t)((value & 0xff000000) >> 24));
EEPROM.write( 0, (uint8_t)((start_freq & 0xff000000) >> 24)); EEPROM.write(addr + 1, (uint8_t)((value & 0x00ff0000) >> 16));
EEPROM.write( 1, (uint8_t)((start_freq & 0x00ff0000) >> 16)); EEPROM.write(addr + 2, (uint8_t)((value & 0x0000ff00) >> 8));
EEPROM.write( 2, (uint8_t)((start_freq & 0x0000ff00) >> 8)); EEPROM.write(addr + 3, (uint8_t) (value & 0x000000ff));
EEPROM.write( 3, (uint8_t) (start_freq & 0x000000ff));
EEPROM.write( 4, (uint8_t)((end_freq & 0xff000000) >> 24));
EEPROM.write( 5, (uint8_t)((end_freq & 0x00ff0000) >> 16));
EEPROM.write( 6, (uint8_t)((end_freq & 0x0000ff00) >> 8));
EEPROM.write( 7, (uint8_t) (end_freq & 0x000000ff));
EEPROM.write( 8, (uint8_t)((step_freq & 0xff000000) >> 24));
EEPROM.write( 9, (uint8_t)((step_freq & 0x00ff0000) >> 16));
EEPROM.write(10, (uint8_t)((step_freq & 0x0000ff00) >> 8));
EEPROM.write(11, (uint8_t) (step_freq & 0x000000ff));
EEPROM.write(12, (uint8_t)((intervall & 0xff00) >> 8));
EEPROM.write(13, (uint8_t) (intervall & 0x00ff));
EEPROM.write(14, (uint8_t) drive_str);
} }
void write16BitEEPROM(uint8_t addr, uint16_t value)
{
EEPROM.write(addr , (uint8_t)((value & 0xff00) >> 8));
EEPROM.write(addr + 1, (uint8_t) (value & 0x00ff));
}
void writeEEPROMConfig()
{
write32BitEEPROM( 0, start_freq);
write32BitEEPROM( 4, end_freq);
write32BitEEPROM( 8, step_freq);
write16BitEEPROM(12, intervall);
EEPROM.write(14, (uint8_t)drive_str);
}
/*****************************************************************************/
uint32_t read32BitEEPROM(uint8_t addr)
{
uint32_t tmp = (uint32_t)EEPROM.read(addr ) << 24;
tmp += (uint32_t)EEPROM.read(addr + 1) << 16;
tmp += (uint32_t)EEPROM.read(addr + 2) << 8;
tmp += (uint32_t)EEPROM.read(addr + 3);
return tmp;
}
uint16_t read16BitEEPROM(uint8_t addr)
{
uint16_t tmp = (uint16_t)EEPROM.read(addr ) << 8;
tmp += (uint16_t)EEPROM.read(addr + 1);
return tmp;
}
/*****************************************************************************/
void readEEPValues() void readEEPValues()
{ {
uint32_t tmp_start_freq = (uint32_t)EEPROM.read(0) << 24; uint32_t tmp_start_freq = read32BitEEPROM(0);
tmp_start_freq += (uint32_t)EEPROM.read(1) << 16;
tmp_start_freq += (uint32_t)EEPROM.read(2) << 8;
tmp_start_freq += (uint32_t)EEPROM.read(3);
if (tmp_start_freq < 1)
tmp_start_freq = 1;
if (tmp_start_freq > 150000000)
tmp_start_freq = 150000000;
start_freq = tmp_start_freq; start_freq = keepFreqRange(tmp_start_freq);
uint32_t tmp_end_freq = (uint32_t)EEPROM.read(4) << 24; uint32_t tmp_end_freq = read32BitEEPROM(4);
tmp_end_freq += (uint32_t)EEPROM.read(5) << 16;
tmp_end_freq += (uint32_t)EEPROM.read(6) << 8;
tmp_end_freq += (uint32_t)EEPROM.read(7);
if (tmp_end_freq < 1)
tmp_end_freq = 1;
if (tmp_end_freq > 150000000)
tmp_end_freq = 150000000;
end_freq = tmp_end_freq; end_freq = keepFreqRange(tmp_end_freq);
uint32_t tmp_step_freq = (uint32_t)EEPROM.read( 8) << 24; uint32_t tmp_step_freq = read32BitEEPROM(8);
tmp_step_freq += (uint32_t)EEPROM.read( 9) << 16;
tmp_step_freq += (uint32_t)EEPROM.read(10) << 8;
tmp_step_freq += (uint32_t)EEPROM.read(11);
if (tmp_step_freq < 1)
tmp_step_freq = 1;
if (tmp_step_freq > 150000000)
tmp_step_freq = 150000000;
step_freq = tmp_step_freq; step_freq = keepFreqRange(tmp_step_freq);
uint16_t tmp_intervall = (uint16_t)EEPROM.read(12) << 8; uint16_t tmp_intervall = read16BitEEPROM(12);
tmp_intervall += (uint16_t)EEPROM.read(13);
if (tmp_intervall < 1)
tmp_intervall = 1;
if (tmp_intervall > 150000000)
tmp_intervall = 150000000;
intervall = tmp_intervall; intervall = tmp_intervall;
@ -176,3 +173,17 @@ void readEEPValues()
/*****************************************************************************/ /*****************************************************************************/
uint32_t keepFreqRange(uint32_t freq)
{
uint32_t f = freq;
if (freq < 1)
f = 1;
else if (freq > 150000000)
f = 150000000;
return f;
}
/*****************************************************************************/

View file

@ -58,52 +58,6 @@ X ~ 2 0 -150 110 U 40 40 1 1 P
ENDDRAW ENDDRAW
ENDDEF ENDDEF
# #
# CONN_01X02
#
DEF CONN_01X02 P 0 40 Y N 1 F N
F0 "P" 0 150 50 H V C CNN
F1 "CONN_01X02" 100 0 50 V V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
$FPLIST
Pin_Header_Straight_1X02
Pin_Header_Angled_1X02
Socket_Strip_Straight_1X02
Socket_Strip_Angled_1X02
$ENDFPLIST
DRAW
S -50 -45 10 -55 0 1 0 N
S -50 55 10 45 0 1 0 N
S -50 100 50 -100 0 1 0 N
X P1 1 -200 50 150 R 50 50 1 1 P
X P2 2 -200 -50 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# CONN_01X03
#
DEF CONN_01X03 P 0 40 Y N 1 F N
F0 "P" 0 200 50 H V C CNN
F1 "CONN_01X03" 100 0 50 V V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
$FPLIST
Pin_Header_Straight_1X03
Pin_Header_Angled_1X03
Socket_Strip_Straight_1X03
Socket_Strip_Angled_1X03
$ENDFPLIST
DRAW
S -50 -95 10 -105 0 1 0 N
S -50 5 10 -5 0 1 0 N
S -50 105 10 95 0 1 0 N
S -50 150 50 -150 0 1 0 N
X P1 1 -200 100 150 R 50 50 1 1 P
X P2 2 -200 0 150 R 50 50 1 1 P
X P3 3 -200 -100 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# CONN_01X07 # CONN_01X07
# #
DEF CONN_01X07 P 0 40 Y N 1 F N DEF CONN_01X07 P 0 40 Y N 1 F N

File diff suppressed because it is too large Load diff