Rev 891 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 891 | Rev 892 | ||
---|---|---|---|
Line 61... | Line 61... | ||
61 | 61 | ||
62 | if (MM3.AXIS == MM3_X) SPDR = MM3_PERIOD_512 + MM3_X_AXIS; // Schreiben ins SPDR löst automatisch SPI-Übertragung (MOSI und MISO) aus |
62 | if (MM3.AXIS == MM3_X) SPDR = MM3_PERIOD_512 + MM3_X_AXIS; // Schreiben ins SPDR löst automatisch SPI-Übertragung (MOSI und MISO) aus |
63 | else if (MM3.AXIS == MM3_Y) SPDR = MM3_PERIOD_512 + MM3_Y_AXIS; // Micromag Period Select ist 256 (0x30) |
63 | else if (MM3.AXIS == MM3_Y) SPDR = MM3_PERIOD_512 + MM3_Y_AXIS; // Micromag Period Select ist 256 (0x30) |
Line 64... | Line 64... | ||
64 | else SPDR = MM3_PERIOD_512 + MM3_Z_AXIS; //if (MM3.AXIS == MM3_Z) |
64 | else SPDR = MM3_PERIOD_512 + MM3_Z_AXIS; //if (MM3.AXIS == MM3_Z) |
65 | 65 | ||
66 | MM3.DRDY = SetDelay(10); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 512 eigentlich 8 ms) |
66 | MM3.DRDY = SetDelay(8); // Laut Datenblatt max. Zeit bis Messung fertig |
Line 67... | Line 67... | ||
67 | MM3.STATE = MM3_WAIT_DRDY; |
67 | MM3.STATE = MM3_WAIT_DRDY; |
68 | return; |
68 | return; |
Line 218... | Line 218... | ||
218 | */ |
218 | */ |
219 | // Offset und Normalisierung |
219 | // Offset und Normalisierung |
220 | Hx = (((int32_t)(mm3_x_axis - MM3_calib.X_off)) *512) /MM3_calib.X_range; |
220 | Hx = (((int32_t)(mm3_x_axis - MM3_calib.X_off)) *512) /MM3_calib.X_range; |
221 | Hy = (((int32_t)(mm3_y_axis - MM3_calib.Y_off)) *512) /MM3_calib.Y_range; |
221 | Hy = (((int32_t)(mm3_y_axis - MM3_calib.Y_off)) *512) /MM3_calib.Y_range; |
222 | Hz = (((int32_t)(mm3_z_axis - MM3_calib.Z_off)) *512) /MM3_calib.Z_range; |
222 | Hz = (((int32_t)(mm3_z_axis - MM3_calib.Z_off)) *512) /MM3_calib.Z_range; |
223 | 223 | ||
224 | // Neigungskompensierung |
224 | // Neigungskompensierung |
225 | x_corr = Hx * cos_nick; |
225 | x_corr = Hx * cos_nick; |
226 | x_corr -= Hz * sin_nick; |
226 | x_corr -= Hz * sin_nick; |
227 | x_corr /= 1024; |
227 | x_corr /= 1024; |