Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Jan Kasprzak
tinyboard
Commits
0c777e2b
Commit
0c777e2b
authored
May 10, 2013
by
Jan Kasprzak
Browse files
WIP: on-demand sleep modes
This does not compile yet, to be fixed.
parent
fbbdcc41
Changes
2
Hide whitespace changes
Inline
Side-by-side
projects/step-up/lights.h
View file @
0c777e2b
...
...
@@ -21,11 +21,13 @@ void inline log_word(uint16_t word) { }
/* adc.c */
#define PWMLED_ADC_SHIFT 1
/* 1<<1 measurements per single callback */
extern
volatile
unsigned
char
need_battery_adc
;
extern
volatile
unsigned
char
adc_running
;
void
init_adc
();
void
susp_adc
();
/* pwm.c */
#define PWM_MAX 0xFF
extern
volatile
unsigned
char
pwm_running
;
void
init_pwm
();
void
susp_pwm
();
void
pwm_off
();
...
...
projects/step-up/main.c
View file @
0c777e2b
...
...
@@ -71,7 +71,18 @@ int main(void)
sei
();
#if 1
while
(
1
)
{
sleep_mode
();
cli
();
if
(
pwm_running
)
{
set_sleep_mode
(
SLEEP_MODE_IDLE
);
}
else
if
(
adc_running
)
{
set_sleep_mode
(
SLEEP_MODE_ADC
);
}
else
{
set_sleep_mode
(
SLEEP_MODE_PWR_DOWN
);
}
// keep BOD active, no sleep_bod_disable();
sei
();
sleep_cpu
();
sleep_disable
();
}
#endif
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment