This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.2.0 to fix
multiple-definitions
linker error
### Releases v1.2.0 1. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories 2. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project 3. Improve accuracy by using `double`, instead of `uint32_t` for `dutycycle`, `period` 4. Optimize library code by using `reference-passing` instead of `value-passing` 5. Update examples accordingly
- Loading branch information
1 parent
ccb1ac7
commit b7dcbd4
Showing
20 changed files
with
2,147 additions
and
1,927 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/**************************************************************************************************************************** | ||
multiFileProject.cpp | ||
For AVR-based boards (UNO, Nano, Mega, 32U4, 16U4, etc. ) | ||
Written by Khoi Hoang | ||
Built by Khoi Hoang https://github.com/khoih-prog/AVR_Slow_PWM | ||
Licensed under MIT license | ||
*****************************************************************************************************************************/ | ||
|
||
// To demo how to include files in multi-file Projects | ||
|
||
#include "multiFileProject.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/**************************************************************************************************************************** | ||
multiFileProject.h | ||
For AVR-based boards (UNO, Nano, Mega, 32U4, 16U4, etc. ) | ||
Written by Khoi Hoang | ||
Built by Khoi Hoang https://github.com/khoih-prog/AVR_Slow_PWM | ||
Licensed under MIT license | ||
*****************************************************************************************************************************/ | ||
|
||
// To demo how to include files in multi-file Projects | ||
|
||
#pragma once | ||
|
||
#define USING_MICROS_RESOLUTION true //false | ||
|
||
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error | ||
#include "AVR_Slow_PWM.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/**************************************************************************************************************************** | ||
multiFileProject.ino | ||
For AVR-based boards (UNO, Nano, Mega, 32U4, 16U4, etc. ) | ||
Written by Khoi Hoang | ||
Built by Khoi Hoang https://github.com/khoih-prog/AVR_Slow_PWM | ||
Licensed under MIT license | ||
*****************************************************************************************************************************/ | ||
|
||
// To demo how to include files in multi-file Projects | ||
|
||
#if ( defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || \ | ||
defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO) || defined(ARDUINO_AVR_MINI) || defined(ARDUINO_AVR_ETHERNET) || \ | ||
defined(ARDUINO_AVR_FIO) || defined(ARDUINO_AVR_BT) || defined(ARDUINO_AVR_LILYPAD) || defined(ARDUINO_AVR_PRO) || \ | ||
defined(ARDUINO_AVR_NG) || defined(ARDUINO_AVR_UNO_WIFI_DEV_ED) || defined(ARDUINO_AVR_DUEMILANOVE) || defined(ARDUINO_AVR_FEATHER328P) || \ | ||
defined(ARDUINO_AVR_METRO) || defined(ARDUINO_AVR_PROTRINKET5) || defined(ARDUINO_AVR_PROTRINKET3) || defined(ARDUINO_AVR_PROTRINKET5FTDI) || \ | ||
defined(ARDUINO_AVR_PROTRINKET3FTDI) ) | ||
#define USE_TIMER_1 true | ||
#warning Using Timer1 | ||
#else | ||
#define USE_TIMER_3 true | ||
#warning Using Timer3 | ||
#endif | ||
|
||
#define AVR_SLOW_PWM_VERSION_MIN_TARGET F("AVR_Slow_PWM v1.2.0") | ||
#define AVR_SLOW_PWM_VERSION_MIN 1002000 | ||
|
||
#include "multiFileProject.h" | ||
|
||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error | ||
#include "AVR_Slow_PWM.h" | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
while (!Serial); | ||
|
||
Serial.println("\nStart multiFileProject"); | ||
Serial.println(AVR_SLOW_PWM_VERSION); | ||
|
||
#if defined(AVR_SLOW_PWM_VERSION_MIN) | ||
if (AVR_SLOW_PWM_VERSION_INT < AVR_SLOW_PWM_VERSION_MIN) | ||
{ | ||
Serial.print("Warning. Must use this example on Version equal or later than : "); | ||
Serial.println(AVR_SLOW_PWM_VERSION_MIN_TARGET); | ||
} | ||
#endif | ||
} | ||
|
||
void loop() | ||
{ | ||
// put your main code here, to run repeatedly: | ||
} |
Oops, something went wrong.