Skip to content

Commit ffbf324

Browse files
dineshgit411LinjingZhang
authored andcommitted
docs: Updated tone documentation.
Signed-off-by: MDin <Dinesh.M-EE@infineon.com>
1 parent 9f6cbd4 commit ffbf324

1 file changed

Lines changed: 5 additions & 20 deletions

File tree

docs/arduino-deviations.rst

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,13 @@ must be Slave mode configuration and sets the I2C configuration differently.
6868
Tone
6969
++++
7070

71-
Number of Tone pins is determined by pins_arduino.h define NUM_TONE_PINS.
72-
This allows for use in other modules and for variations between boards as
73-
>100MHz boards can obviously handle more tone pins.
71+
The tone() function in XMC-for-Arduino core uses the PWM(pulse Width Modulation) peripheral to generate square wave signals at specific frequencies.
72+
Number of tone pins is determined by PWM -capable pins on XMC Device.
7473

75-
The default for XMC1xxx is 4 with a change XMC4xxxx should be 16
76-
77-
Tone has frequency range of maximum = 500 Hz minimum = 1 Hz
78-
79-
This is due to the fact that the tone frequency is software derived from
80-
the Systick handler, Systick has a time period of 1 ms. At maximum each
81-
handler event for Systick toggles a GPIO pin, so at minimum period of 1 ms
82-
the output is toggled, so TWO events produce one square wave cycle, therefore
83-
the maximum output frequency is 500Hz.
84-
85-
The minimum is due to the fact that tone function only accepts an unsigned
86-
integer (32 bit) for the frequency, so the minimum usable frequency is 1.
87-
88-
Standard Arduino boards use hardware timers (the few that are available) to
89-
generate tones and at least one timer can interfere with other functions.
90-
91-
However this does mean you can have more tone pins, just much lower frequency range.
74+
Do not call pinMode() on the pin prior to using the tone() function. The tone() function automatically configures the pin for output modes and sets it up internally.
75+
Calling pinMode() beforehand may result in unexpected behavior or conflicts with PWM peripheral.
9276

77+
Maximum duration of tone can be set upto 90 seconds.
9378

9479
Analog Functions
9580
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)