aboutsummaryrefslogtreecommitdiff
path: root/fw/adc.c
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2019-01-13 01:35:03 +0900
committerjaseg <git@jaseg.net>2019-01-13 01:35:03 +0900
commit7b5ca8102b10009b305a5b5c3e1978cb351858c5 (patch)
tree56a1036e2b249f7c17776c639088d123cb1c3072 /fw/adc.c
parent6006b360d1211283165d684ea9b09a5ea63510a7 (diff)
download8seg-7b5ca8102b10009b305a5b5c3e1978cb351858c5.tar.gz
8seg-7b5ca8102b10009b305a5b5c3e1978cb351858c5.tar.bz2
8seg-7b5ca8102b10009b305a5b5c3e1978cb351858c5.zip
Basic timer-based blanking working
Diffstat (limited to 'fw/adc.c')
-rw-r--r--fw/adc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fw/adc.c b/fw/adc.c
index d6e0dfb..3a86e05 100644
--- a/fw/adc.c
+++ b/fw/adc.c
@@ -140,7 +140,7 @@ static void adc_dma_init(int burstlen, bool enable_interrupt) {
if (enable_interrupt) {
/* triggered on transfer completion. We use this to process the ADC data */
NVIC_EnableIRQ(DMA1_Channel1_IRQn);
- NVIC_SetPriority(DMA1_Channel1_IRQn, 3<<5);
+ NVIC_SetPriority(DMA1_Channel1_IRQn, 2<<5);
} else {
NVIC_DisableIRQ(DMA1_Channel1_IRQn);
DMA1->IFCR |= DMA_IFCR_CGIF1;
@@ -208,12 +208,15 @@ void bit_detector(struct bit_detector_st *st, int a) {
new_bit = 0;
else if (diff > st->hysteresis_mv/2)
new_bit = 1;
+ else
+ blank();
st->len_ctr++;
if (new_bit != st->last_bit) {
st->last_bit = new_bit;
st->len_ctr = 0;
st->committed_len_ctr = st->base_interval_cycles>>1;
+ unblank(new_bit);
} else if (st->len_ctr >= st->committed_len_ctr) {
st->committed_len_ctr += st->base_interval_cycles;