Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DIOT Monitoring Module
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Monitor
Incidents
Service Desk
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
Projects
DIOT Monitoring Module
Commits
1f8f7ec9
Commit
1f8f7ec9
authored
4 years ago
by
Christos Gentsos
Browse files
Options
Downloads
Patches
Plain Diff
PWM: slightly modify PWM duty cycle calculations
parent
ae44969f
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main_fw/src/main.c
+13
-9
13 additions, 9 deletions
main_fw/src/main.c
with
13 additions
and
9 deletions
main_fw/src/main.c
+
13
−
9
View file @
1f8f7ec9
...
...
@@ -27,15 +27,15 @@ uint16_t frpms_lin[3];
#define TOTAL_PWM_CLOCKS 255
u
int16_t
curr_pwm_duty1000_1
__xMR
=
10
;
u
int16_t
curr_pwm_duty1000_2
__xMR
=
10
;
u
int16_t
curr_pwm_duty1000_3
__xMR
=
10
;
int16_t
curr_pwm_duty1000_1
__xMR
=
10
;
int16_t
curr_pwm_duty1000_2
__xMR
=
10
;
int16_t
curr_pwm_duty1000_3
__xMR
=
10
;
#define FAN_RAMPUP 800
u
int16_t
goal_pwm_duty1000_1
__xMR
=
FAN_RAMPUP
;
u
int16_t
goal_pwm_duty1000_2
__xMR
=
FAN_RAMPUP
;
u
int16_t
goal_pwm_duty1000_3
__xMR
=
FAN_RAMPUP
;
int16_t
goal_pwm_duty1000_1
__xMR
=
FAN_RAMPUP
;
int16_t
goal_pwm_duty1000_2
__xMR
=
FAN_RAMPUP
;
int16_t
goal_pwm_duty1000_3
__xMR
=
FAN_RAMPUP
;
static
uint16_t
iter
__xMR
;
static
uint16_t
fan_ramp_up_count
__xMR
=
0
;
...
...
@@ -161,9 +161,13 @@ void __xMR update_pwm()
curr_pwm_duty1000_3
=
0
;
}
pwm_set_parameters
(
&
PWM_0
,
TOTAL_PWM_CLOCKS
,
TOTAL_PWM_CLOCKS
*
(
float
)(
curr_pwm_duty1000_1
/
1000
.
0
));
pwm_set_parameters
(
&
PWM_1
,
TOTAL_PWM_CLOCKS
,
TOTAL_PWM_CLOCKS
*
(
float
)(
curr_pwm_duty1000_2
/
1000
.
0
));
pwm_set_parameters
(
&
PWM_2
,
TOTAL_PWM_CLOCKS
,
TOTAL_PWM_CLOCKS
*
(
float
)(
curr_pwm_duty1000_3
/
1000
.
0
));
uint16_t
target_duty_1
=
(
TOTAL_PWM_CLOCKS
*
curr_pwm_duty1000_1
)
/
1000
;
uint16_t
target_duty_2
=
(
TOTAL_PWM_CLOCKS
*
curr_pwm_duty1000_2
)
/
1000
;
uint16_t
target_duty_3
=
(
TOTAL_PWM_CLOCKS
*
curr_pwm_duty1000_3
)
/
1000
;
pwm_set_parameters
(
&
PWM_0
,
TOTAL_PWM_CLOCKS
,
(
target_duty_1
<
255
)
?
(
target_duty_1
)
:
(
254
));
pwm_set_parameters
(
&
PWM_1
,
TOTAL_PWM_CLOCKS
,
(
target_duty_2
<
255
)
?
(
target_duty_2
)
:
(
254
));
pwm_set_parameters
(
&
PWM_2
,
TOTAL_PWM_CLOCKS
,
(
target_duty_3
<
255
)
?
(
target_duty_3
)
:
(
254
));
}
void
__xMR
adc_cb
(
const
struct
adc_async_descriptor
*
const
descr
,
const
uint8_t
channel
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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