Rev 2132 | Rev 2135 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2132 | Rev 2133 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | 21 | ||
22 | // set ADC enable & ADC Start Conversion & ADC Interrupt Enable bit |
22 | // set ADC enable & ADC Start Conversion & ADC Interrupt Enable bit |
Line 23... | Line 23... | ||
23 | #define startADC() (ADCSRA |= (1<<ADEN)|(1<<ADSC)|(1<<ADIE)) |
23 | #define startADC() (ADCSRA |= (1<<ADEN)|(1<<ADSC)|(1<<ADIE)) |
24 | - | ||
25 | const char* recal = ", recalibration needed."; |
24 | |
Line 26... | Line -... | ||
26 | - | ||
27 | volatile uint16_t ADSensorInputs[8]; |
25 | const char* recal = ", recalibration needed."; |
28 | 26 | volatile uint16_t ADSensorInputs[8]; |
|
29 | 27 | ||
30 | /* |
28 | /* |
31 | * These 4 exported variables are zero-offset. The "PID" ones are used |
29 | * These 4 exported variables are zero-offset. The "PID" ones are used |
Line 178... | Line 176... | ||
178 | //Trigger Source to Free Running Mode |
176 | //Trigger Source to Free Running Mode |
179 | ADCSRB &= ~((1<<ADTS2)|(1<<ADTS1)|(1<<ADTS0)); |
177 | ADCSRB &= ~((1<<ADTS2)|(1<<ADTS1)|(1<<ADTS0)); |
Line 180... | Line 178... | ||
180 | 178 | ||
Line -... | Line 179... | ||
- | 179 | startAnalogConversionCycle(); |
|
- | 180 | ||
181 | startAnalogConversionCycle(); |
181 | twimaster_init(); |
182 | 182 | ||
183 | // restore global interrupt flags |
183 | // restore global interrupt flags |
Line 184... | Line 184... | ||
184 | SREG = sreg; |
184 | SREG = sreg; |
185 | } |
185 | } |
186 | 186 | ||
187 | /* |
187 | /* |
188 | * Here the axes of the sensor can be shuffled around. |
188 | * Here the axes of the sensor can be shuffled around. |
189 | */ |
189 | */ |
Line 190... | Line 190... | ||
190 | uint16_t rawGyroValue(uint8_t axis) { |
190 | int16_t rawGyroValue(uint8_t axis) { |
191 | return IMU3200SensorInputs[axis+1]; // skip temperature mesaurement in any case.. |
191 | return ITG3200SensorInputs[axis+1]; // skip temperature mesaurement in any case.. |
192 | } |
192 | } |
Line 348... | Line 348... | ||
348 | void analog_setNeutral() { |
348 | void analog_setNeutral() { |
349 | twimaster_setNeutral(); |
349 | twimaster_setNeutral(); |
Line 350... | Line 350... | ||
350 | 350 | ||
351 | if (gyroOffset_readFromEEProm()) { |
351 | if (gyroOffset_readFromEEProm()) { |
352 | printf("gyro offsets invalid%s",recal); |
352 | printf("gyro offsets invalid%s",recal); |
353 | gyroOffset.offsets[PITCH] = gyroOffset.offsets[ROLL] = 512 * GYRO_OVERSAMPLING; |
353 | gyroOffset.offsets[PITCH] = gyroOffset.offsets[ROLL] = 0; |
354 | gyroOffset.offsets[YAW] = 512 * GYRO_OVERSAMPLING; |
354 | gyroOffset.offsets[YAW] = 0; |
Line 355... | Line 355... | ||
355 | } |
355 | } |
356 | 356 | ||
357 | // Noise is relative to offset. So, reset noise measurements when changing offsets. |
357 | // Noise is relative to offset. So, reset noise measurements when changing offsets. |