From 207fc33a4252560197931244b1e888d5cc3994c7 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 15 Dec 2016 15:50:12 +0100 Subject: [PATCH 1/1] ADD: a Noralsy detection, looking for preamble 0xBB0 --- common/lfdemod.c | 13 ++++++++++++- common/lfdemod.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/lfdemod.c b/common/lfdemod.c index 73149602..aa3586f6 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -708,7 +708,18 @@ int Visa2kDemod_AM(uint8_t *dest, size_t *size) { //return start position return (int) startIdx; } - +// by iceman +// find Noralsy preamble in already demoded data +int NoralsyDemod_AM(uint8_t *dest, size_t *size) { + if (*size < 96*2) return -1; //make sure buffer has data + size_t startIdx = 0; + uint8_t preamble[] = {1,0,1,1,1,0,1,1,0,0,0,0}; + uint8_t errChk = preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx); + if (errChk == 0) return -2; //preamble not found + if (*size != 96) return -3; //wrong demoded size + //return start position + return (int) startIdx; +} // find presco preamble 0x10D in already demoded data int PrescoDemod(uint8_t *dest, size_t *size) { if (*size < 128*2) return -1; //make sure buffer has data diff --git a/common/lfdemod.h b/common/lfdemod.h index b4ff453e..11634d00 100644 --- a/common/lfdemod.h +++ b/common/lfdemod.h @@ -59,4 +59,5 @@ int PrescoDemod(uint8_t *dest, size_t *size); int NedapDemod(uint8_t *dest, size_t *size); int JablotronDemod(uint8_t *dest, size_t *size); int Visa2kDemod_AM(uint8_t *dest, size_t *size); +int NoralsyDemod_AM(uint8_t *dest, size_t *size); #endif -- 2.39.2