CARMA C++
Yig.h
Go to the documentation of this file.
1 #ifndef YIG_H
2 #define YIG_H
3 
4 #include <string>
5 
6 #include "carma/antenna/sza/antenna/canbus/Oscillator.h"
7 
15 namespace sza {
16  namespace antenna {
17  namespace canbus {
18 
19  class Yig : public Oscillator {
20  public:
21 
22  /*
23  * Lock states from the CAN API
24  */
25  enum {
26  UNLOCKED = 0,
27  SEARCHING = 1,
28  REFINING = 2,
29  LOCKED = 3,
30  RELOCK = 4
31  };
32 
33  /*
34  * Lock bit states from the CAN API
35  */
36  enum {
37  BIT_UNLOCKED = 0,
38  BIT_LOCKED = 1,
39  };
40 
45  std::string boardName,
48 
52  std::vector<carma::canbus::Message>
53  setLoFrequency(unsigned short frequency, bool send=true);
54 
58  std::vector<carma::canbus::Message>
59  downloadId(unsigned char id, unsigned char month,
60  unsigned char day, unsigned char year, bool send=true);
61 
65  std::vector<carma::canbus::Message>
66  getTuningTable(bool send=true);
67 
71  std::vector<carma::canbus::Message>
72  downloadTuningTableToOneWire(bool send=true);
73 
77  std::vector<carma::canbus::Message>
78  downloadTuningTableEntry(unsigned short voltage,
79  unsigned short frequency, bool send=true);
83  std::vector<carma::canbus::Message>
84  setOperatingVoltage(unsigned short voltage, bool send=true);
85 
89  std::vector<carma::canbus::Message>
90  setLoopGainResistance(unsigned short voltage, bool send=true);
91 
95  std::vector<carma::canbus::Message>
96  setDampingResistance(unsigned short resistance, bool send=true);
97 
101  std::vector<carma::canbus::Message>
102  turnSweepOn(bool on, bool send=true);
103 
107  std::vector<carma::canbus::Message>
108  enableAutoLock(bool enable, bool send=true);
109 
113  std::vector<carma::canbus::Message>
114  setDACCalibrationCoefficient(float coeff, bool send=true);
115 
116  /*
117  * Convert from an integral lock state to an orthogonal bit so
118  * that states can be unioned
119  */
120  unsigned char lockStateToBit(unsigned char lockState);
121 
122  /*
123  * Convert from an integral lock bit to an orthogonal bit so
124  * that bits can be unioned
125  */
126  unsigned char lockBitToBit(unsigned char lockBit);
127 
128  private:
129 
130  // Methods to deal with monitor packets for this device.
131 
135  std::map<carma::canbus::msgType, std::string>
136  getHalfSecMonitors() const;
137 
141  void processBlankingFrameMonitor1(std::vector<carma::canbus::byteType>&
142  data, bool isSim);
143 
147  void processBlankingFrameMonitor2(std::vector<carma::canbus::byteType>&
148  data, bool isSim);
149 
153  void processBlankingFrameMonitor3(std::vector<carma::canbus::byteType>&
154  data, bool isSim);
155 
159  void processBlankingFrameMonitor4(std::vector<carma::canbus::byteType>&
160  data, bool isSim);
161 
165  void processBlankingFrameMonitor5(std::vector<carma::canbus::byteType>&
166  data, bool isSim);
167 
171  void processBlankingFrameMonitor6(std::vector<carma::canbus::byteType>&
172  data, bool isSim);
173 
174  //------------------------------------------------------------
175  // Status messages
176  //------------------------------------------------------------
177 
178  enum statusMessages {
179  STATUS_MSG_1 = 0x130, // ??
180  };
181 
185  virtual std::map<carma::canbus::msgType, std::string>
186  getStatusMessages() const;
187 
188  // Methods for processing status messages
189 
190  void processStatusMessage1(bool isSim);
191 
192  //------------------------------------------------------------
193  // Commands for this device.
194  //------------------------------------------------------------
195 
199  enum hostCommands
200  {
201  HOSTCMD_TEST_MODE = 0x00F, // Set firmware test flags
202  HOSTCMD_SET_FREQUENCY = 0x040, // Set the output frequency
203  // and start the lock
204  // sequence.
205  HOSTCMD_GET_TUNING_TABLE = 0x041 // Get the tuning table
206  // from the one-wire
207  // device
208  };
209 
213  enum engineeringCommands
214  {
215  ENGCMD_SET_OUTPUT_FREQ = 0x300,
216  ENGCMD_UPLOAD_YIGID = 0x301,
217  ENGCMD_DOWNLOAD_TUNING = 0x302,
218  ENGCMD_DOWNLOAD_TO_ONEWIRE = 0x303,
219  ENGCMD_OPERATING_VOLTAGE = 0x304,
220  ENGCMD_LOOP_GAIN_RESISTANCE = 0x305,
221  ENGCMD_DAMPING_RESISTANCE = 0x306,
222  ENGCMD_SWEEP = 0x307,
223  ENGCMD_AUTOLOCK = 0x308,
224  ENGCMD_SET_DAC_COEFF = 0x309,
225  };
226 
230  virtual std::map<carma::canbus::msgType, std::string>
231  getSpecificControls() const;
232 
237  std::string controlPrefix();
238 
239  }; // End class Yig
240 
241  }; // End namespace canbus
242  }; // End namespace antenna
243 }; // End namespace sza
244 
245 #endif // End #ifndef
246 
247 
unsigned short nodeType
Carma Node Type id type.
Definition: Types.h:66
CanOutput interface.
Definition: CanOutput.h:26
An instance of this class is created by AntennaMaster and passed to the constructors of other tasks...
Definition: Share.h:38