-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dr. Steven Strange
committed
Aug 13, 2023
0 parents
commit b758d65
Showing
10 changed files
with
299 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ColumnLimit: 140 | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^<ext/.*\.h>' | ||
Priority: 1 | ||
- Regex: '^<.*\.h>' | ||
Priority: 2 | ||
- Regex: '^"ext/.*\.h"' | ||
Priority: 3 | ||
- Regex: '^".*"' | ||
Priority: 4 | ||
SortIncludes: CaseSensitive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Ignore MacOS generated directory | ||
/**/.DS_Store | ||
|
||
# Ignore PlatformIO build directory | ||
.pio | ||
|
||
# Ignore CLion artifacts | ||
.idea | ||
cmake-build-* | ||
CMakeListsPrivate.txt | ||
|
||
# Ignore Doxygen output directory | ||
docs | ||
|
||
# Ignore compiled and linked binaries | ||
*.o | ||
*.a | ||
*.so | ||
*.dll | ||
*.exe | ||
*.out | ||
|
||
# Ignore backup files created by text editors | ||
*~ | ||
*.bak | ||
*.swp | ||
*.swo | ||
|
||
# Ignore macOS system files | ||
.DS_Store | ||
._* | ||
|
||
# Ignore other common temp or cache files | ||
*.log | ||
*.tmp | ||
*.pid | ||
*.pyc | ||
*.lo | ||
*.la | ||
*-stamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# AhmsVille Dial 2 sensor adapter interfaces | ||
This package contains the sensor adapter interfaces necessary for AhmsVille Dial 2 to work. | ||
|
||
The intention of this library is to provide abstract sensor adapter interfaces to decouple sensor-related operations | ||
from the application firmware in order to be able to test the firmware properly. | ||
|
||
This library **is <u>not</u> allowed** to include **any** `Arduino` dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Dial2AbstractSensors", | ||
"keywords": "sensors, abstract, interfaces", | ||
"description": "A simple library containing abstract interfaces for sensor adapters for the AhmsVille Dial 2", | ||
"version": "1.00.0", | ||
"authors": { | ||
"name": "Igor Voronin", | ||
"url": "https://github.com/divStar" | ||
}, | ||
"frameworks": "*", | ||
"platforms": "*", | ||
"build": { | ||
"libArchive": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef DIALER_IALLSENSORS_H | ||
#define DIALER_IALLSENSORS_H | ||
|
||
#include "ICapacitiveSensorAdapter.h" | ||
#include "IHapticSensorAdapter.h" | ||
#include "IMacroKeys.h" | ||
#include "IRotaryEncoderAdapter.h" | ||
#include "ISpaceNavigatorSensorAdapter.h" | ||
|
||
class IAllSensors { | ||
public: | ||
/** | ||
* @brief Creates the sensor adapters depending on the concrete implementation. | ||
*/ | ||
virtual void createSensorAdapters() = 0; | ||
|
||
/** | ||
* @return (IMacroKeys) returns the macro keys sensor adapter | ||
*/ | ||
virtual IMacroKeys &getMacroKeys() = 0; | ||
|
||
/** | ||
* @return (IRotaryEncoderAdapter) returns the upper knob sensor adapter | ||
*/ | ||
virtual IRotaryEncoderAdapter &getUpperKnobSensor() = 0; | ||
|
||
/** | ||
* @return (IRotaryEncoderAdapter) returns the lower knob sensor adapter | ||
*/ | ||
virtual IRotaryEncoderAdapter &getLowerKnobSensor() = 0; | ||
|
||
/** | ||
* @return (IHapticSensorAdapter) returns the haptic sensor adapter | ||
*/ | ||
virtual IHapticSensorAdapter &getHapticSensor() = 0; | ||
|
||
/** | ||
* @return (ICapacitiveSensorAdapter) returns the capacitive sensor adapter | ||
*/ | ||
virtual ICapacitiveSensorAdapter &getCapacitiveSensor() = 0; | ||
|
||
/** | ||
* @return (ISpaceNavigatorSensorAdapter) returns the space navigator sensor adapter | ||
*/ | ||
virtual ISpaceNavigatorSensorAdapter &getSpaceNavigatorSensors() = 0; | ||
}; | ||
|
||
#endif // DIALER_IALLSENSORS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef DIALER_ICAPACITIVESENSORADAPTER_H | ||
#define DIALER_ICAPACITIVESENSORADAPTER_H | ||
|
||
#include <cstdint> | ||
|
||
/** | ||
* @class ICapacitiveSensorAdapter | ||
* @brief Interface to decouple the actual capacitive sensor from the task | ||
* processing it. | ||
* | ||
* This interface decouples the capacitive sensor from the task, that uses it, | ||
* and allows for proper testing. | ||
* | ||
* @author Igor Voronin | ||
* @date 06.08.2023 | ||
*/ | ||
class ICapacitiveSensorAdapter { | ||
public: | ||
virtual ~ICapacitiveSensorAdapter() = default; | ||
|
||
/** | ||
* @brief Sets the exact same value on the actual sensor class (or mock). | ||
* | ||
* @param millis (unsigned long) milliseconds to reset to | ||
*/ | ||
virtual void set_CS_AutocaL_Millis(unsigned long millis) = 0; | ||
|
||
/** | ||
* @brief Retrieves the sensor values, uses the given amount of samples. | ||
* | ||
* @param samples (uint8_t) amount of samples of the sensor value | ||
* @return (long) sensor value | ||
*/ | ||
virtual long capacitiveSensor(uint8_t samples) = 0; | ||
}; | ||
|
||
#endif // DIALER_ICAPACITIVESENSORADAPTER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef DIALER_IHAPTICSENSORADAPTER_H | ||
#define DIALER_IHAPTICSENSORADAPTER_H | ||
|
||
/** | ||
* @class IHapticSensorAdapter | ||
* @brief Interface to decouple the actual haptic sensor from the task | ||
* processing it. | ||
* | ||
* This interface decouples the haptic sensor from the task, that uses it, and | ||
* allows for proper testing. | ||
* | ||
* @author Igor Voronin | ||
* @date 06.08.2023 | ||
*/ | ||
class IHapticSensorAdapter { | ||
public: | ||
virtual ~IHapticSensorAdapter() = default; | ||
|
||
/** | ||
* @brief Writes the given strength value to the haptic sensor. | ||
* | ||
* @param strength (uint8_t) strength value for the haptic sensor; 0 to 255 seem | ||
* like sensible values | ||
*/ | ||
virtual void writeStrength(uint8_t strength) = 0; | ||
}; | ||
|
||
#endif // DIALER_IHAPTICSENSORADAPTER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef DIALER_IMACROKEYS_H | ||
#define DIALER_IMACROKEYS_H | ||
|
||
/** | ||
* @class IMacroKeys | ||
* @brief Interface to decouple the actual macro key adapter-interfaces from the task | ||
* processing it. | ||
* | ||
* @author Igor Voronin | ||
* @date 06.08.2023 | ||
*/ | ||
class IMacroKeys { | ||
public: | ||
virtual ~IMacroKeys() = default; | ||
|
||
/** | ||
* @brief Initializes the macro keys (or mocks thereof). | ||
*/ | ||
virtual void initializeMacroKeys() = 0; | ||
}; | ||
|
||
#endif // DIALER_IMACROKEYS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef DIALER_IROTARYENCODERADAPTER_H | ||
#define DIALER_IROTARYENCODERADAPTER_H | ||
|
||
/** | ||
* @class IRotaryEncoderAdapter | ||
* @brief Interface to decouple the actual rotary encoder adapter-interfaces from the | ||
* task processing it. | ||
* | ||
* This interface decouples the rotary encoder adapter-interfaces from the task, that uses | ||
* it, and allows for proper testing. | ||
* | ||
* @author Igor Voronin | ||
* @date 06.08.2023 | ||
*/ | ||
class IRotaryEncoderAdapter { | ||
public: | ||
virtual ~IRotaryEncoderAdapter() = default; | ||
|
||
/** | ||
* @brief Reads values from the sensor. | ||
*/ | ||
virtual void readValues() = 0; | ||
|
||
/** | ||
* @return (float) Gets the positive or negative rotation angle delta between | ||
* the current and the previous angle. | ||
*/ | ||
[[nodiscard]] virtual float getRotationAngleDelta() const = 0; | ||
}; | ||
|
||
#endif // DIALER_IROTARYENCODERADAPTER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef DIALER_ISPACENAVIGATORSENSORADAPTER_H | ||
#define DIALER_ISPACENAVIGATORSENSORADAPTER_H | ||
|
||
#include <cstdint> | ||
|
||
/** | ||
* @class ISpaceNavigatorSensorAdapter | ||
* @brief Interface to decouple the actual MPU6050 sensor(s) from the task | ||
* processing it. | ||
* | ||
* This interface decouples the MPU6050 sensor(s) from the task, that uses it, | ||
* and allows for proper testing. | ||
* | ||
* @author Igor Voronin | ||
* @date 06.08.2023 | ||
*/ | ||
class ISpaceNavigatorSensorAdapter { | ||
public: | ||
virtual ~ISpaceNavigatorSensorAdapter() = default; | ||
|
||
/** | ||
* @brief Sets up the MPU6050 sensor (or a mock thereof). | ||
*/ | ||
virtual void setup() = 0; | ||
|
||
/** | ||
* @brief Calibrates the MPU6050 sensor (or a mock thereof). | ||
*/ | ||
virtual void calibrate() = 0; | ||
|
||
/** | ||
* @brief Tests the connection to the MPU6050 sensor (or a mock thereof). | ||
*/ | ||
virtual bool testConnection() = 0; | ||
|
||
/** | ||
* @brief Retrieves the accelerometer and gyroscope x, y and z values and | ||
* writes them to the supplied variables. | ||
* | ||
* @param ax (int16_t) accelerometer X | ||
* @param ay (int16_t) accelerometer Y | ||
* @param az (int16_t) accelerometer Z | ||
* @param gx (int16_t) gyroscope X | ||
* @param gy (int16_t) gyroscope Y | ||
* @param gz (int16_t) gyroscope Z | ||
*/ | ||
virtual void getMotion6(int16_t *ax, int16_t *ay, int16_t *az, int16_t *gx, int16_t *gy, int16_t *gz) = 0; | ||
|
||
/** | ||
* @brief Retrieves whether the DMP initialization has finished successfully | ||
* (<code>dmpInitDone = 0</code>). | ||
* | ||
* @return (bool) <code>true</code> if the DMP initialization finished | ||
* successfully, <code>false</code> otherwise | ||
*/ | ||
virtual bool isDmpInitDone() = 0; | ||
}; | ||
|
||
#endif // DIALER_ISPACENAVIGATORSENSORADAPTER_H |