Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/arduino-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1
- uses: actions/checkout@v6
- uses: arduino/arduino-lint-action@v2
with:
library-manager: update
# compliance: strict
compliance: strict
3 changes: 1 addition & 2 deletions .github/workflows/arduino_test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ jobs:
runTest:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/jsoncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ on:
paths:
- '**.json'
pull_request:
paths:
- '**.json'

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: json-syntax-check
uses: limitusus/json-syntax-check@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2015-2024 Rob Tillaart
Copyright (c) 2015-2026 Rob Tillaart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ It is advised to reset **t** after a number (e.g. 100) full periods

Needs further investigations.


### Related

- https://github.com/RobTillaart/AD9833 hardware waveform generator.
Expand Down Expand Up @@ -209,6 +210,7 @@ The rising and falling edges stay same.
- **float heartBeat(float t)** The duty cycle determines the part of the period
that the signal ~zero.


### No duty cycle

The other functions need to be investigated what duty cycle means.
Expand All @@ -224,6 +226,7 @@ Think of it as the halve of the triangle wave.
- **float sinusRectified(float t)**
- **float freeWave(float t, int16_t arr, int16_t N)**


## Future

#### Must
Expand All @@ -240,6 +243,7 @@ Think of it as the halve of the triangle wave.
- stand-alone functions in separate .h
- clean up code


#### Could

- ASDR wave
Expand All @@ -254,6 +258,7 @@ Think of it as the halve of the triangle wave.
- improve performance sin() lookup table.
- add float variable for ```_perDC = _period * _dutyCycle```
- do we need **freq4** ? not since DC.
- check **FastTrig** library for faster sinus (interpolated lookup).
- heartBeat
- small noise/variation parameter on amplitude and frequency.
- reduce footprint ==> wrapper around freeWave()
Expand All @@ -266,15 +271,16 @@ Think of it as the halve of the triangle wave.
- create an example program to sample an arbitrary wave form
- output in the right format.
- slow sampling vs real time.

- functionGenerator as (derived?) class name

#### Examples

- Amplitude modulation ?
- heartbeat curve?
- example ESP32 version as separate task.
- example with DAC. 8 12 16 bit.
- example with potentiometers for 4 parameters
- Amplitude modulation ?
- heartbeat curve?
- example ESP32 version as separate task.
- example with DAC. 8 12 16 bit.
- example with potentiometers for 4 parameters


#### Wont

Expand Down
3 changes: 2 additions & 1 deletion examples/funcGenFreeWavePlotter/funcGenFreeWavePlotter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ int16_t arr_two_sin[101] =
void setup()
{
Serial.begin(115200);
// Serial.println();
// Serial.println(__FILE__);
// Serial.print("FUNCTIONGENERATOR_LIB_VERSION: ");
// Serial.println("FUNCTIONGENERATOR_LIB_VERSION: ");
// Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
// Serial.println();

Expand Down
4 changes: 4 additions & 0 deletions examples/functionGenerator/functionGenerator.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ char choice = '0';
void setup()
{
Serial.begin(500000);
Serial.println();
Serial.println(__FILE__);
Serial.println("FUNCTIONGENERATOR_LIB_VERSION: ");
Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
Serial.println();
Serial.println("Start ");

gen.setFrequency(4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ funcgen gen2;
void setup()
{
Serial.begin(115200);
// Serial.println();
// Serial.println(__FILE__);
// Serial.print("FUNCTIONGENERATOR_LIB_VERSION: ");
// Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
// Serial.println();
// Serial.println(__FILE__);
// Serial.println("FUNCTIONGENERATOR_LIB_VERSION: ");
// Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
// Serial.println();

gen1.setFrequency(13);
gen1.setAmplitude(50);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ int16_t arr_two_sin[101] =
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("FUNCTIONGENERATOR_LIB_VERSION: ");
Serial.println("FUNCTIONGENERATOR_LIB_VERSION: ");
Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
Serial.println();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ funcgen gen2;
void setup()
{
Serial.begin(115200);
// Serial.println();
// Serial.println(__FILE__);
// Serial.print("FUNCTIONGENERATOR_LIB_VERSION: ");
// Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
// Serial.println();

gen.setAmplitude(80);
gen.setFrequency(65.0 / 60.0); // HB = BPM/60.0
gen.setFrequency(65.0 / 60.0); // HB = BPM/60.0
gen.setDutyCycle(40);
gen2.setYShift(+20);

gen2.setAmplitude(80);
gen2.setFrequency(120.0 / 60.0); // HB = BPM/60.0
gen2.setFrequency(120.0 / 60.0); // HB = BPM/60.0
gen2.setDutyCycle(80);
gen2.setYShift(-80);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// depending on the platform, the range of "smooth" sinus is limited.
// other signals are less difficult so have a slightly larger range.
// see readme.md for mac frequency table.
//
// uses an MCP4725 as output device


#include "functionGenerator.h"
Expand Down Expand Up @@ -37,6 +39,12 @@ uint32_t lastTime = 0;
void setup()
{
Serial.begin(230400);
Serial.println();
Serial.println(__FILE__);
Serial.println("FUNCTIONGENERATOR_LIB_VERSION: ");
Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
Serial.println();

gen.setAmplitude(1);
gen.setYShift(1);
gen.setFrequency(frequency);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ void setup()
Serial.begin(230400);
Serial.println();
Serial.println(__FILE__);
Serial.println("FUNCTIONGENERATOR_LIB_VERSION: ");
Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
Serial.println();

Wire.begin();
Expand Down
7 changes: 6 additions & 1 deletion examples/generateFreeWave/generateFreeWave.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
// URL: https://github.com/RobTillaart/FunctionGenerator


#include "functionGenerator.h"


void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.println();
Serial.println(__FILE__);
Serial.println("FUNCTIONGENERATOR_LIB_VERSION: ");
Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
Serial.println();

Serial.println("int16_t arr[101] =\n{");
Expand Down
3 changes: 2 additions & 1 deletion functionGenerator.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//
// FILE: functionGenerator.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.3.0
// VERSION: 0.3.1
// DATE: 2015-01-01
// PURPOSE: wave form generating functions (use with care)
// URL: https://github.com/RobTillaart/FunctionGenerator

Expand Down
5 changes: 3 additions & 2 deletions functionGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
//
// FILE: functionGenerator.h
// AUTHOR: Rob Tillaart
// VERSION: 0.3.0
// VERSION: 0.3.1
// DATE: 2015-01-01
// PURPOSE: wave form generating functions (use with care)
// URL: https://github.com/RobTillaart/FunctionGenerator


#include "Arduino.h"

#define FUNCTIONGENERATOR_LIB_VERSION (F("0.3.0"))
#define FUNCTIONGENERATOR_LIB_VERSION (F("0.3.1"))


class funcgen
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/FunctionGenerator"
},
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"frameworks": "*",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=FunctionGenerator
version=0.3.0
version=0.3.1
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library to generate wave forms (nummeric) for a DAC
Expand Down