|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Go to the source code of this file.
Macros | |
| #define | SDA_PIN 4 |
| #define | SCL_PIN 5 |
| #define | AS5600_ADDR 0x36 |
| #define | REG_ZMCO 0x00 |
| #define | REG_CONF_HI 0x07 |
| #define | REG_CONF_LO 0x08 |
| #define | REG_STATUS 0x0B |
| #define | REG_RAW_MSB 0x0C |
| #define | REG_RAW_LSB 0x0D |
| #define | REG_AGC 0x1A |
| #define | REG_MAG_HI 0x1B |
| #define | REG_MAG_LO 0x1C |
| #define | STATUS_MH 0x08 |
| #define | STATUS_ML 0x10 |
| #define | STATUS_MD 0x20 |
| #define | READ_ERROR 0xFFFF |
Functions | |
| bool | i2cReadBytes (uint8_t reg, uint8_t *buf, uint8_t len) |
| bool | as5600Ping () |
| void | dumpDiagnostics () |
| uint16_t | readRawAngle () |
| float | rawToDegrees (uint16_t raw) |
| bool | checkMagnetPresence () |
| void | correctAngle () |
| void | setup () |
| void | loop () |
Variables | |
| float | startAngle = 0.0f |
| float | degAngle = 0.0f |
| float | correctedAngle = 0.0f |
| bool | sensorOk = false |
| #define AS5600_ADDR 0x36 |
Definition at line 9 of file main.cpp.
Referenced by as5600Ping(), i2cReadBytes(), and i2cReadBytes().
| #define READ_ERROR 0xFFFF |
Definition at line 23 of file main.cpp.
Referenced by loop(), readRawAngle(), readRawAngle(), and setup().
| #define REG_AGC 0x1A |
Definition at line 16 of file main.cpp.
Referenced by dumpDiagnostics().
| #define REG_CONF_HI 0x07 |
Definition at line 11 of file main.cpp.
Referenced by dumpDiagnostics().
| #define REG_MAG_HI 0x1B |
Definition at line 17 of file main.cpp.
Referenced by dumpDiagnostics().
| #define REG_RAW_MSB 0x0C |
Definition at line 14 of file main.cpp.
Referenced by dumpDiagnostics(), readRawAngle(), and readRawAngle().
| #define REG_STATUS 0x0B |
Definition at line 13 of file main.cpp.
Referenced by checkMagnetPresence(), checkMagnetPresence(), dumpDiagnostics(), and testEncoderComms().
| #define REG_ZMCO 0x00 |
Definition at line 10 of file main.cpp.
Referenced by dumpDiagnostics().
| #define STATUS_MD 0x20 |
Definition at line 22 of file main.cpp.
Referenced by checkMagnetPresence(), checkMagnetPresence(), and dumpDiagnostics().
| #define STATUS_MH 0x08 |
Definition at line 20 of file main.cpp.
Referenced by checkMagnetPresence(), checkMagnetPresence(), and dumpDiagnostics().
| #define STATUS_ML 0x10 |
Definition at line 21 of file main.cpp.
Referenced by checkMagnetPresence(), checkMagnetPresence(), and dumpDiagnostics().
| bool as5600Ping | ( | ) |
| bool checkMagnetPresence | ( | ) |
| void correctAngle | ( | ) |
Definition at line 149 of file main.cpp.
References correctedAngle, degAngle, and startAngle.
Referenced by loop().
| void dumpDiagnostics | ( | ) |
Definition at line 50 of file main.cpp.
References i2cReadBytes(), REG_AGC, REG_CONF_HI, REG_MAG_HI, REG_RAW_MSB, REG_STATUS, REG_ZMCO, Serial, STATUS_MD, STATUS_MH, and STATUS_ML.
| bool i2cReadBytes | ( | uint8_t | reg, |
| uint8_t * | buf, | ||
| uint8_t | len ) |
Definition at line 30 of file main.cpp.
References AS5600_ADDR, and reg.
Referenced by checkMagnetPresence(), checkMagnetPresence(), dumpDiagnostics(), readRawAngle(), readRawAngle(), and testEncoderComms().
| void loop | ( | ) |
Definition at line 186 of file main.cpp.
References as5600Ping(), checkMagnetPresence(), correctAngle(), correctedAngle, degAngle, delay(), dumpDiagnostics(), rawToDegrees(), READ_ERROR, readRawAngle(), sensorOk, and Serial.
| float rawToDegrees | ( | uint16_t | raw | ) |
| uint16_t readRawAngle | ( | ) |
Definition at line 109 of file main.cpp.
References i2cReadBytes(), READ_ERROR, and REG_RAW_MSB.
| void setup | ( | void | ) |
Definition at line 155 of file main.cpp.
References as5600Ping(), checkMagnetPresence(), delay(), dumpDiagnostics(), rawToDegrees(), READ_ERROR, readRawAngle(), SCL_PIN, SDA_PIN, sensorOk, Serial, and startAngle.
| float correctedAngle = 0.0f |
Definition at line 27 of file main.cpp.
Referenced by correctAngle(), and loop().
| float degAngle = 0.0f |
Definition at line 26 of file main.cpp.
Referenced by correctAngle(), and loop().
| float startAngle = 0.0f |
Definition at line 25 of file main.cpp.
Referenced by correctAngle(), and setup().