diff --git a/docs/config.qdocconf b/docs/config.qdocconf new file mode 100644 index 0000000..69cc0d8 --- /dev/null +++ b/docs/config.qdocconf @@ -0,0 +1,30 @@ +include(html-template.qdocconf) + +project = nymea-gpio +description = nymea-gpio documentation + +dita.metadata.default.author = Simon Stürz +dita.metadata.default.permissions = all +dita.metadata.default.publisher = guh GmbH +dita.metadata.default.copyryear = 2019 +dita.metadata.default.copyrholder = Simon Stürz +dita.metadata.default.audience = programmer + +outputdir = html +outputformats = HTML + +language = Cpp + +naturallanguage = en_US +outputencoding = UTF-8 +sourceencoding = UTF-8 + +syntaxhighlighting = true + +headerdirs = ../libnymea-gpio +sourcedirs = ../libnymea-gpio + +headers.fileextensions = "*.h" +sources.fileextensions = "*.cpp" + +Cpp.ignoredirectives = Q_DECLARE_METATYPE Q_DECLARE_LOGGING_CATEGORY Q_LOGGING_CATEGORY diff --git a/docs/html-template.qdocconf b/docs/html-template.qdocconf new file mode 100644 index 0000000..d5b6643 --- /dev/null +++ b/docs/html-template.qdocconf @@ -0,0 +1,11 @@ +HTML.templatedir = . + +HTML.postpostheader = \ + "
\n" + +HTML.prologue = \ + "
\n" + +HTML.footer = \ + "
\n" \ + "
\n" diff --git a/libnymea-gpio/gpio.cpp b/libnymea-gpio/gpio.cpp index 8b4b58e..432fde2 100644 --- a/libnymea-gpio/gpio.cpp +++ b/libnymea-gpio/gpio.cpp @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /*! \class Gpio \brief Represents a system GPIO in linux systems. @@ -48,39 +70,44 @@ } qDebug() << "Current value" << gpioIn->value(); \endcode - \sa GpioMonitor, GpioButton + \sa GpioMonitor */ + /*! \enum Gpio::Direction - This enum type specifies the dirction a \l{Gpio}. + This enum type specifies the dirction a Gpio. + \value DirectionInput - The \l{Gpio} is configured as \b input. + The Gpio is configured as \b input. \value DirectionOutput - The \l{Gpio} is configured as \b output. + The Gpio is configured as \b output. \value DirectionInvalid The direction is not valid. */ /*! \enum Gpio::Value - This enum type specifies the value a \l{Gpio}. + This enum type specifies the value a Gpio. + \value ValueLow - The \l{Gpio} is low. + The Gpio is low. \value ValueHigh - The \l{Gpio} is high. + The Gpio is high. \value ValueInvalid The value is not valid. */ + /*! \enum Gpio::Edge - This enum type specifies the edge interrupt type of a \l{Gpio}. + This enum type specifies the edge interrupt type of a Gpio. + \value EdgeFalling - The \l{Gpio} reacts on falling edge interrupt. + The Gpio reacts on falling edge interrupt. \value EdgeRising - The \l{Gpio} reacts on rising edge interrupt. + The Gpio reacts on rising edge interrupt. \value EdgeBoth - The \l{Gpio} reacts on both, rising and falling edge interrupt. + The Gpio reacts on both, rising and falling edge interrupt. \value EdgeNone - The \l{Gpio} does not react on interrupts. + The Gpio does not react on interrupts. */ #include "gpio.h" @@ -115,13 +142,15 @@ QString Gpio::gpioDirectory() const return m_gpioDirectory.canonicalPath(); } -/*! Returns the number of this \l{Gpio}. \note The Gpio number is mostly not equivalent with the pin number. */ +/*! Returns the number of this Gpio. + \note The Gpio number is mostly not equivalent with the pin number. +*/ int Gpio::gpioNumber() const { return m_gpio; } -/*! Returns true if this \l{Gpio} could be exported in the system file \tt {/sys/class/gpio/export}. If this Gpio is already exported, this function will return true. */ +/*! Returns true if this Gpio could be exported in the system file \tt {/sys/class/gpio/export}. If this Gpio is already exported, this function will return true. */ bool Gpio::exportGpio() { qCDebug(dcGpio()) << "Export GPIO" << m_gpio; @@ -143,7 +172,7 @@ bool Gpio::exportGpio() return true; } -/*! Returns true if this \l{Gpio} could be unexported in the system file \tt {/sys/class/gpio/unexport}. */ +/*! Returns true if this Gpio could be unexported in the system file \tt {/sys/class/gpio/unexport}. */ bool Gpio::unexportGpio() { qCDebug(dcGpio()) << "Unexport GPIO" << m_gpio; @@ -193,7 +222,7 @@ bool Gpio::setDirection(Gpio::Direction direction) return true; } -/*! Returns the direction of this \l{Gpio}. */ +/*! Returns the direction of this Gpio. */ Gpio::Direction Gpio::direction() { QFile directionFile(m_gpioDirectory.path() + QDir::separator() + "direction"); @@ -218,7 +247,7 @@ Gpio::Direction Gpio::direction() return Gpio::DirectionInvalid; } -/*! Returns true if the digital \a value of this \l{Gpio} could be set correctly. */ +/*! Returns true if the digital \a value of this Gpio could be set correctly. */ bool Gpio::setValue(Gpio::Value value) { qCDebug(dcGpio()) << "Set GPIO" << m_gpio << "value" << value; @@ -263,7 +292,7 @@ bool Gpio::setValue(Gpio::Value value) return true; } -/*! Returns the current digital value of this \l{Gpio}. */ +/*! Returns the current digital value of this Gpio. */ Gpio::Value Gpio::value() { QFile valueFile(m_gpioDirectory.path() + QDir::separator() + "value"); @@ -286,7 +315,7 @@ Gpio::Value Gpio::value() return Gpio::ValueInvalid; } -/*! This method allows to invert the logic of this \l{Gpio}. Returns true, if the GPIO could be set \a activeLow. */ +/*! This method allows to invert the logic of this Gpio. Returns true, if the GPIO could be set \a activeLow. */ bool Gpio::setActiveLow(bool activeLow) { qCDebug(dcGpio()) << "Set GPIO" << m_gpio << "active low" << activeLow; @@ -308,7 +337,7 @@ bool Gpio::setActiveLow(bool activeLow) return true; } -/*! Returns true if the logic of this \l{Gpio} is inverted (1 = low, 0 = high). */ +/*! Returns true if the logic of this Gpio is inverted (1 = low, 0 = high). */ bool Gpio::activeLow() { QFile activeLowFile(m_gpioDirectory.path() + QDir::separator() + "active_low"); @@ -365,7 +394,7 @@ bool Gpio::setEdgeInterrupt(Gpio::Edge edge) return true; } -/*! Returns the edge interrupt of this \l{Gpio}. */ +/*! Returns the edge interrupt of this Gpio. */ Gpio::Edge Gpio::edgeInterrupt() { QFile edgeFile(m_gpioDirectory.path() + QDir::separator() + "edge"); @@ -393,7 +422,7 @@ Gpio::Edge Gpio::edgeInterrupt() } - +/*! Prints the given \a gpio to \a debug. */ QDebug operator<<(QDebug debug, Gpio *gpio) { debug.nospace() << "Gpio(" << gpio->gpioNumber() << ", "; diff --git a/libnymea-gpio/gpio.h b/libnymea-gpio/gpio.h index d914619..cc32d16 100644 --- a/libnymea-gpio/gpio.h +++ b/libnymea-gpio/gpio.h @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #ifndef GPIO_H #define GPIO_H @@ -11,6 +33,7 @@ Q_DECLARE_LOGGING_CATEGORY(dcGpio) class Gpio : public QObject { Q_OBJECT + public: enum Direction { DirectionInvalid, diff --git a/libnymea-gpio/gpiobutton.cpp b/libnymea-gpio/gpiobutton.cpp index b197eea..093e39a 100644 --- a/libnymea-gpio/gpiobutton.cpp +++ b/libnymea-gpio/gpiobutton.cpp @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #include "gpiobutton.h" GpioButton::GpioButton(int gpioNumber, QObject *parent) : diff --git a/libnymea-gpio/gpiobutton.h b/libnymea-gpio/gpiobutton.h index 5c69d19..57f8aec 100644 --- a/libnymea-gpio/gpiobutton.h +++ b/libnymea-gpio/gpiobutton.h @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #ifndef GPIOBUTTON_H #define GPIOBUTTON_H diff --git a/libnymea-gpio/gpiomonitor.cpp b/libnymea-gpio/gpiomonitor.cpp index 485c274..83ab7ce 100644 --- a/libnymea-gpio/gpiomonitor.cpp +++ b/libnymea-gpio/gpiomonitor.cpp @@ -1,6 +1,29 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /*! \class GpioMonitor \brief Monitor for GPIO interrupts. + \inmodule nymea-gpio This class allows to monitor an input GPIO for the interrupts depending on the \l{Gpio:Edge} configuration. @@ -130,6 +153,7 @@ void GpioMonitor::setEnabled(bool enabled) emit enabledChanged(m_enabled); } +/*! Reimplementation of the QThread run() method. Within the thread the Gpio value will be polled using poll() 2. */ void GpioMonitor::run() { // Create GPIO in the thread for initialisation diff --git a/libnymea-gpio/gpiomonitor.h b/libnymea-gpio/gpiomonitor.h index f84488d..e9653c7 100644 --- a/libnymea-gpio/gpiomonitor.h +++ b/libnymea-gpio/gpiomonitor.h @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #ifndef GPIOMONITOR_H #define GPIOMONITOR_H diff --git a/nymea-gpio-tool/application.cpp b/nymea-gpio-tool/application.cpp index 73c1d21..624d34b 100644 --- a/nymea-gpio-tool/application.cpp +++ b/nymea-gpio-tool/application.cpp @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #include "application.h" #include diff --git a/nymea-gpio-tool/application.h b/nymea-gpio-tool/application.h index 64941bc..8fbfa8d 100644 --- a/nymea-gpio-tool/application.h +++ b/nymea-gpio-tool/application.h @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #ifndef APPLICATION_H #define APPLICATION_H diff --git a/nymea-gpio-tool/main.cpp b/nymea-gpio-tool/main.cpp index 6aeb4d3..3496cf5 100644 --- a/nymea-gpio-tool/main.cpp +++ b/nymea-gpio-tool/main.cpp @@ -1,3 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2019 Simon Stürz * + * * + * This file is part of nymea-gpio. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; If not, see * + * . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #include #include "application.h"