Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jan Kasprzak
tinyboard
Commits
3079ccda
Commit
3079ccda
authored
May 01, 2013
by
Jan Kasprzak
Browse files
Power management - make every module enable power for its own HW.
parent
8ebf32f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
projects/step-up/adc.c
View file @
3079ccda
#include
<avr/io.h>
#include
<avr/interrupt.h>
#include
<avr/power.h>
#include
<avr/sleep.h>
#include
"lights.h"
...
...
@@ -132,6 +133,9 @@ void init_adc()
current_slow_adc
=
NUM_ADCS
;
current_adc
=
0
;
power_adc_enable
();
ACSR
|=
_BV
(
ACD
);
// but disable the analog comparator
ADCSRA
=
_BV
(
ADEN
)
// enable
|
_BV
(
ADPS1
)
|
_BV
(
ADPS0
)
// CLK/8 = 125 kHz
// | _BV(ADPS2) // CLK/16 = 62.5 kHz
...
...
projects/step-up/main.c
View file @
3079ccda
...
...
@@ -9,6 +9,8 @@
static
void
hw_setup
()
{
power_all_disable
();
wdt_enable
(
WDTO_1S
);
//init_battery();
...
...
@@ -67,9 +69,6 @@ int main(void)
{
init_log
();
power_usi_disable
();
// Once for lifetime
ACSR
|=
_BV
(
ACD
);
// disable analog comparator
log_set_state
(
3
);
hw_setup
();
...
...
projects/step-up/pwm.c
View file @
3079ccda
#include
<avr/io.h>
#include
<avr/interrupt.h>
#include
<avr/power.h>
#include
<util/delay.h>
#include
<util/atomic.h>
...
...
@@ -24,6 +25,8 @@ static void inline enable_pll()
void
init_pwm
()
{
power_timer1_enable
();
enable_pll
();
TCCR1
=
_BV
(
CTC1
)
|
_BV
(
CS10
);
// no clock prescaling
...
...
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