Skip to content

Commit

Permalink
update library.json, license, minor edits (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart authored Dec 24, 2021
1 parent 29f3d53 commit 9cc4884
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 41 deletions.
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) 2012-2021 Rob Tillaart
Copyright (c) 2012-2022 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
8 changes: 4 additions & 4 deletions PulsePattern.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: PulsePattern.cpp
// AUTHOR: Rob dot Tillaart at gmail dot com
// VERSION: 0.1.3
// VERSION: 0.1.4
// DATE: 2012-11-23
// PURPOSE: Arduino Library to generate repeating pulse patterns
//
Expand All @@ -10,15 +10,15 @@
// 0.0.2 2012-11-23 adapted a static PPO
// 0.0.3 2012-12-27 renamed to PulsePattern
// 0.0.4 2012-12-27 code stable(?) enough to publish
// 0.0.5 2012-12-27 code cleanup+comment
// 0.0.5 2012-12-27 code clean up + comment
// 0.0.6 2015-04-18 completed the state machine
// 0.0.7 2017-07-16 refactor & review
// 0.0.8 2018-12-13 refactor -> remove some warnings
// 0.1.0 2020-06-19 #pragma once; remove pre 1.0 support; refactor
// 0.1.1 2020-07-04 add continue function, fix spaces.
// 0.1.2 2020-08-07 speed up toggle pin + get/setFactor()
// 0.1.3 2021-01-06 arduino-ci (no unit test)

// 0.1.3 2021-01-06 Arduino-CI (no unit test)
// 0.1.4 2021-12-24 update library.json, license, minor edits

#include "PulsePattern.h"

Expand Down
26 changes: 13 additions & 13 deletions PulsePattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// FILE: PulsePattern.h
// AUTHOR: Rob dot Tillaart at gmail dot com
// VERSION: 0.1.3
// VERSION: 0.1.4
// DATE: 2012-11-23
// PURPOSE: Arduino Library to generate repeating pulse patterns
// sends a pulse pattern to a digital pin (continuously)
Expand All @@ -17,22 +17,22 @@
#include "Arduino.h"


#define PULSEPATTERN_LIB_VERSION (F("0.1.3"))
#define PULSEPATTERN_LIB_VERSION (F("0.1.4"))


#define NOTINIT -1
#define STOPPED 0
#define RUNNING 1
#define NOTINIT -1
#define STOPPED 0
#define RUNNING 1


#define NO_CLOCK 0 // timer off
#define PRESCALE_1 1
#define PRESCALE_8 2
#define PRESCALE_64 3
#define PRESCALE_256 4
#define PRESCALE_1024 5
#define EXT_T1_FALLING 6 // external clock
#define EXT_T2_RISING 7 // external clock
#define NO_CLOCK 0 // timer off
#define PRESCALE_1 1
#define PRESCALE_8 2
#define PRESCALE_64 3
#define PRESCALE_256 4
#define PRESCALE_1024 5
#define EXT_T1_FALLING 6 // external clock
#define EXT_T2_RISING 7 // external clock


class PulsePattern
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ or other non-AVR processors.
The library uses timer1 for the timing of the pulses.
Therefore the class is implemented with a static instance called PPO.
Still by calling **init()** one can change all parameters of the process.
One should note that calling init() forces the timer to stop.
One should note that calling **init()** forces the timer to stop.

The timer code is based upon the website of Nick Gammon which
holds quite a lot of good solid material (Thanks Nick!).
Expand Down
3 changes: 1 addition & 2 deletions examples/SOS_demo2/SOS_demo2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// FILE: SOS_demo2.ino
// AUTHOR: Rob Tillaart
// DATE: 2012-11-23
//
// PURPOSE: demo of the PulsePattern Library
// uses timer1

Expand All @@ -13,7 +12,7 @@
// a pattern consists of durations of LOW and HIGH periods
// so the first line of the SOSpattern is
// 500 units LOW, 500 units HIGH etc
// for a dutycycle of 50% LOW and HIGH should have equal periods
// for a duty cycle of 50% LOW and HIGH should have equal periods
// NOTE max period = 4095.
// min period = about 12
uint16_t SOSpattern[] =
Expand Down
1 change: 0 additions & 1 deletion examples/pattern_recorder/pattern_recorder.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: pattern_recorder.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: records and writes a pattern to serial
// DATE: 2020-07-25

Expand Down
13 changes: 6 additions & 7 deletions examples/pulse_measure/pulse_measure.ino
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
//
// FILE: pulse_measure.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: measure pulselength
// DATE: 2020-08-07

//
// TEST
// - generate with one Arduino a pulse of 1000 ms
// - measure it with this sketch to determine the correction percentage
// generate with one Arduino a pulse of 1000 ms
// measure it with this sketch to determine the correction percentage


#include "Arduino.h"

// measure pin = A5 on UNO
uint8_t pin = 19;
uint8_t pin = 19;


// record pulses in units of 10 milliseconds
// record pulses in units of 10 milliseconds
// an a minimum duration of 20 miiliseconds.
uint16_t minDuration = 20;
uint16_t units = 10;


// to calc the average
uint32_t count = 0;
uint32_t count = 0;
uint32_t sum = 0;


Expand Down
2 changes: 0 additions & 2 deletions examples/pulse_sender/pulse_sender.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
// FILE: pulse_sender.ino
// AUTHOR: Rob Tillaart
// DATE: 2020-08-08
//
// PURPOSE: for calibrating the pulse length
// uses timer1
//

// This sketch sends a test pattern of 1000 ms LOW and 1000 ms HIGH ==> Duty Cycle = 50%
// From measuring the duration of the pulses one can derive the correction factor to adjust the timing.
//
Expand Down
2 changes: 0 additions & 2 deletions examples/random_pattern/random_pattern.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
// FILE: random_pattern.ino
// AUTHOR: Rob Tillaart
// DATE: 2020-07-04
//
// PURPOSE: demo of the PulsePattern Library
// uses timer1
//


#include "PulsePattern.h"
Expand Down
2 changes: 0 additions & 2 deletions examples/siren_pattern/siren_pattern.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
// FILE: siren_pattern.ino
// AUTHOR: Rob Tillaart
// DATE: 2012-11-23
//
// PURPOSE: demo of the PulsePattern Library
// uses timer1
//


#include "PulsePattern.h"
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/PulsePattern.git"
},
"version": "0.1.3",
"version": "0.1.4",
"license": "MIT",
"frameworks": "arduino",
"platforms": "avr",
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=PulsePattern
version=0.1.3
version=0.1.4
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Library to generate repeating pulse patterns. (AVR only)
Expand Down
24 changes: 20 additions & 4 deletions test/unit_test_001.cpp_to_avr_specific
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,35 @@ uint8_t startLevel = LOW;

unittest_setup()
{
fprintf(stderr, "PULSEPATTERN_LIB_VERSION: %s\n", (char *) PULSEPATTERN_LIB_VERSION);
}

unittest_teardown()
{
}


unittest(test_constructor)
unittest(test_constants)
{
fprintf(stderr, "VERSION: %s\n", PULSEPATTERN_LIB_VERSION);
fprintf(stderr, "status\n");
assertEqual(NOTINIT, -1);
assertEqual(STOPPED, 0);
assertEqual(RUNNING, 1);

fprintf(stderr, "\nprescaler\n");
assertEqual(NO_CLOCK , 0);
assertEqual(PRESCALE_1 , 1);
assertEqual(PRESCALE_8 , 2);
assertEqual(PRESCALE_64 , 3);
assertEqual(PRESCALE_256 , 4);
assertEqual(PRESCALE_1024 , 5);
assertEqual(EXT_T1_FALLING, 6);
assertEqual(EXT_T2_RISING , 7);
}


unittest(test_constructor)
{
PPGenerator.init(13, pattern, patternSize, startLevel, PRESCALE_1024);

assertFalse(PPGenerator.isRunning());
Expand All @@ -79,8 +97,6 @@ unittest(test_constructor)

unittest(test_setFactor)
{
fprintf(stderr, "VERSION: %s\n", PULSEPATTERN_LIB_VERSION);

PPGenerator.init(13, pattern, patternSize, startLevel, PRESCALE_1024);

PPGenerator.setFactor(42.42);
Expand Down

0 comments on commit 9cc4884

Please sign in to comment.