*.zip
+build
# Created by https://www.toptal.com/developers/gitignore/api/c++,visualstudio,visualstudiocode,xcode,sublimetext,qt,qtcreator,macos,windows,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=c++,visualstudio,visualstudiocode,xcode,sublimetext,qt,qtcreator,macos,windows,linux
+### CMake ###
+CMakeLists.txt.user
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Testing
+Makefile
+cmake_install.cmake
+install_manifest.txt
+compile_commands.json
+CTestTestfile.cmake
+CPack*.cmake
+_deps
+DartConfiguration.tcl
+
+### CMake Patch ###
+# External projects
+*-prefix/
+
### C++ ###
# Prerequisites
*.d
--- /dev/null
+[submodule "TactonPlayer/ArduinoSerial"]
+ path = TactonPlayer/ArduinoSerial
+ url = https://github.com/RackhamLeNoir/arduinoserial
--- /dev/null
+{
+ // Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
+ // Pointez pour afficher la description des attributs existants.
+ // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Angle tester",
+ "type": "cppdbg",
+ "request": "launch",
+ "program": "${workspaceFolder}/build/TactonDebug/AngleTester/AngleTester",
+ "args": [],
+ "environment": [],
+ "cwd": "${workspaceFolder}/TactonDebug/AngleTester/",
+ "externalConsole": false,
+ "logging": {
+ "moduleLoad": false,
+ "trace": true
+ },
+ "MIMode": "lldb",
+ "showDisplayString": true
+ },
+ {
+ "name": "Tacton Debug",
+ "type": "cppdbg",
+ "request": "launch",
+ "program": "${workspaceFolder}/build/TactonDebug/TactonDebug/TactonDebug",
+ "args": [], "cwd": "${workspaceFolder}/TactonDebug/TactonDebug/",
+ "externalConsole": false,
+ "logging": {
+ "moduleLoad": false,
+ "trace": true
+ },
+ "MIMode": "lldb",
+ "showDisplayString": true
+ },
+ {
+ "name": "Magic circle",
+ "type": "cppdbg",
+ "request": "launch",
+ "program": "${workspaceFolder}/build/TactonDebug/MagicCircle/MagicCircle",
+ "environment": [], "cwd": "${workspaceFolder}/TactonDebug/MagicCircle/",
+ "externalConsole": false,
+ "logging": {
+ "moduleLoad": false,
+ "trace": true
+ },
+ "MIMode": "lldb",
+ "showDisplayString": true
+ }
+ ]
+}
\ No newline at end of file
--- /dev/null
+{
+ "version": "2.0.0",
+ "tasks": []
+}
\ No newline at end of file
--- /dev/null
+cmake_minimum_required(VERSION 3.0.0)
+project(TactonTools VERSION 0.1.0)
+
+add_subdirectory(TactonPlayer)
+add_subdirectory(TactonDebug/AngleTester)
+add_subdirectory(TactonDebug/MagicCircle)
+add_subdirectory(TactonDebug/TactonDebug)
--- /dev/null
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(APPLE AND EXISTS /usr/local/opt/qt6)
+ list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt6")
+endif()
+
+find_package(Qt6 REQUIRED COMPONENTS Widgets)
+
+add_executable(AngleTester main.cpp angletester.cpp)
+
+target_link_libraries(AngleTester PRIVATE TactonPlayer Qt6::Core Qt6::Gui Qt6::Widgets)
\r
#include <cmath>\r
\r
-AngleTester::AngleTester(QWidget *parent, Qt::WFlags flags)\r
+AngleTester::AngleTester(QWidget *parent, Qt::WindowFlags flags)\r
: QMainWindow(parent, flags)\r
{\r
try\r
#ifndef ANGLETESTER_H\r
#define ANGLETESTER_H\r
\r
-#include <QtGui/QMainWindow>\r
+#include <QMainWindow>\r
#include "ui_angletester.h"\r
\r
-#include <TactonPlayer\TactonPlayer.hpp>\r
+#include <TactonPlayer.hpp>\r
\r
class AngleTester : public QMainWindow, Ui::AngleTesterClass\r
{\r
Q_OBJECT\r
\r
public:\r
- AngleTester(QWidget *parent = 0, Qt::WFlags flags = 0);\r
+ AngleTester(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget);\r
~AngleTester();\r
\r
public slots:\r
#include "angletester.h"\r
-#include <QtGui/QApplication>\r
+#include <QApplication>\r
\r
int main(int argc, char *argv[])\r
{\r
--- /dev/null
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(APPLE AND EXISTS /usr/local/opt/qt6)
+ list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt6")
+endif()
+
+find_package(Qt6 REQUIRED COMPONENTS Widgets)
+
+add_executable(MagicCircle main.cpp magiccircle.cpp)
+
+target_link_libraries(MagicCircle PUBLIC TactonPlayer Qt6::Core Qt6::Gui Qt6::Widgets)
\r
#include <cmath>\r
\r
-MagicCircle::MagicCircle(QWidget *parent, Qt::WFlags flags)\r
+MagicCircle::MagicCircle(QWidget *parent, Qt::WindowFlags flags)\r
: QMainWindow(parent, flags), _timer(this), _angle(0), _clockwise(true)\r
{\r
try\r
#ifndef MAGICCIRCLE_H\r
#define MAGICCIRCLE_H\r
\r
-#include <QtGui/QMainWindow>\r
+#include <QMainWindow>\r
#include "ui_magiccircle.h"\r
\r
#include <QTimer>\r
\r
-#include <TactonPlayer\TactonPlayer.hpp>\r
+#include <TactonPlayer.hpp>\r
\r
class MagicCircle : public QMainWindow, Ui::MagicCircleClass\r
{\r
Q_OBJECT\r
\r
public:\r
- MagicCircle(QWidget *parent = 0, Qt::WFlags flags = 0);\r
+ MagicCircle(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget);\r
~MagicCircle();\r
\r
public slots:\r
#include "magiccircle.h"\r
-#include <QtGui/QApplication>\r
+#include <QApplication>\r
\r
int main(int argc, char *argv[])\r
{\r
--- /dev/null
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(APPLE AND EXISTS /usr/local/opt/qt6)
+ list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt6")
+endif()
+
+find_package(Qt6 REQUIRED COMPONENTS Widgets)
+
+add_executable(TactonDebug main.cpp tactondebug.cpp)
+
+target_link_libraries(TactonDebug PUBLIC TactonPlayer Qt6::Core Qt6::Gui Qt6::Widgets)
#include "tactondebug.h"\r
-#include <QtGui/QApplication>\r
+#include <QApplication>\r
\r
int main(int argc, char *argv[])\r
{\r
int TactonDebug::MaxAmplitude = 255;\r
int TactonDebug::MaxDuration = 2000;\r
\r
-TactonDebug::TactonDebug(QWidget *parent, Qt::WFlags flags)\r
+TactonDebug::TactonDebug(QWidget *parent, Qt::WindowFlags flags)\r
:QMainWindow(parent, flags)\r
{\r
try\r
#ifndef TACTONDEBUG_H\r
#define TACTONDEBUG_H\r
\r
-#include <QtGui/QMainWindow>\r
+#include <QMainWindow>\r
#include "ui_tactondebug.h"\r
\r
-#include <TactonPlayer\TactonPlayer.hpp>\r
+#include <TactonPlayer.hpp>\r
\r
class TactonDebug : public QMainWindow, Ui::TactonDebugClass\r
{\r
Q_OBJECT\r
\r
public:\r
- TactonDebug(QWidget *parent = 0, Qt::WFlags flags = 0);\r
+ TactonDebug(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget);\r
~TactonDebug();\r
\r
public slots:\r
--- /dev/null
+Subproject commit 975c6c196580d3c928e76cb1514912bd42d16315
--- /dev/null
+add_subdirectory(ArduinoSerial)
+
+set(source_files
+ Tacton.cpp
+ TactonPlayer.cpp
+)
+add_library(TactonPlayer ${source_files})
+
+target_link_libraries(TactonPlayer PUBLIC ArduinoSerial)
+
+target_include_directories(TactonPlayer INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+
return _nbframes;\r
}\r
\r
-__declspec(dllexport) void Tacton::setPattern(char pattern)\r
+void Tacton::setPattern(char pattern)\r
{\r
setPattern(0, pattern);\r
}\r
\r
-__declspec(dllexport) void Tacton::setPattern(unsigned int frame, char pattern)\r
+void Tacton::setPattern(unsigned int frame, char pattern)\r
{\r
if (frame < _nbframes)\r
_patterns[frame] = pattern;\r
}\r
\r
-__declspec(dllexport) void Tacton::setPattern(char *pattern)\r
+void Tacton::setPattern(char *pattern)\r
{\r
setPattern(0, pattern);\r
}\r
\r
-__declspec(dllexport) void Tacton::setPattern(const char *pattern)\r
+void Tacton::setPattern(const char *pattern)\r
{\r
setPattern(0, pattern);\r
}\r
\r
-__declspec(dllexport) void Tacton::setPattern(unsigned int frame, char *pattern)\r
+void Tacton::setPattern(unsigned int frame, char *pattern)\r
{\r
if (frame < _nbframes)\r
{\r
}\r
}\r
\r
-__declspec(dllexport) void Tacton::setPattern(unsigned int frame, const char *pattern)\r
+void Tacton::setPattern(unsigned int frame, const char *pattern)\r
{\r
if (frame < _nbframes)\r
{\r
}\r
}\r
\r
-__declspec(dllexport) void Tacton::setDuration(unsigned int duration)\r
+void Tacton::setDuration(unsigned int duration)\r
{\r
setDuration(0, duration);\r
}\r
\r
-__declspec(dllexport) void Tacton::setDuration(unsigned int frame, unsigned int duration)\r
+void Tacton::setDuration(unsigned int frame, unsigned int duration)\r
{\r
if (frame < _nbframes)\r
_durations[frame] = duration;\r
}\r
\r
-__declspec(dllexport) void Tacton::setFrequency(unsigned int frequency)\r
+void Tacton::setFrequency(unsigned int frequency)\r
{\r
setFrequency(0, frequency);\r
}\r
\r
-__declspec(dllexport) void Tacton::setFrequency(unsigned int frame, unsigned int frequency)\r
+void Tacton::setFrequency(unsigned int frame, unsigned int frequency)\r
{\r
if (frame < _nbframes)\r
_frequencies[frame] = frequency;\r
}\r
\r
-__declspec(dllexport) void Tacton::setAmplitude(unsigned int amplitude)\r
+void Tacton::setAmplitude(unsigned int amplitude)\r
{\r
setAmplitude(0, amplitude);\r
}\r
\r
-__declspec(dllexport) void Tacton::setAmplitude(unsigned int frame, unsigned int amplitude)\r
+void Tacton::setAmplitude(unsigned int frame, unsigned int amplitude)\r
{\r
if (frame < _nbframes)\r
_amplitudes[frame] = amplitude;\r
#define POS2_LEFT 0x04\r
#define POS2_DOWN 0x08\r
\r
-#ifdef __MACOSX__\r
-#define EXPORTED\r
-#else\r
+#ifdef _WIN32\r
#ifdef _WINDLL\r
- #define EXPORTED __declspec(dllexport)\r
+ #define EXPORTED __declspec(dllexport)\r
#else \r
- #define EXPORTED __declspec(dllimport)\r
+ #define EXPORTED __declspec(dllimport)\r
#endif\r
+#else\r
+ #define EXPORTED\r
#endif\r
\r
class EXPORTED Tacton \r
#include "TactonPlayer.hpp"\r
\r
-#include <ArduinoSerial\SerialWindows.hpp>\r
+#ifdef _WIN32\r
+ #include <SerialWindows.hpp>\r
+#elif defined(LINUX)\r
+ #include <SerialLinux.hpp>\r
+#else\r
+ #include <SerialMac.hpp>\r
+#endif\r
\r
#include <stdexcept>\r
+#include <cstring>\r
\r
TactonPlayer::TactonPlayer(const char *port)\r
{\r
try\r
{\r
+#ifdef _WIN32\r
_comport = new SerialWindows(port);\r
+#elif defined(LINUX)\r
+ _comport = new SerialLinux(port);\r
+#else\r
+ _comport = new SerialMac(port);\r
+#endif\r
}\r
catch(...)\r
{\r
void TactonPlayer::start()\r
{\r
if (_comport)\r
- _comport->WriteData("S", 1);\r
+ _comport->WriteData((void *)("S"), 1);\r
}\r
\r
void TactonPlayer::stop()\r
{\r
if (_comport)\r
- _comport->WriteData("Q", 1);\r
+ _comport->WriteData((void *)("Q"), 1);\r
}\r
\r
void TactonPlayer::regist(const Tacton &t)\r
if (!_comport)\r
return;\r
\r
- _comport->WriteData("B", 1);\r
+ _comport->WriteData((void *)("B"), 1);\r
}\r
\r
void TactonPlayer::debugRead(char *res, int nb) const\r
\r
#include "Tacton.hpp"\r
\r
-#ifdef __MACOSX__\r
#include <Serial.hpp>\r
-#define EXPORTED\r
-#else\r
-#include <ArduinoSerial\Serial.hpp>\r
+\r
+#ifdef _WIN32\r
#ifdef _WINDLL\r
- #define EXPORTED __declspec(dllexport)\r
- #else\r
- #define EXPORTED __declspec(dllimport)\r
+ #define EXPORTED __declspec(dllexport)\r
+ #else \r
+ #define EXPORTED __declspec(dllimport)\r
#endif\r
+#else\r
+ #define EXPORTED\r
#endif\r
\r
class EXPORTED TactonPlayer\r