diff --git a/src/ArduinoHal.h b/src/ArduinoHal.h index a74f73a9..61ad272d 100644 --- a/src/ArduinoHal.h +++ b/src/ArduinoHal.h @@ -30,7 +30,9 @@ class ArduinoHal : public RadioLibHal { /*! \brief Arduino Hal constructor. Will not attempt SPI interface initialization. + \param spi SPI interface to be used, can also use software SPI implementations. + \param spiSettings SPI interface settings. */ ArduinoHal(SPIClass& spi, SPISettings spiSettings = RADIOLIB_DEFAULT_SPI_SETTINGS); diff --git a/src/Hal.h b/src/Hal.h index 64bfea2f..bd2369d4 100644 --- a/src/Hal.h +++ b/src/Hal.h @@ -6,6 +6,7 @@ /*! \class Hal + \brief Hardware abstraction library base interface. */ class RadioLibHal { @@ -46,11 +47,17 @@ class RadioLibHal { /*! \brief Default constructor. + \param input Value to be used as the "input" GPIO direction. + \param output Value to be used as the "output" GPIO direction. + \param low Value to be used as the "low" GPIO level. + \param high Value to be used as the "high" GPIO level. + \param rising Value to be used as the "rising" GPIO level change direction. + \param falling Value to be used as the "falling" GPIO level change direction. */ RadioLibHal(const uint32_t input, const uint32_t output, const uint32_t low, const uint32_t high, const uint32_t rising, const uint32_t falling); @@ -60,7 +67,9 @@ class RadioLibHal { /*! \brief GPIO pin mode (input/output/...) configuration method. Must be implemented by the platform-specific hardware abstraction! + \param pin Pin to be changed (platform-specific). + \param mode Mode to be set (platform-specific). */ virtual void pinMode(uint32_t pin, uint32_t mode) = 0; @@ -68,7 +77,9 @@ class RadioLibHal { /*! \brief Digital write method. Must be implemented by the platform-specific hardware abstraction! + \param pin Pin to be changed (platform-specific). + \param value Value to set (platform-specific). */ virtual void digitalWrite(uint32_t pin, uint32_t value) = 0; @@ -76,7 +87,9 @@ class RadioLibHal { /*! \brief Digital read method. Must be implemented by the platform-specific hardware abstraction! + \param pin Pin to be changed (platform-specific). + \returns Value read on the pin (platform-specific). */ virtual uint32_t digitalRead(uint32_t pin) = 0; @@ -84,8 +97,11 @@ class RadioLibHal { /*! \brief Method to attach function to an external interrupt. Must be implemented by the platform-specific hardware abstraction! + \param interruptNum Interrupt number to attach to (platform-specific). + \param interruptCb Interrupt service routine to execute. + \param mode Rising/falling mode (platform-specific). */ virtual void attachInterrupt(uint32_t interruptNum, void (*interruptCb)(void), uint32_t mode) = 0; @@ -93,6 +109,7 @@ class RadioLibHal { /*! \brief Method to detach function from an external interrupt. Must be implemented by the platform-specific hardware abstraction! + \param interruptNum Interrupt number to detach from (platform-specific). */ virtual void detachInterrupt(uint32_t interruptNum) = 0; @@ -100,6 +117,7 @@ class RadioLibHal { /*! \brief Blocking wait function. Must be implemented by the platform-specific hardware abstraction! + \param ms Number of milliseconds to wait. */ virtual void delay(unsigned long ms) = 0; @@ -107,6 +125,7 @@ class RadioLibHal { /*! \brief Blocking microsecond wait function. Must be implemented by the platform-specific hardware abstraction! + \param us Number of microseconds to wait. */ virtual void delayMicroseconds(unsigned long us) = 0; @@ -114,6 +133,7 @@ class RadioLibHal { /*! \brief Get number of milliseconds since start. Must be implemented by the platform-specific hardware abstraction! + \returns Number of milliseconds since start. */ virtual unsigned long millis() = 0; @@ -121,6 +141,7 @@ class RadioLibHal { /*! \brief Get number of microseconds since start. Must be implemented by the platform-specific hardware abstraction! + \returns Number of microseconds since start. */ virtual unsigned long micros() = 0; @@ -128,9 +149,13 @@ class RadioLibHal { /*! \brief Measure the length of incoming digital pulse in microseconds. Must be implemented by the platform-specific hardware abstraction! + \param pin Pin to measure on (platform-specific). + \param state Pin level to monitor (platform-specific). + \param timeout Timeout in microseconds. + \returns Pulse length in microseconds, or 0 if the pulse did not start before timeout. */ virtual long pulseIn(uint32_t pin, uint32_t state, unsigned long timeout) = 0; @@ -147,7 +172,9 @@ class RadioLibHal { /*! \brief Method to transfer one byte over SPI. + \param b Byte to send. + \returns Received byte. */ virtual uint8_t spiTransfer(uint8_t b) = 0; @@ -181,14 +208,18 @@ class RadioLibHal { /*! \brief Method to produce a square-wave with 50% duty cycle ("tone") of a given frequency at some pin. + \param pin Pin to be used as the output. + \param frequency Frequency of the square wave. + \param duration Duration of the tone in ms. When set to 0, the tone will be infinite. */ virtual void tone(uint32_t pin, unsigned int frequency, unsigned long duration = 0); /*! \brief Method to stop producing a tone. + \param pin Pin which is currently producing the tone. */ virtual void noTone(uint32_t pin); @@ -200,7 +231,9 @@ class RadioLibHal { /*! \brief Function to convert from pin number to interrupt number. + \param pin Pin to convert from. + \returns The interrupt number of a given pin. */ virtual uint32_t pinToInterrupt(uint32_t pin);