Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Rogallina On-Board Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Avionics
Software Development
Old Rockets
Rogallina On-Board Software
Commits
d3d05eb0
Commit
d3d05eb0
authored
6 years ago
by
Luca Erbetta
Browse files
Options
Downloads
Patches
Plain Diff
Initialize pins & formatted code
parent
a62ca8bf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/entrypoints/heli-entry.cpp
+24
-39
24 additions, 39 deletions
src/entrypoints/heli-entry.cpp
with
24 additions
and
39 deletions
src/entrypoints/heli-entry.cpp
+
24
−
39
View file @
d3d05eb0
...
...
@@ -23,6 +23,10 @@
#include
<Common.h>
#include
<stdexcept>
#include
<events/EventBroker.h>
#include
<scheduler/TaskScheduler.h>
#include
<drivers/HardwareTimer.h>
#include
"HeliTest/config.h"
#include
"ButtonHandler.h"
...
...
@@ -30,19 +34,13 @@
#include
"HeliTest/FlightModeManager/HeliFMM.h"
#include
"HeliTest/PinObserverWrapper.h"
#include
"HeliTest/ScreenManager.h"
#include
"HeliTest/config.h"
#include
"PinStatus.h"
#include
"SensorManager/SensorManager.h"
#include
"SharedThreadIDs.h"
#include
"SystemDiagnostics/SystemDiagnostics.h"
#include
"HeliTest/config.h"
#include
"hwmapping.h"
#include
"events/EventBroker.h"
#include
"scheduler/TaskScheduler.h"
#include
"drivers/HardwareTimer.h"
#include
"PinStatus.h"
using
std
::
runtime_error
;
using
namespace
miosix
;
...
...
@@ -54,8 +52,9 @@ using ButtonHandler_t = ButtonHandler<interfaces::buttons::user>;
ButtonHandler_t
*
btnHandler
;
TaskScheduler
*
scheduler
;
ScreenManager
*
screen
;
SensorManager
*
sensorManager
;
ScreenManager
*
screen
;
HeliFMM
*
fmm
;
PinObserverWrapper
*
pinObserver
;
Logger
&
logger
=
Logger
::
instance
();
...
...
@@ -67,22 +66,28 @@ void onButtonPressCallback(ButtonHandler_t::ButtonPress type);
void
initComponents
()
{
EventBroker
::
getInstance
();
scheduler
=
new
TaskScheduler
();
btnHandler
=
new
ButtonHandler_t
(
1
,
&
onButtonPressCallback
);
scheduler
=
new
TaskScheduler
();
fmm
=
HeliFMM
::
getInstance
();
sensorManager
=
new
SensorManager
(
scheduler
);
screen
=
new
ScreenManager
(
sensorManager
);
fmm
=
HeliFMM
::
getInstance
();
pinObserver
=
new
PinObserverWrapper
();
PWM
::
Timer
t
{
TIM4
,
&
(
RCC
->
APB1ENR
),
RCC_APB1ENR_TIM4EN
,
TimerUtils
::
getPrescalerInputFrequency
(
TimerUtils
::
InputClock
::
APB1
)};
pinObserver
=
new
PinObserverWrapper
();
}
void
initPins
()
{
// FastInterruptDisableLock d;
{
FastInterruptDisableLock
d
;
DETACHMENT_PIN
::
mode
(
DETACHMENT_PIN_MODE
);
CUTTER_ENA
::
mode
(
Mode
::
OUTPUT
);
CUTTER_IN
::
mode
(
Mode
::
ALTERNATE
);
CUTTER_IN
::
alternateFunction
(
2
);
//CUTTER_CSENSE::mode(Mode::INPUT);
}
red_led
::
mode
(
Mode
::
OUTPUT
);
green_led
::
mode
(
Mode
::
OUTPUT
);
...
...
@@ -137,26 +142,6 @@ int main()
}
}
/**
* @brief Called when the specified state change is the detected on a pin
*
* @param port
* @param num
*/
void
onPinDisconnectedCallback
(
unsigned
int
port
,
unsigned
int
num
)
{
TRACE
(
"Pin callback: port:%d num:%d
\n
"
,
port
,
num
);
if
(
port
==
pin1_port
&&
num
==
pin1_num
)
{
sEventBroker
->
post
({
EV_HELIPIN_DISCONNECTED
},
TOPIC_FSM
);
}
if
(
port
==
pin2_port
&&
num
==
pin2_num
)
{
sEventBroker
->
post
({
EV_PARACHUTEPIN_DISCONNECTED
},
TOPIC_FSM
);
}
}
void
onButtonPressCallback
(
ButtonHandler_t
::
ButtonPress
type
)
{
...
...
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