Skip to content

Commit

Permalink
Direct sampling with timer working.
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Jan 10, 2023
1 parent 13fdeb1 commit 549f83a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app_subghz.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void protoview_timer_isr(void *ctx) {
if (app->txrx->last_g0_value != level) {
uint32_t now = DWT->CYCCNT;
uint32_t dur = now - app->txrx->last_g0_change_time;
dur /= furi_hal_cortex_instructions_per_microsecond();
if (dur > 15000) dur = 15000;
raw_samples_add(RawSamples, app->txrx->last_g0_value, dur);
app->txrx->last_g0_value = level;
Expand All @@ -194,7 +195,7 @@ void raw_sampling_worker_start(ProtoViewApp *app) {
LL_TIM_InitTypeDef tim_init = {
.Prescaler = 63,
.CounterMode = LL_TIM_COUNTERMODE_UP,
.Autoreload = 10,
.Autoreload = 5, /* Sample every 5 us */
};

LL_TIM_Init(TIM2, &tim_init);
Expand Down
1 change: 1 addition & 0 deletions signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ uint32_t search_coherent_signal(RawSamplesBuffer *s, uint32_t idx) {
bool level;
uint32_t dur;
raw_samples_get(s, j, &level, &dur);

if (dur < minlen || dur > maxlen) break; /* return. */

/* Let's see if it matches a class we already have or if we
Expand Down

0 comments on commit 549f83a

Please sign in to comment.