Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SUFST-Arduino-Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SUFST
SUFST-Arduino-Firmware
Commits
74b130df
Commit
74b130df
authored
5 years ago
by
nrs1g15
Browse files
Options
Downloads
Patches
Plain Diff
lap timer
parent
02453a24
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sufst-controller/lapTimer.cpp
+32
-0
32 additions, 0 deletions
sufst-controller/lapTimer.cpp
sufst-controller/lapTimer.h
+15
-0
15 additions, 0 deletions
sufst-controller/lapTimer.h
sufst-controller/sufst-controller.ino
+4
-3
4 additions, 3 deletions
sufst-controller/sufst-controller.ino
with
51 additions
and
3 deletions
sufst-controller/lapTimer.cpp
0 → 100644
+
32
−
0
View file @
74b130df
//
// Created by Sil on 01/08/2019.
//
#include
"lapTimer.h"
#include
"wireless.h"
void
lapTimerISR
()
{
static
uint8_t
lapTimerPayload
[
6
];
static
uint32_t
lastTriggeredMs
=
0
;
uint32_t
currentMs
=
millis
();
if
((
currentMs
-
lastTriggeredMs
)
>=
LAP_TIMER_DEBOUNCE_MS
)
{
lapTimerPayload
[
0
]
=
0xFF
;
memcpy
(
&
(
lapTimerPayload
[
1
]),
currentMs
,
4
);
lapTimerPayload
[
5
]
=
0xFF
;
wirelessWrite
(
lapTimerPayload
,
6
);
lastTriggeredMs
=
millis
();
}
}
void
lapTimerBegin
()
{
attachInterrupt
(
digitalPinToInterrupt
(
LAP_TIMER_INT_PIN
),
lapTimerISR
,
FALLING
);
}
This diff is collapsed.
Click to expand it.
sufst-controller/lapTimer.h
0 → 100644
+
15
−
0
View file @
74b130df
//
// Created by Sil on 01/08/2019.
//
#ifndef LAPTIMER_H
#define LAPTIMER_H
#include
"Arduino.h"
#define LAP_TIMER_INT_PIN 21
#define LAP_TIMER_DEBOUNCE_MS 1000
void
lapTimerBegin
();
#endif //LAPTIMER_H
This diff is collapsed.
Click to expand it.
sufst-controller/sufst-controller.ino
+
4
−
3
View file @
74b130df
...
...
@@ -2,7 +2,8 @@
#include
"ecuCan.h"
#include
"can.h"
#include
"dashController.h"
// #include "wireless.h"
#include
"wireless.h"
#include
"lapTimer.h"
void
setup
()
{
...
...
@@ -15,10 +16,9 @@ void setup()
// Serial.println("BEGIN");
dashBegin
();
sdBegin
();
canBegin
();
lapTimerBegin
();
}
void
loop
()
...
...
@@ -28,6 +28,7 @@ void loop()
/*
* ALL PROCESSES *MUST* BE NON BLOCKING
*/
canProcessRx
();
dashControllerProcess
();
sdProcess
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment