59,11 → 59,11 |
case MM3_START_TRANSFER: |
PORTC &= ~(1<<PC5); // PC5 auf Low (war ~125 µs auf High) |
|
if (MM3.AXIS == MM3_X) SPDR = MM3_PERIOD_256 + MM3_X_AXIS; // Schreiben ins SPDR löst automatisch SPI-Übertragung (MOSI und MISO) aus |
else if (MM3.AXIS == MM3_Y) SPDR = MM3_PERIOD_256 + MM3_Y_AXIS; // Micromag Period Select ist 256 (0x30) |
else SPDR = MM3_PERIOD_256 + MM3_Z_AXIS; //if (MM3.AXIS == MM3_Z) |
if (MM3.AXIS == MM3_X) SPDR = MM3_PERIOD_512 + MM3_X_AXIS; // Schreiben ins SPDR löst automatisch SPI-Übertragung (MOSI und MISO) aus |
else if (MM3.AXIS == MM3_Y) SPDR = MM3_PERIOD_512 + MM3_Y_AXIS; // Micromag Period Select ist 256 (0x30) |
else SPDR = MM3_PERIOD_512 + MM3_Z_AXIS; //if (MM3.AXIS == MM3_Z) |
|
MM3.DRDY = SetDelay(8); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
MM3.DRDY = SetDelay(10); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
MM3.STATE = MM3_WAIT_DRDY; |
return; |
|
219,9 → 219,9 |
cos_roll = cos_i(tilt); |
*/ |
// Offset und Normalisierung |
Hx = (((int32_t)(mm3_x_axis - MM3_calib.X_off)) *1024) /MM3_calib.X_range; |
Hy = (((int32_t)(mm3_y_axis - MM3_calib.Y_off)) *1024) /MM3_calib.Y_range; |
Hz = (((int32_t)(mm3_z_axis - MM3_calib.Z_off)) *1024) /MM3_calib.Z_range; |
Hx = (((int32_t)(mm3_x_axis - MM3_calib.X_off)) *512) /MM3_calib.X_range; |
Hy = (((int32_t)(mm3_y_axis - MM3_calib.Y_off)) *512) /MM3_calib.Y_range; |
Hz = (((int32_t)(mm3_z_axis - MM3_calib.Z_off)) *512) /MM3_calib.Z_range; |
|
// Neigungskompensierung |
x_corr = Hx * cos_nick; |