Sawtooth wave with offset#

float uz_wavegen_sawtooth_with_offset(float amplitude, float frequency_Hz, float offset)#

Returns one sample of a sawtooth wave with an configurable offset.

Parameters:
  • amplitude – Amplitude for the sawtooth wave

  • frequency_Hz – Frequency for the sawtooth wave in Hz. Only positive values are permitted

  • offset – Offset for the sawtooth wave

Returns:

Returns one sample for current system time

Example#

Listing 70 Example function call to sawtooth wave generator with offset#
1#include "uz_wavegen.h"
2int main(void) {
3   float amplitude = -5.0f;
4   float frequency_Hz = 10.0f;
5   float offset = 1.0f;
6   float output = uz_wavegen_sawtooth_with_offset(amplitude, frequency_Hz, offset);
7}

Description#

This function calculates a sawtooth with specified offset based on the global system time.

Figure made with TikZ

Fig. 271 sawtooth wave with offset