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
655d773a
Commit
655d773a
authored
May 01, 2013
by
Jan Kasprzak
Browse files
Make jiffies (timer) about 100 Hz.
parent
37d45fd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
projects/step-up/adc.c
View file @
655d773a
...
...
@@ -12,6 +12,7 @@
volatile
static
unsigned
char
current_adc
,
current_slow_adc
;
static
uint16_t
adc_sum
,
read_zero
,
drop_count
,
read_count
,
n_reads_log
;
volatile
uint16_t
jiffies
;
static
void
setup_mux
(
unsigned
char
n
)
{
...
...
@@ -146,10 +147,15 @@ static void adc1_gain20_adc(uint16_t adcsum)
static
void
inline
adc_based_timer
()
{
static
u
int16_t
pattern_
count
er
;
static
u
nsigned
char
count
;
if
(
++
pattern_counter
>
250
)
{
pattern_counter
=
0
;
if
(
++
count
<
40
)
// about 100 Hz jiffies
return
;
count
=
0
;
++
jiffies
;
if
((
jiffies
&
0x0007
)
==
0
)
{
patterns_next_tick
();
}
}
...
...
projects/step-up/lights.h
View file @
655d773a
...
...
@@ -24,6 +24,7 @@ void inline log_word(uint16_t word) { }
/* adc.c */
#define PWMLED_ADC_SHIFT 1
/* 1<<1 measurements per single callback */
extern
volatile
uint16_t
jiffies
;
void
init_adc
();
void
susp_adc
();
void
timer_start_slow_adcs
();
...
...
@@ -35,11 +36,6 @@ void susp_pwm();
void
pwm_off
();
void
pwm_set
(
uint8_t
stride
);
/* tmr.c */
extern
volatile
uint16_t
jiffies
;
void
init_tmr
();
void
susp_tmr
();
/* pwmled.c */
void
init_pwmled
();
void
pwmled_adc
(
uint16_t
adcval
);
...
...
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