-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc469cd
commit c1e37a5
Showing
5 changed files
with
50 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "state.h" | ||
#include "commutation_angle.h" | ||
|
||
void computeCommutationAngle() { | ||
|
||
} |
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 @@ | ||
void computeCommutationAngle(); |
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,23 @@ | ||
#include "modules_list.h" | ||
#include "commutation_angle.h" | ||
|
||
typedef void (* moduleExecuter)(void); | ||
moduleExecuter controlModules[MODULE_LIST_END]; | ||
unsigned modulesStatus[MODULE_LIST_END] = {MODULE_DISABLED}; | ||
|
||
controlModules[COMMUT_ANGLE_MODULE] = &computeCommutationAngle; | ||
|
||
void setModuleStatus(unsigned moduleId, unsigned status) { | ||
// TODO: add static assert moduleId < MODULE_ENABLED | ||
// and status == MODULE_ENABLED || status == MODULE_DISABLED | ||
|
||
modulesStatus[moduleId] = status; | ||
} | ||
|
||
void runEnabledModules() { | ||
for (unsigned moduleId = 0; moduleId < MODULE_LIST_END; ++moduleId) { | ||
if (modulesStatus[moduleId] == MODULE_ENABLED) { | ||
(*controlModules[moduleId])(); | ||
} | ||
} | ||
} |
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,12 @@ | ||
enum { | ||
COMMUT_ANGLE_MODULE = 0, | ||
MODULE_LIST_END = 1 | ||
}; | ||
|
||
enum { | ||
MODULE_DISABLED = 0, | ||
MODULE_ENABLED = 1 | ||
}; | ||
|
||
void setModuleStatus(unsigned moduleId, unsigned status); | ||
void runEnabledModules(); |
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