Rev 2032 | Rev 2112 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2032 | Rev 2092 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | #include "timer0.h" |
7 | #include "timer0.h" |
Line 8... | Line 8... | ||
8 | 8 | ||
9 | #define PITCHROLL_MINLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 510 |
9 | #define PITCHROLL_MINLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 510 |
Line 10... | Line 10... | ||
10 | #define PITCHROLL_MAXLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 515 |
10 | #define PITCHROLL_MAXLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 515 |
11 | 11 | ||
12 | void I2C_OutputAmplifierOffsets() { |
12 | void I2C_OutputAmplifierOffsets(void) { |
13 | uint16_t timeout = setDelay(2000); |
13 | uint16_t timeout = setDelay(2000); |
14 | I2C_Start(TWI_STATE_GYRO_OFFSET_TX); // initiate data transmission |
14 | I2C_Start(TWI_STATE_GYRO_OFFSET_TX); // initiate data transmission |
15 | // Wait for I2C to finish transmission. |
15 | // Wait for I2C to finish transmission. |
Line 62... | Line 62... | ||
62 | } |
62 | } |
63 | gyroAmplifierOffset_writeToEEProm(); |
63 | gyroAmplifierOffset_writeToEEProm(); |
64 | delay_ms_with_adc_measurement(70, 0); |
64 | delay_ms_with_adc_measurement(70, 0); |
65 | } |
65 | } |
Line 66... | Line 66... | ||
66 | 66 | ||
67 | void gyro_init() { |
67 | void gyro_init(void) { |
68 | if (gyroAmplifierOffset_readFromEEProm()) { |
68 | if (gyroAmplifierOffset_readFromEEProm()) { |
69 | printf("gyro amp invalid, recalibrate."); |
69 | printf("gyro amp invalid, recalibrate."); |
70 | gyroAmplifierOffset.offsets[PITCH] = |
70 | gyroAmplifierOffset.offsets[PITCH] = |
71 | gyroAmplifierOffset.offsets[ROLL] = |
71 | gyroAmplifierOffset.offsets[ROLL] = |
Line 74... | Line 74... | ||
74 | I2C_OutputAmplifierOffsets(); |
74 | I2C_OutputAmplifierOffsets(); |
75 | } |
75 | } |
76 | } |
76 | } |
Line 77... | Line 77... | ||
77 | 77 | ||
- | 78 | void gyro_setDefaultParameters(void) { |
|
78 | void gyro_setDefaultParameters(void) { |
79 | IMUConfig.gyroQuadrant = 0; |
79 | staticParams.accQuadrant = 4; |
80 | IMUConfig.accQuadrant = 4; |
80 | staticParams.imuReversedFlags = IMU_REVERSE_ACC_XY; |
81 | IMUConfig.imuReversedFlags = IMU_REVERSE_GYRO_YAW | IMU_REVERSE_ACC_XY; |
81 | staticParams.gyroD = 3; |
82 | staticParams.gyroD = 3; |
82 | staticParams.driftCompDivider = 1; |
83 | IMUConfig.driftCompDivider = 1; |
83 | staticParams.driftCompLimit = 200; |
84 | IMUConfig.driftCompLimit = 200; |
84 | staticParams.zerothOrderCorrection = 25; |
85 | IMUConfig.zerothOrderCorrection = 120; |