diff --git a/docs/source/api/adc.rst b/docs/source/api/adc.rst index 1947fdcf990..8589c8085d5 100644 --- a/docs/source/api/adc.rst +++ b/docs/source/api/adc.rst @@ -30,12 +30,12 @@ This function is used to get the ADC raw value for a given pin/ADC channel. * ``pin`` GPIO pin to read analog value -This function will return analog raw value. +This function will return analog raw value (non-calibrated). analogReadMillivolts ^^^^^^^^^^^^^^^^^^^^ -This function is used to get ADC value for a given pin/ADC channel in millivolts. +This function is used to get ADC raw value for a given pin/ADC channel and convert it to calibrated result in millivolts. .. code-block:: arduino @@ -43,7 +43,7 @@ This function is used to get ADC value for a given pin/ADC channel in millivolts * ``pin`` GPIO pin to read analog value -This function will return analog value in millivolts. +This function will return analog value in millivolts (calibrated). analogReadResolution ^^^^^^^^^^^^^^^^^^^^ @@ -62,19 +62,6 @@ Range is 1 - 16 .The default value will be used, if this function is not used. * ``bits`` sets analog read resolution -analogSetClockDiv -^^^^^^^^^^^^^^^^^ - -This function is used to set the divider for the ADC clock. - -Range is 1 - 255. Default value is 1. - -.. code-block:: arduino - - void analogSetClockDiv(uint8_t clockDiv); - -* ``clockDiv`` sets the divider for ADC clock. - analogSetAttenuation ^^^^^^^^^^^^^^^^^^^^ @@ -149,17 +136,6 @@ This function is used to set the attenuation for a specific pin/ADC channel. For * ``pin`` selects specific pin for attenuation settings. * ``attenuation`` sets the attenuation. -adcAttachPin -^^^^^^^^^^^^ - -This function is used to attach the pin to ADC (it will also clear any other analog mode that could be on) - -.. code-block:: arduino - - bool adcAttachPin(uint8_t pin); - -This function will return ``true`` if configuration is successful. Else returns ``false``. - ADC API specific for ESP32 chip ******************************* @@ -173,30 +149,7 @@ Range is 9 - 12. .. code-block:: arduino void analogSetWidth(uint8_t bits); - -analogSetVRefPin -^^^^^^^^^^^^^^^^ - -This function is used to set pin to use for ADC calibration if the esp is not already calibrated (pins 25, 26 or 27). - -.. code-block:: arduino - - void analogSetVRefPin(uint8_t pin); - -* ``pin`` GPIO pin to set VRefPin for ADC calibration -hallRead -^^^^^^^^ - -This function is used to get the ADC value of the HALL sensor conneted to pins 36(SVP) and 39(SVN). - -.. code-block:: arduino - - int hallRead(); - -This function will return the hall sensor value. - - Example Applications ******************** diff --git a/docs/source/api/espnow.rst b/docs/source/api/espnow.rst index b26d47c3828..e6c5328c188 100644 --- a/docs/source/api/espnow.rst +++ b/docs/source/api/espnow.rst @@ -13,13 +13,13 @@ Examples ESP-NOW Master ************** -.. literalinclude:: ../../../libraries/ESP32/examples/ESPNow/Basic/Master/Master.ino +.. literalinclude:: ../../../libraries/ESP32/examples/ESPNow/ESPNow_Basic_Master/ESPNow_Basic_Master.ino :language: arduino ESP-NOW Slave ************* -.. literalinclude:: ../../../libraries/ESP32/examples/ESPNow/Basic/Slave/Slave.ino +.. literalinclude:: ../../../libraries/ESP32/examples/ESPNow/ESPNow_Basic_Slave/ESPNow_Basic_Slave.ino :language: arduino Resources diff --git a/docs/source/api/gpio.rst b/docs/source/api/gpio.rst index 2f63f26e00f..b60c3798e4f 100644 --- a/docs/source/api/gpio.rst +++ b/docs/source/api/gpio.rst @@ -87,7 +87,7 @@ The GPIO peripheral on the ESP32 supports interruptions. attachInterrupt *************** -The function ``attachInterruptArg`` is used to attach the interrupt to the defined pin. +The function ``attachInterrupt`` is used to attach the interrupt to the defined pin. .. code-block:: arduino diff --git a/docs/source/api/hall_sensor.rst b/docs/source/api/hall_sensor.rst deleted file mode 100644 index 7ab856eb172..00000000000 --- a/docs/source/api/hall_sensor.rst +++ /dev/null @@ -1,19 +0,0 @@ -########### -Hall Sensor -########### - -About ------ - -.. note:: This is a work in progress project and this section is still missing. If you want to contribute, please see the `Contributions Guide <../contributing.html>`_. - -Example -------- - -To get started with Hall sensor, you can try: - -Hall Sensor -*********** - -.. literalinclude:: ../../../libraries/ESP32/examples/HallSensor/HallSensor.ino - :language: arduino diff --git a/docs/source/api/timer.rst b/docs/source/api/timer.rst index d253b6794f9..95688657f41 100644 --- a/docs/source/api/timer.rst +++ b/docs/source/api/timer.rst @@ -28,11 +28,9 @@ This function is used to configure the timer. After successful setup the timer w .. code-block:: arduino - hw_timer_t * timerBegin(uint8_t num, uint16_t divider, bool countUp); + hw_timer_t * timerBegin(uint32_t frequency); -* ``num`` select timer number. -* ``divider`` select timer divider. Sets how quickly the timer counter is “ticking”. -* ``countUp`` select timer direction. Sets if the counter should be incrementing or decrementing. +* ``frequency`` select timer frequency in Hz. Sets how quickly the timer counter is “ticking”. This function will return ``timer`` structure if configuration is successful. If ``NULL`` is returned, error occurs and the timer was not configured. @@ -44,45 +42,7 @@ This function is used to end timer. .. code-block:: arduino - void timerEnd(hw_timer_t *timer); - -* ``timer`` timer struct. - -timerSetConfig -************** - -This function is used to configure initialized timer (timerBegin() called). - -.. code-block:: arduino - - uint32_t timerGetConfig(hw_timer_t *timer); - -* ``timer`` timer struct. - -This function will return ``configuration`` as uint32_t number. -This can be translated by inserting it to struct ``timer_cfg_t.val``. - -timerAttachInterrupt -******************** - -This function is used to attach interrupt to timer. - -.. code-block:: arduino - - void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge); - -* ``timer`` timer struct. -* ``fn`` funtion to be called when interrupt is triggered. -* ``edge`` select edge to trigger interrupt (only LEVEL trigger is currently supported). - -timerDetachInterrupt -******************** - -This function is used to detach interrupt from timer. - -.. code-block:: arduino - - void timerDetachInterrupt(hw_timer_t *timer); + void timerEnd(hw_timer_t * timer); * ``timer`` timer struct. @@ -93,7 +53,7 @@ This function is used to start counter of the timer. .. code-block:: arduino - void timerStart(hw_timer_t *timer); + void timerStart(hw_timer_t * timer); * ``timer`` timer struct. @@ -104,7 +64,7 @@ This function is used to stop counter of the timer. .. code-block:: arduino - void timerStop(hw_timer_t *timer); + void timerStop(hw_timer_t * timer); * ``timer`` timer struct. @@ -115,7 +75,7 @@ This function is used to restart counter of the timer. .. code-block:: arduino - void timerRestart(hw_timer_t *timer); + void timerRestart(hw_timer_t * timer); * ``timer`` timer struct. @@ -126,60 +86,11 @@ This function is used to set counter value of the timer. .. code-block:: arduino - void timerWrite(hw_timer_t *timer, uint64_t val); + void timerWrite(hw_timer_t * timer, uint64_t val); * ``timer`` timer struct. * ``val`` counter value to be set. -timerSetDivider -*************** - -This function is used to set the divider of the timer. - -.. code-block:: arduino - - void timerSetDivider(hw_timer_t *timer, uint16_t divider); - -* ``timer`` timer struct. -* ``divider`` divider to be set. - -timerSetCountUp -*************** - -This function is used to configure counting direction of the timer. - -.. code-block:: arduino - - void timerSetCountUp(hw_timer_t *timer, bool countUp); - -* ``timer`` timer struct. -* ``countUp`` select counting direction (``true`` = increment). - -timerSetAutoReload -****************** - -This function is used to set counter value of the timer. - -.. code-block:: arduino - - void timerSetAutoReload(hw_timer_t *timer, bool autoreload); - -* ``timer`` timer struct. -* ``autoreload`` select autoreload (``true`` = enabled). - -timerStarted -************ - -This function is used to get if the timer is running. - -.. code-block:: arduino - - bool timerStarted(hw_timer_t *timer); - -* ``timer`` timer struct. - -This function will return ``true`` if the timer is running. If ``false`` is returned, timer is stopped. - timerRead ********* @@ -187,7 +98,7 @@ This function is used to read counter value of the timer. .. code-block:: arduino - uint64_t timerRead(hw_timer_t *timer); + uint64_t timerRead(hw_timer_t * timer); * ``timer`` timer struct. @@ -200,7 +111,7 @@ This function is used to read counter value in microseconds of the timer. .. code-block:: arduino - uint64_t timerReadMicros(hw_timer_t *timer); + uint64_t timerReadMicros(hw_timer_t * timer); * ``timer`` timer struct. @@ -213,7 +124,7 @@ This function is used to read counter value in miliseconds of the timer. .. code-block:: arduino - uint64_t timerReadMilis(hw_timer_t *timer); + uint64_t timerReadMilis(hw_timer_t * timer); * ``timer`` timer struct. @@ -226,138 +137,74 @@ This function is used to read counter value in seconds of the timer. .. code-block:: arduino - double timerReadSeconds(hw_timer_t *timer); + double timerReadSeconds(hw_timer_t * timer); * ``timer`` timer struct. This function will return ``counter value`` of the timer in seconds. -timerGetDivider -*************** - -This function is used to get divider of the timer. - -.. code-block:: arduino - - uint16_t timerGetDivider(hw_timer_t *timer); - -* ``timer`` timer struct. - -This function will return ``divider`` of the timer. - -timerGetCountUp -*************** - -This function is used get counting direction of the timer. - -.. code-block:: arduino - - bool timerGetCountUp(hw_timer_t *timer); - -* ``timer`` timer struct. - -This function will return ``true`` if the timer counting direction is UP (incrementing). -If ``false`` returned, the timer counting direction is DOWN (decrementing). - -timerGetAutoReload -****************** - -This function is used to get configuration of auto reload of the timer. - -.. code-block:: arduino - - bool timerGetAutoReload(hw_timer_t *timer); - -* ``timer`` timer struct. - -This function will return ``true`` if the timer auto reload is enabled. -If ``false`` returned, the timer auto reload is disabled. - -timerAlarmEnable -**************** - -This function is used to enable generation of timer alarm events. - -.. code-block:: arduino - - void timerAlarmEnable(hw_timer_t *timer); - -* ``timer`` timer struct. - -timerAlarmDisable +timerGetFrequency ***************** -This function is used to disable generation of timer alarm events. +This function is used to get resolution in Hz of the timer. .. code-block:: arduino - void timerAlarmDisable(hw_timer_t *timer); + uint16_t timerGetFrequency(hw_timer_t * timer); * ``timer`` timer struct. - -timerAlarmWrite -*************** - -This function is used to configure alarm value and autoreload of the timer. - -.. code-block:: arduino - - void timerAlarmWrite(hw_timer_t *timer, uint64_t alarm_value, bool autoreload); - -* ``timer`` timer struct. -* ``alarm_value`` alarm value to generate event. -* ``autoreload`` enabled/disabled autorealod. -timerAlarmEnabled -***************** +This function will return ``frequency`` in Hz of the timer. + +timerAttachInterrupt +******************** -This function is used to get status of timer alarm. +This function is used to attach interrupt to timer. .. code-block:: arduino - bool timerAlarmEnabled(hw_timer_t *timer); + void timerAttachInterrupt(hw_timer_t * timer, void (*userFunc)(void)); * ``timer`` timer struct. +* ``userFunc`` funtion to be called when interrupt is triggered. -This function will return ``true`` if the timer alarm is enabled. -If ``false`` returned, the timer alarm is disabled. - -timerAlarmRead -************** +timerAttachInterruptArg +*********************** -This function is used to read alarm value of the timer. +This function is used to attach interrupt to timer using arguments. .. code-block:: arduino - uint64_t timerAlarmRead(hw_timer_t *timer); + void timerAttachInterruptArg(hw_timer_t * timer, void (*userFunc)(void*), void * arg); * ``timer`` timer struct. +* ``userFunc`` funtion to be called when interrupt is triggered. +* ``arg`` pointer to the interrupt arguments. -timerAlarmReadMicros +timerDetachInterrupt ******************** -This function is used to read alarm value of the timer in microseconds. +This function is used to detach interrupt from timer. .. code-block:: arduino - uint64_t timerAlarmReadMicros(hw_timer_t *timer); + void timerDetachInterrupt(hw_timer_t * timer); * ``timer`` timer struct. -This function will return ``alarm value`` of the timer in microseconds. - -timerAlarmReadSeconds -********************* +timerAlarm +********** -This function is used to read alarm value of the timer in seconds. +This function is used to configure alarm value and autoreload of the timer. Alarm is automaticaly enabled. .. code-block:: arduino - double timerAlarmReadSeconds(hw_timer_t *timer); + void timerAlarm(hw_timer_t * timer, uint64_t alarm_value, bool autoreload, uint64_t reload_count); * ``timer`` timer struct. - -This function will return ``alarm value`` of the timer in seconds. +* ``alarm_value`` alarm value to generate event. +* ``autoreload`` enabled/disabled autorealod. +* ``reload_count`` number of autoreloads (0 = unlimited). Has no effect if autorealod is disabled. Example Applications ********************