mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Move timers names to pointers in main file
This commit is contained in:
parent
a3a13967ec
commit
c3fd15025e
46
lib/README
46
lib/README
|
@ -1,46 +0,0 @@
|
|||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
|
@ -8,14 +8,23 @@
|
|||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:samd21]
|
||||
platform = atmelsam
|
||||
board = sparkfun_samd21_dev_usb
|
||||
framework = arduino
|
||||
[platformio]
|
||||
default_envs = mega2560
|
||||
|
||||
[env]
|
||||
lib_deps =
|
||||
https://github.com/davidcutting42/CommandStation.git#master
|
||||
https://github.com/davidcutting42/ArduinoTimers.git#master
|
||||
SparkFun External EEPROM Arduino Library
|
||||
DIO2
|
||||
|
||||
[env:samd21]
|
||||
platform = atmelsam
|
||||
board = sparkfun_samd21_dev_usb
|
||||
framework = arduino
|
||||
upload_protocol = atmel-ice
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags = -D ATSAMD21G
|
||||
|
||||
[env:mega2560]
|
||||
|
@ -23,7 +32,5 @@ platform = atmelavr
|
|||
board = megaatmega2560
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
https://github.com/davidcutting42/CommandStation.git#master
|
||||
https://github.com/davidcutting42/ArduinoTimers.git#master
|
||||
SparkFun External EEPROM Arduino Library
|
||||
${env.lib_deps}
|
||||
build_flags = -D ATMEGA2560
|
19
src/main.cpp
19
src/main.cpp
|
@ -1,5 +1,6 @@
|
|||
#include <Arduino.h>
|
||||
#include <CommandStation.h>
|
||||
#include <ArduinoTimers.h>
|
||||
|
||||
DCC* mainTrack = DCC::Create_WSM_SAMCommandStation_Main(50);
|
||||
DCC* progTrack = DCC::Create_WSM_SAMCommandStation_Prog(2);
|
||||
|
@ -14,17 +15,17 @@ void prog_IrqHandler() {
|
|||
|
||||
void setup() {
|
||||
#if defined (ATSAMD21G)
|
||||
CommManager::registerInterface(new SerialInterface(SerialUSB)); // Register SerialUSB as an interface
|
||||
CommManager::registerInterface(new USBInterface(SerialUSB)); // Register SerialUSB as an interface
|
||||
|
||||
TimerTCC0.initialize();
|
||||
TimerTCC0.setPeriod(58);
|
||||
TimerTCC0.attachInterrupt(main_IrqHandler);
|
||||
TimerTCC0.start();
|
||||
mainTrack->int_timer->initialize();
|
||||
mainTrack->int_timer->setPeriod(58);
|
||||
mainTrack->int_timer->attachInterrupt(main_IrqHandler);
|
||||
mainTrack->int_timer->start();
|
||||
|
||||
TimerTCC1.initialize();
|
||||
TimerTCC1.setPeriod(58);
|
||||
TimerTCC1.attachInterrupt(prog_IrqHandler);
|
||||
TimerTCC1.start();
|
||||
progTrack->int_timer->initialize();
|
||||
progTrack->int_timer->setPeriod(58);
|
||||
progTrack->int_timer->attachInterrupt(prog_IrqHandler);
|
||||
progTrack->int_timer->start();
|
||||
#elif defined(ATMEGA2560)
|
||||
CommManager::registerInterface(new SerialInterface(Serial)); // Register Serial (USB port on mega/uno) as an interface
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user