|
@@ -14,9 +14,13 @@
|
|
|
#include "Devices/lmx2594.h"
|
|
#include "Devices/lmx2594.h"
|
|
|
#include "Devices/dac8811.h"
|
|
#include "Devices/dac8811.h"
|
|
|
#include "Devices/ad9912.h"
|
|
#include "Devices/ad9912.h"
|
|
|
|
|
+#include "Devices/potentiometer.h"
|
|
|
|
|
|
|
|
double f_pd = 200e6;
|
|
double f_pd = 200e6;
|
|
|
|
|
|
|
|
|
|
+uint16_t armCode[1] = {0};
|
|
|
|
|
+uint16_t attCode[1] = {0};
|
|
|
|
|
+
|
|
|
//Массив структур Command, который связывает строки команд с соответствующими функциями.
|
|
//Массив структур Command, который связывает строки команд с соответствующими функциями.
|
|
|
Command commands[] = {
|
|
Command commands[] = {
|
|
|
{"TMSG44:FREQ ", handleFreqCmd},
|
|
{"TMSG44:FREQ ", handleFreqCmd},
|
|
@@ -44,7 +48,6 @@ void handleFreqCmd(const char* recvBuff)
|
|
|
*spi_mode = cfg_reg;
|
|
*spi_mode = cfg_reg;
|
|
|
|
|
|
|
|
set_cfg_reg(cfg_reg);
|
|
set_cfg_reg(cfg_reg);
|
|
|
-
|
|
|
|
|
lmx_freq = lmx_get_freq(freq[0]);
|
|
lmx_freq = lmx_get_freq(freq[0]);
|
|
|
f_pd = ad9912_set(bar1, lmx_freq, f_pd);
|
|
f_pd = ad9912_set(bar1, lmx_freq, f_pd);
|
|
|
printf("f_pd frequency is set to %.6f MHz\n", f_pd/1e6);
|
|
printf("f_pd frequency is set to %.6f MHz\n", f_pd/1e6);
|
|
@@ -67,7 +70,7 @@ void send_data_qspi(void *bar1) {
|
|
|
uint32_t gpio_reg = get_tmsg_gpio_reg();
|
|
uint32_t gpio_reg = get_tmsg_gpio_reg();
|
|
|
uint32_t shift_reg = get_tmsg_shift_reg();
|
|
uint32_t shift_reg = get_tmsg_shift_reg();
|
|
|
// Create a header 4 Mosi mode
|
|
// Create a header 4 Mosi mode
|
|
|
- uint32_t qspi_header = ((ENUM_SPIMODE_4MOSI) |(0x1 << BITP_GPIO_4MOSI_HEADER) |(0x1 << BITP_SHIFT_REG_4MOSI_HEADER )| ((sizeof(ad9912_ftw_regs_qspi) / 4) << BITP_DDS_4MOSI_HEADER) | ((sizeof(lmx_change_freq_regs) / 4) << BITP_LMX2594_4MOSI_HEADER) | TERM_BIT_1);
|
|
|
|
|
|
|
+ uint32_t qspi_header = ((ENUM_SPIMODE_4MOSI) |(0x1 << BITP_GPIO_4MOSI_HEADER) |(0x1 << BITP_SHIFT_REG_4MOSI_HEADER )| ((sizeof(ad9912_ftw_regs_qspi) / 4) << BITP_DDS_4MOSI_HEADER) | ((sizeof(lmx_change_freq_regs) / 4) << BITP_LMX2594_4MOSI_HEADER) | (0x1 << BITP_DAC_4MOSI_HEADER) | (0x1 << BITP_ATT_4MOSI_HEADER) |(0x2 << BITP_POT_4MOSI_HEADER)| TERM_BIT_1);
|
|
|
uint32_t *data = bar1 + LMX_BASE_ADDR;
|
|
uint32_t *data = bar1 + LMX_BASE_ADDR;
|
|
|
*data = qspi_header;
|
|
*data = qspi_header;
|
|
|
// Initialize the registers
|
|
// Initialize the registers
|
|
@@ -83,6 +86,15 @@ void send_data_qspi(void *bar1) {
|
|
|
}
|
|
}
|
|
|
// Send the data for the shift register
|
|
// Send the data for the shift register
|
|
|
*data = shift_reg;
|
|
*data = shift_reg;
|
|
|
|
|
+ // Send the data for the potentiometer
|
|
|
|
|
+ for (int i = 0; i < sizeof(pot_array) / 4; i++) {
|
|
|
|
|
+ *data = pot_array[i];
|
|
|
|
|
+ }
|
|
|
|
|
+ // Send the data for the DAC
|
|
|
|
|
+ *data = armCode[0];
|
|
|
|
|
+ // Send the data for the ATT
|
|
|
|
|
+ *data = attCode[0];
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void handleLdCmd(const char* recvBuff)
|
|
void handleLdCmd(const char* recvBuff)
|
|
@@ -130,21 +142,21 @@ void handlePowCmd(const char* recvBuff)
|
|
|
void handleArmCmd(const char* recvBuff)
|
|
void handleArmCmd(const char* recvBuff)
|
|
|
{
|
|
{
|
|
|
printf("\nHandle command \"TMSG44:ARM\"\n");
|
|
printf("\nHandle command \"TMSG44:ARM\"\n");
|
|
|
- uint16_t armCode[1] = {0};
|
|
|
|
|
|
|
+ armCode[1] = {0};
|
|
|
|
|
|
|
|
splitLexeme(recvBuff, armCode, sizeof(armCode[0]), convertToUInt16);
|
|
splitLexeme(recvBuff, armCode, sizeof(armCode[0]), convertToUInt16);
|
|
|
printf("\n%u\n", armCode[0]);
|
|
printf("\n%u\n", armCode[0]);
|
|
|
- dac8811_set(bar1,armCode[0]);
|
|
|
|
|
|
|
+ // dac8811_set(bar1,armCode[0]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void handleAttCmd(const char* recvBuff)
|
|
void handleAttCmd(const char* recvBuff)
|
|
|
{
|
|
{
|
|
|
printf("\nHandle command \"TMSG44:ATT\"\n");
|
|
printf("\nHandle command \"TMSG44:ATT\"\n");
|
|
|
- uint16_t attCode[1] = {0};
|
|
|
|
|
|
|
+ attCode[1] = {0};
|
|
|
|
|
|
|
|
splitLexeme(recvBuff, attCode, sizeof(attCode[0]), convertToUInt16);
|
|
splitLexeme(recvBuff, attCode, sizeof(attCode[0]), convertToUInt16);
|
|
|
printf("\n%u\n", attCode[0]);
|
|
printf("\n%u\n", attCode[0]);
|
|
|
- dac8811_att_set(bar1,attCode[0]);
|
|
|
|
|
|
|
+ // dac8811_att_set(bar1,attCode[0]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void handleIdnCmd(const char* recvBuff)
|
|
void handleIdnCmd(const char* recvBuff)
|