Compare commits

..

No commits in common. "48f034f0a4a12bb1dc215a623a5f326cb4564a6b" and "6eb1e9a5dd23290a5e702640c6d0804a24c553b1" have entirely different histories.

5 changed files with 929 additions and 1132 deletions

View file

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