mirror of
https://github.com/merbanan/rtl_433.git
synced 2026-04-24 19:47:01 -04:00
Merge pull request #107 from Lefinnois/cardin27M
Adding Cardin S466-TX2 garage door remote
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
DECL(intertechno) \
|
||||
DECL(newkaku) \
|
||||
DECL(alectov1) \
|
||||
DECL(cardin) \
|
||||
DECL(fineoffset_WH2)
|
||||
|
||||
#define BITBUF_COLS 34
|
||||
|
||||
@@ -31,6 +31,7 @@ add_executable(rtl_433
|
||||
devices/intertechno.c
|
||||
devices/alecto.c
|
||||
devices/newkaku.c
|
||||
devices/cardin.c
|
||||
devices/fineoffset.c)
|
||||
|
||||
target_link_libraries(rtl_433
|
||||
|
||||
@@ -17,6 +17,7 @@ rtl_433_SOURCES = rtl_433.c \
|
||||
devices/mebus.c \
|
||||
devices/prologue.c \
|
||||
devices/steffen.c \
|
||||
devices/cardin.c \
|
||||
devices/fineoffset.c
|
||||
|
||||
rtl_433_LDADD = $(LIBRTLSDR) $(LIBM)
|
||||
|
||||
126
src/devices/cardin.c
Normal file
126
src/devices/cardin.c
Normal file
@@ -0,0 +1,126 @@
|
||||
#include "rtl_433.h"
|
||||
|
||||
/*
|
||||
* Cardin S466-TX2 generic garage door remote control on 27.195 Mhz
|
||||
* Remember to set de freq right with -f 27195000
|
||||
* May be usefull for other Cardin product too
|
||||
*
|
||||
* Copyright (C) 2015 Denis Bodor
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) {
|
||||
int i, j, k;
|
||||
unsigned char dip[10] = {'-','-','-','-','-','-','-','-','-', '\0'};
|
||||
|
||||
fprintf(stderr, "------------------------------\n");
|
||||
fprintf(stderr, "protocol = Cardin S466\n");
|
||||
fprintf(stderr, "message = ");
|
||||
for (i=0 ; i<3 ; i++) {
|
||||
for (k = 7; k >= 0; k--) {
|
||||
if (bb[0][i] & 1 << k)
|
||||
fprintf(stderr, "1");
|
||||
else
|
||||
fprintf(stderr, "0");
|
||||
}
|
||||
fprintf(stderr, " ");
|
||||
}
|
||||
if(bb[0][2] == 0) {
|
||||
fprintf(stderr, "\npartial message - abording\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
|
||||
// Dip 1
|
||||
if(bb[0][0] & 8) {
|
||||
dip[0]='o';
|
||||
if(bb[0][1] & 8)
|
||||
dip[0]='+';
|
||||
}
|
||||
// Dip 2
|
||||
if(bb[0][0] & 16) {
|
||||
dip[1]='o';
|
||||
if(bb[0][1] & 16)
|
||||
dip[1]='+';
|
||||
}
|
||||
// Dip 3
|
||||
if(bb[0][0] & 32) {
|
||||
dip[2]='o';
|
||||
if(bb[0][1] & 32)
|
||||
dip[2]='+';
|
||||
}
|
||||
// Dip 4
|
||||
if(bb[0][0] & 64) {
|
||||
dip[3]='o';
|
||||
if(bb[0][1] & 64)
|
||||
dip[3]='+';
|
||||
}
|
||||
// Dip 5
|
||||
if(bb[0][0] & 128) {
|
||||
dip[4]='o';
|
||||
if(bb[0][1] & 128)
|
||||
dip[4]='+';
|
||||
}
|
||||
// Dip 6
|
||||
if(bb[0][2] & 128) {
|
||||
dip[5]='o';
|
||||
if(bb[0][2] & 64)
|
||||
dip[5]='+';
|
||||
}
|
||||
// Dip 7
|
||||
if(bb[0][0] & 1) {
|
||||
dip[6]='o';
|
||||
if(bb[0][1] & 1)
|
||||
dip[6]='+';
|
||||
}
|
||||
// Dip 8
|
||||
if(bb[0][0] & 2) {
|
||||
dip[7]='o';
|
||||
if(bb[0][1] & 2)
|
||||
dip[7]='+';
|
||||
}
|
||||
// Dip 9
|
||||
if(bb[0][0] & 4) {
|
||||
dip[8]='o';
|
||||
if(bb[0][1] & 4)
|
||||
dip[8]='+';
|
||||
}
|
||||
|
||||
fprintf(stderr, " 123456789\n");
|
||||
fprintf(stderr, "dipswitch = %s\n\n",dip);
|
||||
|
||||
fprintf(stderr, " -->ON\n");
|
||||
fprintf(stderr, "right button = ");
|
||||
if((bb[0][2] & 3) == 3) {
|
||||
fprintf(stderr, "2 --o (this is right button)\n");
|
||||
fprintf(stderr, " 1 --o\n");
|
||||
}
|
||||
if((bb[0][2] & 9) == 9) {
|
||||
fprintf(stderr, "2 --o (this is right button)\n");
|
||||
fprintf(stderr, " 1 o--\n");
|
||||
}
|
||||
if((bb[0][2] & 12) == 12) {
|
||||
fprintf(stderr, "2 o-- (this is left button or two buttons on same channel)\n");
|
||||
fprintf(stderr, " 1 o--\n");
|
||||
}
|
||||
if((bb[0][2] & 6) == 6) {
|
||||
fprintf(stderr, "2 o-- (this is right button)\n");
|
||||
fprintf(stderr, " 1 --o\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
r_device cardin = {
|
||||
/* .id = */ 12,
|
||||
/* .name = */ "Cardin S466-TX2",
|
||||
/* .modulation = */ OOK_PWM_D,
|
||||
/* .short_limit = */ 303,
|
||||
/* .long_limit = */ 400,
|
||||
/* .reset_limit = */ 8000,
|
||||
/* .json_callback = */ &cardin_callback,
|
||||
/* .disabled = */ 0,
|
||||
/* .json_callback = */ //&debug_callback,
|
||||
};
|
||||
Reference in New Issue
Block a user