102 char *power_prompt =
"Enter a command: ";
108 char *att_prompt =
"\nDesired IF Attenuation (dB): ";
114 uint16_t output_value;
141 char *power_1_prompt =
"Enter a command for Channel 1: ";
147 char *power_2_prompt =
"Enter a command for Channel 2: ";
153 char *att_1_prompt =
"\nDesired Channel 1 IF Attenuation (dB): ";
159 char *att_2_prompt =
"\nDesired Channel 2 IF Attenuation (dB): ";
165 uint8_t output_value;
198 int keep_looping = 0;
201 int8_t power_command;
207 Serial.println(F(
"\n\n1. Full Power Mode"));
208 Serial.println(F(
"2. Low Power Mode\n"));
209 Serial.print(prompt);
215 Serial.println(power_command);
216 switch (power_command) {
228 Serial.println(F(
"\n\nIncorrect Option\n"));
231 if (keep_looping == 0) {
242 int keep_looping = 0;
251 Serial.print(prompt);
255 Serial.println(att_command, 1);
258 if (fmod(att_command, 0.5) != 0) {
259 Serial.println(F(
"\n\nIncorrect Option - Choose a number " 260 "between 0 and 15.5dB in 0.5dB increments\n"));
264 else if (att_command < 0) {
265 Serial.println(F(
"\n\nIncorrect Option - Choose a number " 266 "between 0 and 15.5dB in 0.5dB increments\n"));
270 else if (att_command > 31) {
271 Serial.println(F(
"\n\nIncorrect Option - Choose a number " 272 "between 0 and 15.5dB in 0.5dB increments\n"));
279 att_command = att_command * 2.;
282 att_bits =
static_cast<int>(att_command);
285 if (keep_looping == 0) {
295 uint8_t power_bit_read;
298 String power_setting_read;
301 uint8_t att_bits_read;
304 float att_setting_read;
307 power_bit_read = (output_register & 0x80) >> 7;
308 switch (power_bit_read) {
310 power_setting_read =
"Full Power";
313 power_setting_read =
"Low Power";
318 Serial.println(
"Power Setting: " + power_setting_read);
321 att_bits_read = output_register & 0x1F;
324 att_setting_read = (att_bits_read / 2.);
327 Serial.println(
"Attenuation Setting: " + String(att_setting_read, 1) +
" dB");
uint16_t LTC5556_diff_settings()
Function to apply unique settings for each LTC5556 channel.
uint8_t mixer_1_value
Global Variables.
Copyright 2018(c) Analog Devices, Inc.
uint8_t LTC5556_dupl_settings()
Function to duplicate settings for both LTC5556 channels.
Header File for Linduino Libraries and Demo Code.
void LTC5556_write(uint8_t cs, uint16_t tx, uint16_t *rx)
Writes to the LTC5556 twice and reads back the last byte to make sure the LTC5556 was loaded properly...
void LTC5556_decode_output(uint8_t output_register)
Decode the register value read from the LTC5556.
#define LTC5556_CS
Define the SPI CS pin.
void spi_transfer_word(uint8_t cs_pin, uint16_t tx, uint16_t *rx)
Reads and sends a word.
#define LTC5556_FULL_POWER
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
prompt
Used to keep track to print voltage or print code.
uint8_t LTC5556_get_att(char *prompt)
Get attenuation value from user.
#define LTC5556_REDUCED_POWER
uint8_t LTC5556_get_power_mode(char *prompt)
Function to get data from user for power mode.