Arduino Signature Library  2.0.1
Retrieving signature information from avr microprocessors
Features.hpp
Go to the documentation of this file.
1 
26 #ifndef SIGNATURE_FEATURES_H
27 #define SIGNATURE_FEATURES_H
28 
29 #include <WString.h>
30 
31 #if defined(__AVR_ATmega48A__) || defined(__AVR_ATmega48PA__) || \
32  defined(__AVR_ATmega88A__) || defined(__AVR_ATmega88PA__) || \
33  defined(__AVR_ATmega168A__) || defined(__AVR_ATmega168PA__) || \
34  defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
35 
39 #define FEATURE_RC_OSCILLATOR_CALIBRATION
40 #elif defined(__AVR_ATtiny828__)
41 
65 #define FEATURE_INTERNAL_8MHZ_OSCILLATOR_CALIBRATION
66 #define FEATURE_OSCILLATOR_TEMPERATURE_CALIBRATION_A
67 #define FEATURE_OSCILLATOR_TEMPERATURE_CALIBRATION_B
68 #define FEATURE_INTERNAL_32KHZ_OSCILLATOR_CALIBRATION
69 #define FEATURE_TEMPERATURE_SENSOR_GAIN_CALIBRATION
70 #define FEATURE_TEMPERATURE_SENSOR_OFFSET_CALIBRATION
71 #endif
72 
80 class Features {
81 private:
82 #ifdef FEATURE_RC_OSCILLATOR_CALIBRATION
83  static uint8_t rcOscillatorCalibration;
84 #endif
86 #ifdef FEATURE_INTERNAL_8MHZ_OSCILLATOR_CALIBRATION
87  static uint8_t internal8MHzOscillatorCalibration;
88 #endif
91 #ifdef FEATURE_OSCILLATOR_TEMPERATURE_CALIBRATION_A
92  static uint8_t oscillatorTemperatureCalibrationA;
93 #endif
97 #ifdef FEATURE_OSCILLATOR_TEMPERATURE_CALIBRATION_B
98  static uint8_t oscillatorTemperatureCalibrationB;
99 #endif
103 #ifdef FEATURE_INTERNAL_32KHZ_OSCILLATOR_CALIBRATION
104  static uint8_t internal32kHzOscillatorCalibration;
105 #endif
108 #ifdef FEATURE_TEMPERATURE_SENSOR_GAIN_CALIBRATION
109  static uint8_t temperatureSensorGainCalibration;
110 #endif
113 #ifdef FEATURE_TEMPERATURE_SENSOR_OFFSET_CALIBRATION
114  static uint8_t temperatureSensorOffsetCalibration;
115 #endif
119 public:
123  static void INIT();
124 
125 #ifdef FEATURE_RC_OSCILLATOR_CALIBRATION
126  static uint8_t getRcOscillatorCalibration() {
127  INIT();
128  return rcOscillatorCalibration;
129  }
130 #endif
131 
132 #ifdef FEATURE_INTERNAL_8MHZ_OSCILLATOR_CALIBRATION
133  static uint8_t getInternal8MHzOscillatorCalibration() {
134  INIT();
135  return internal8MHzOscillatorCalibration;
136  }
137 #endif
138 
139 #ifdef FEATURE_OSCILLATOR_TEMPERATURE_CALIBRATION_A
140  static uint8_t getOscillatorTemperatureCalibrationA() {
141  INIT();
142  return oscillatorTemperatureCalibrationA;
143  }
144 #endif
145 
146 #ifdef FEATURE_OSCILLATOR_TEMPERATURE_CALIBRATION_B
147  static uint8_t getOscillatorTemperatureCalibrationB() {
148  INIT();
149  return oscillatorTemperatureCalibrationB;
150  }
151 #endif
152 
153 #ifdef FEATURE_INTERNAL_32KHZ_OSCILLATOR_CALIBRATION
154  static uint8_t getInternal32kHzOscillatorCalibration() {
155  INIT();
156  return internal32kHzOscillatorCalibration;
157  }
158 #endif
159 
160 #ifdef FEATURE_TEMPERATURE_SENSOR_GAIN_CALIBRATION
161  static uint8_t getTemperatureSensorGainCalibration() {
162  INIT();
163  return temperatureSensorGainCalibration;
164  }
165 #endif
166 
167 #ifdef FEATURE_TEMPERATURE_SENSOR_OFFSET_CALIBRATION
168  static uint8_t getTemperatureSensorOffsetCalibration() {
169  INIT();
170  return temperatureSensorOffsetCalibration;
171  }
172 #endif
173 
180  static String getSummary();
181 };
182 
183 #endif // SIGNATURE_FEATURES_H
static String getSummary()
Writing a summary of the additional information stored in the signature of the microcontroller.
Definition: Features.cpp:105
static void INIT()
Initialise the class.
Definition: Features.cpp:60
Class representing additional information stored in the signature of the microcontroller.
Definition: Features.hpp:80