Skip to content

Commit

Permalink
implemented INCLUDE_BUCKET_SNIFFING compiler flag
Browse files Browse the repository at this point in the history
When the bucket sniffing is not included 1159 bytes of flash storage can be saved.
The bucket sniffing is only needed for new RF devices.
  • Loading branch information
Portisch committed Feb 20, 2019
1 parent fbc0c22 commit dbb7e71
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 80 deletions.
191 changes: 123 additions & 68 deletions Keil 8051 v9.53 - Release/RF-Bridge-EFM8BB1.hex
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
:100390000558900005E0FFA3E090008BCFF0A3EF9D
:1003A000F0900007E0FFA3E090008DCFF0A3EFF006
:1003B000900003E0FFA3E090008FCFF0A3EFF07B6D
:1003C000017A00798B90195CE493FC740193FD90A1
:1003D000195EE493F52E1217028E2FF530901961F5
:1003E000E493F5311217028E32F533901964E493D9
:1003F000F5341217028E35F536901967E493F53708
:1003C000017A00798B9019E4E493FC740193FD9019
:1003D00019E6E493F52E1217028E2FF5309019E9E5
:1003E000E493F5311217028E32F5339019ECE49351
:1003F000F5341217028E35F5369019EFE493F53780
:10040000A3E493F538753900753A09120EBC020061
:10041000B09000EAE07063C2807FA00204D7900031
:10042000DEE060030200B0900003E0FCA3E0FD7F8B
Expand All @@ -88,38 +88,38 @@
:100560005E221215A6900079EFF022900079E0FF4C
:100570001215A6227E007FED12151022900086E053
:10058000547FFD12155B228F29E4F536EF25E02517
:10059000E0240AF8E6701EEF25E025E0240BF8764B
:10059000E02468F8E6701EEF25E025E02469F8768F
:1005A000087E007F707D007B017A00790312095577
:1005B000E490007AF0AB2CAA2DA92EC001120B6793
:1005C0002408F9E7540F120CA3120B86D001121461
:1005D000C1503D120B672408F9E7540FFF120CA31A
:1005C0002466F9E7540F120CA3120B86D001121403
:1005D000C1503D120B672466F9E7540FFF120CA3BC
:1005E000120C90300101B34031EF700A900077E5B2
:1005F0002AF0A3E52BF0120B67120CAF2401FFEFDA
:10060000FEEC54F04EFEEDFF120B67120C9A800ABE
:10061000120B672408F874F056F6AB2CAA2DA92EFD
:10061000120B672466F874F056F6AB2CAA2DA92E9F
:10062000C001120B67120CBB120BD1120CC7120BBC
:1006300086D0011214C15052120B67120CBB120B60
:10064000D1FF120CC75408FE120C92300101B340C6
:1006500043EF700A900088E52AF0A3E52BF0120B17
:1006600067120BC22401FFE433FEEFC4F8540FC835
:1006700068FFEEC454F048FEED540FFDEC4EFEED65
:100680004FFF120B67120C9A800A120B672409F8AD
:100680004FFF120B67120C9A800A120B672467F84F
:10069000740F56F6120B67120CAFFB700F120BCAD9
:1006A000700A120B4D240BF8E4F6C322120B6724D8
:1006B0000AF8E53514667003753601C3E5319536E1
:1006C0006B7020D290120B672408F874F056F67401
:1006D0000F0856120B66240AF806120B67240BF853
:1006A000700A120B4D2469F8E4F6C322120B67247A
:1006B00068F8E53514667003753601C3E531953683
:1006C0006B7020D290120B672466F874F056F674A3
:1006D0000F0856120B662468F806120B672469F897
:1006E00016804C120B67120BC2FFC3E53495366FB0
:1006F000703DD290120B672408F8EC54F0FEED54D4
:100700000FA60608120B66240AF806120B67240BC4
:10071000F816120B67120BD8E0FF120B67240BF8C8
:1006F000703DD290120B672466F8EC54F0FEED5476
:100700000FA60608120B662468F806120B67246908
:10071000F816120B67120BD8E0FF120B672469F86A
:10072000E6FE7401A806088002C333D8FC4FF0121D
:100730000B67240BF8E67017120B67120BD8120C1C
:100740004CFF12182DEFF0120B67240BF8760812ED
:100750000B67240AF8E6C3953540311218E35005BB
:100730000B672469F8E67017120B67120BD8120CBE
:100740004CFF12182DEFF0120B672469F87608128F
:100750000B672468F8E6C3953540311218E350055D
:10076000E4900085F0120C4960181218F37D207C8B
:10077000037F017E0012176E120CD3A3E529F0440B
:1007800080F0120B4D240BF8E4F6D322C322BB01F8
:1007800080F0120B4D2469F8E4F6D322C322BB019A
:100790000689828A83F0225002F722BBFE01F322EF
:1007A000EF8DF0A4A8F0CF8CF0A428CE8DF0A42E6D
:1007B000FE22BC000BBE0029EF8DF084FFADF022BD
Expand Down Expand Up @@ -152,62 +152,62 @@
:100960000B89828A83F0A3DFFCDEFA2289F050072C
:10097000F709DFFCA9F022BBFEFCF309DFFCA9F0BC
:10098000228E268F27E4F528C3E5279464E5269474
:10099000005017E4F528E528120B92240BF8E4F632
:1009A0000528E528B403EFC2902290008AE0147075
:1009B00003020A6F046003020B4C7808E6C4540F6C
:10099000005017E4F528E528120B922469F8E4F6D4
:1009A0000528E528B40DEFC2902290008AE014706B
:1009B00003020A6F046003020B4C7866E6C4540F0E
:1009C000F97065D3E5279494E52694115003020B42
:1009D0004C300003020B4CE9120C32E6540FFC08B9
:1009E000E6FDEC4E18F6ED08F618120C29EC540F43
:1009F0004E18F6ED08F6900001E526F0A3E527F085
:100A0000AE26FF7C007D1F1207B290008BEEF0A394
:100A1000EFF07C007D031207A0A3EEF0A3EFF0A39C
:100A2000E526F0A3E527F0227808E6C4540F640217
:100A2000E526F0A3E527F0227866E6C4540F6402B9
:100A30006003020B4C120CEB752C01752D00752E0A
:100A40008B9019B393FE7401938E2FF5309019B5E6
:100A5000E493F531A3120BBB8E32F5339019B8E451
:100A600093F5349019BCE493F535E4FF020587E46F
:100A40008B901B6393FE7401938E2FF530901B6582
:100A5000E493F531A3120BBB8E32F533901B68E49F
:100A600093F534901B6CE493F535E4FF020587E4BD
:100A7000F528120BA8120D0CFFE528120C54F9EF03
:100A8000C399506EE528120C16F5828C832FF582DF
:100A9000E43583F583E493FF120C90300001B350EA
:100AA00003020B40E528C454F024ADF582E4341968
:100AA00003020B40E528C454F0245DF582E4341BB6
:100AB000120C20F5828C83EF540775F00212092383
:100AC000120C22FDAF27AE261214CBE528501925B3
:100AD000E025E02408F8120C29EC540F4EFEEDFF3F
:100AE000120BA8120C9A8058120B92240BF8E4F601
:100AD000E025E02466F8120C29EC540F4EFEEDFFE1
:100AE000120BA8120C9A8058120B922469F8E4F6A3
:100AF000804E120BA8120D0C697045120CEBE52804
:100B0000120BAFAA06752CFF8A2DF52EE528120CC4
:100B1000F6120BB98E2FF530E528120C63F531E58E
:100B200028120D01120BB98E32F533E528120C7222
:100B3000F534E528120C81F535AF28120587400CF5
:100B40000528E528C394035003020A7222C290E5E7
:100B50002925E025E02408F8E4F608F6E52925E053
:100B600025E0240AF8E4F6E52925E025E022F583CE
:100B40000528E528C3940D5003020A7222C290E5DD
:100B50002925E025E02466F8E4F608F6E52925E0F5
:100B600025E02468F8E4F6E52925E025E022F58370
:100B7000E493FF5408FE131313541F24FF9202AB97
:100B800029AA2AA92BEF540775F002A4F58285F053
:100B9000832225E025E02408F8E4F608F6E5282578
:100BA000E025E0240AF8E4F6E52825E025E022C463
:100BB00054F024ADF582E43419F583E493FE740116
:100BC00093222408F8E6FC08E6FDECC4F854F0C8CB
:100BD000EDC4540F48540F22240AF8E614131313DB
:100B9000832225E025E02466F8E4F608F6E528251A
:100BA000E025E02468F8E4F6E52825E025E022C405
:100BB00054F0245DF582E4341BF583E493FE740164
:100BC00093222466F8E6FC08E6FDECC4F854F0C86D
:100BD000EDC4540F48540F222468F8E6141313137D
:100BE000541F2403F582E43400F58322E529252BE4
:100BF000F582E43528F583E022A200E433C43333E0
:100C00003354804526FFE527900074CFF0A3EFF022
:100C1000E490007BF022C454F024B0F582E434194F
:100C1000E490007BF022C454F02460F582E4341B9D
:100C2000F583E493FC74019322E6FC08E6FDECC432
:100C3000540F2401FFEFC454F0FE22E52E25E024DA
:100C40008BF582E43400F58322900085E0FF90006C
:100C50007AE06F22C454F024B2F582E43419F583AB
:100C6000E49322C454F024B5F582E43419F583E406
:100C70009322C454F024B8F582E43419F583E49344
:100C800022C454F024BCF582E43419F583E49322A1
:100C90005408131313541F24FF222408F8A606082F
:100C50007AE06F22C454F02462F582E4341BF583F9
:100C6000E49322C454F02465F582E4341BF583E454
:100C70009322C454F02468F582E4341BF583E49392
:100C800022C454F0246CF582E4341BF583E49322EF
:100C90005408131313541F24FF222466F8A60608D1
:100CA000A607222530F582E4352FF583E49322242C
:100CB00008F8E6FC08E6FDEC540F222408F9E7C426
:100CB00066F8E6FC08E6FDEC540F222466F9E7C46A
:100CC000F854F0C809E7222533F582E43532F5837C
:100CD000E4932290007AE0900085F053DAFE22251A
:100CE000E0247DF582E43400F58322A200920185A0
:100CF000262A85272B22C454F024B3F582E4341924
:100D000022C454F024B6F582E43419222408F8E60B
:100CF000262A85272B22C454F02463F582E4341B72
:100D000022C454F02466F582E4341B222466F8E6FB
:100D1000FEEEC4540F228E268F27C3E5279464E588
:100D20002694005003020EAA900087E024FE60255E
:100D3000147003020DB724036003020EAFC290AF1C
Expand Down Expand Up @@ -269,7 +269,7 @@
:1010B0008002D2059000DCE0B42002E4F0D007D03A
:1010C00006D005D004D003D002D001D000D0D0D0BB
:1010D00082D083D0F0D0E03212005A787FE4F6D884
:1010E000FD758165021122020076E493A3F8E49372
:1010E000FD758199021122020076E493A3F8E4933E
:1010F000A34003F68001F208DFF48029E493A3F80B
:101100005407240CC8C333C4540F4420C88340047C
:10111000F456800146F6DFE4800B0102040810203B
Expand Down Expand Up @@ -312,8 +312,8 @@
:10136000AFAA06F97BFFEF120C16FDEF120C54F535
:101370002EEF120CF6120BB98E2FF530EF120C6314
:10138000F531EF120D01120BB98E32F533EF120C5D
:1013900072F534EFC454F024B9F582E43419120B19
:1013A000B98E35F536EFC454F024BBF582E4341918
:1013900072F534EFC454F02469F582E4341B120B67
:1013A000B98E35F536EFC454F0246BF582E4341B66
:1013B000F583E493F537EF120C81F53885273985ED
:1013C000283A020EBC900076E0FDC4540F2401FBC5
:1013D000E433FAED540FF96B7001EA603DE97010E7
Expand Down Expand Up @@ -342,11 +342,11 @@
:10154000F0EA54F0FF900076E0044FF0540FC3949B
:10155000044004E054F0F08BDAD322AE05AD07E48A
:10156000FCFB7FAA121811AF05121811EEC454F03B
:101570002410F582E4341AF583E493FFECC39F5002
:1015700024E8F582E4341CF583E493FFECC39F5028
:101580000774082CFC0B80F4EB04FF12180CE4FC2D
:10159000ECC39B500974032C1217190C80F27F5571
:1015A0001218110219258F26900079E0F5277E0088
:1015B0007F0C7D007B007A0079081209557F0B12A1
:1015B0007F347D007B007A0079661209557F0B121B
:1015C000192E43DA011200707D0A7C007F017E0033
:1015D00012179712001DE4900087F0900086F0909B
:1015E0000099E526F0900079F0AF2722AE07E4FDE0
Expand Down Expand Up @@ -403,20 +403,75 @@
:10191000E69075A8B022E4F5A9224398102230057C
:10192000FD22C2DE22D299228F9922AF99228F8C7A
:101930002222222222015E041A2A620802080109D8
:101940000001C20384286E02080009010800D201C8
:10195000A41D88020800090108193503193B021962
:101960003D02193F020000001819410319470219EE
:101970004902194B0200000018194D0319530219AE
:1019800055021957020000000C015E041A2A620871
:10199000020801090001C20384286E02080009013F
:1019A0000800D201A41D8802080009010819890352
:1019B000198F02199102199302000000181995035A
:1019C000199B02199D02199F020000001819A1031A
:1019D00019A70219A90219AB020000000C015E044C
:1019E0001A2A6208020801090001C20384286E0253
:1019F000080009010800D201A41D8802080009019D
:101A00000819DD0319E30219E50219E702000000D5
:101A10001819E90319EF0219F10219F30200000085
:101A20001819F50319FB0219FD0219FF0200000045
:011A30000CA9
:1019400000017202E412C005DC20D00A030801097C
:101950000004017C044C0BB823280A030801090089
:1019600001F403E805DC733C030A0108010190045B
:10197000B00BB81C520A030801090001C2038428F5
:101980006E02080009010800D201A41D88020800A7
:1019900009010800C8017C1B260208000901080192
:1019A0005E028A32C8020800090108015E02BC3DDD
:1019B00022020800090108028A1E82071C0F8C08F7
:1019C0000108020803016802D012C005DC0A0308FE
:1019D000010900024E05DC01AE348A0A0308010940
:1019E00000193503193B02193D02193F020000009E
:1019F00018194105194B02194D02194F02195101CD
:101A000028195204195A02195C02195E02000000DA
:101A100018196004196801196902196B02000000A5
:101A200047196D041975021977021979020000002F
:101A300018197B031981021983021985020000001D
:101A400018198703198D02198F02199102000000DD
:101A50000C199303199902199B02199D02000000A9
:101A60000C199F0319A50219A70219A90200000069
:101A70000C19AB0319B10219B30219B50200000029
:101A80001219B70419BF0219C10219C302000000DC
:101A90002819C50419CD0219CF0219D1020000007E
:101AA0002819D30419DB0219DD0219DF0200000036
:101AB00018015E041A2A6208020801090001720274
:101AC000E412C005DC20D00A030801090004017CEF
:101AD000044C0BB823280A030801090001F403E8A9
:101AE00005DC733C030A010801019004B00BB81C2B
:101AF000520A030801090001C20384286E0208008B
:101B000009010800D201A41D88020800090108008B
:101B1000C8017C1B26020800090108015E028A3206
:101B2000C8020800090108015E02BC3D220208004B
:101B3000090108028A1E82071C0F8C08010802088E
:101B400003016802D012C005DC0A03080109000283
:101B50004E05DC01AE348A0A03080109001AB103FC
:101B60001AB7021AB9021ABB02000000181ABD0502
:101B70001AC7021AC9021ACB021ACD01281ACE04BA
:101B80001AD6021AD8021ADA02000000181ADC0467
:101B90001AE4011AE5021AE702000000471AE904F4
:101BA0001AF1021AF3021AF502000000181AF703DC
:101BB0001AFD021AFF021B0102000000181B03039A
:101BC0001B09021B0B021B0D020000000C1B0F0364
:101BD0001B15021B17021B19020000000C1B1B0324
:101BE0001B21021B23021B25020000000C1B2703E4
:101BF0001B2D021B2F021B3102000000121B33049D
:101C00001B3B021B3D021B3F02000000281B41043E
:101C10001B49021B4B021B4D02000000281B4F04F6
:101C20001B57021B59021B5B0200000018015E04D7
:101C30001A2A62080208010900017202E412C005B2
:101C4000DC20D00A030801090004017C044C0BB815
:101C500023280A030801090001F403E805DC733CAA
:101C6000030A010801019004B00BB81C520A0308D2
:101C700001090001C20384286E020800090108005E
:101C8000D201A41D8802080009010800C8017C1BBC
:101C900026020800090108015E028A32C802080013
:101CA000090108015E02BC3D220208000901080288
:101CB0008A1E82071C0F8C080108020803016802B3
:101CC000D012C005DC0A0308010900024E05DC0140
:101CD000AE348A0A03080109001C2D031C33021CC0
:101CE00035021C3702000000181C39051C43021C79
:101CF00045021C47021C4901281C4A041C52021CB4
:101D000054021C5602000000181C58041C60011CE0
:101D100061021C6302000000471C65041C6D021C6C
:101D20006F021C7102000000181C73031C79021C56
:101D30007B021C7D02000000181C7F031C85021C16
:101D400087021C89020000000C1C8B031C91021CE2
:101D500093021C95020000000C1C97031C9D021CA2
:101D60009F021CA1020000000C1CA3031CA9021C62
:101D7000AB021CAD02000000121CAF041CB7021C19
:101D8000B9021CBB02000000281CBD041CC5021CBB
:101D9000C7021CC902000000281CCB041CD3021C73
:091DA000D5021CD7020000001856
:00000001FF
22 changes: 13 additions & 9 deletions inc/RF_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@
*
* Enable/Disable the protocols you want to include when compiling
* The memory of the used EFM8BB1 is limited to 8KB
*
* Also a option is not including the 0xB1 bucket sniffing as this is only needed to define new protocols
*/

#define INCLUDE_BUCKET_SNIFFING 1

// typical protocols, disable here! Enable Remarks
#define EFM8BB1_SUPPORT_PT226X_PROTOCOL 1 // PT2260, EV1527,... original RF bridge protocol
#define EFM8BB1_SUPPORT_HT6P20X_PROTOCOL 1 // HT6P20X chips
#define EFM8BB1_SUPPORT_HT12_PROTOCOL 1 // HT12A/HT12E chips

// more protocols, enable here! Enable Remarks
#define EFM8BB1_SUPPORT_Rohrmotor24_PROTOCOL 0 // Rohrmotor24
#define EFM8BB1_SUPPORT_PAR56_PROTOCOL 0 // UNDERWATER PAR56 LED LAMP, 502266
#define EFM8BB1_SUPPORT_WS_1200_PROTOCOL 0 // Alecto WS-1200 Series Wireless Weather Station
#define EFM8BB1_SUPPORT_ALDI_4x_PROTOCOL 0 // ALDI Remote controlled wall sockets, 4x
#define EFM8BB1_SUPPORT_SP45_PROTOCOL 0 // Meteo SPxx - Weather station (PHU Metrex)
#define EFM8BB1_SUPPORT_DC90_PROTOCOL 0 // Dooya DC90 remote
#define EFM8BB1_SUPPORT_DG_HOSA_PROTOCOL 0 // Digoo DG-HOSA Smart 433MHz Wireless Household Carbon Monoxide Sensor
#define EFM8BB1_SUPPORT_HT12a_PROTOCOL 0 // HT12A/HT12E chips - Generic Doorbell
#define EFM8BB1_SUPPORT_HT12_Atag_PROTOCOL 0 // HT12A/HT12E chips - Atag Extractor - Plus/Minus/Lights/Timer
#define EFM8BB1_SUPPORT_Rohrmotor24_PROTOCOL 1 // Rohrmotor24
#define EFM8BB1_SUPPORT_PAR56_PROTOCOL 1 // UNDERWATER PAR56 LED LAMP, 502266
#define EFM8BB1_SUPPORT_WS_1200_PROTOCOL 1 // Alecto WS-1200 Series Wireless Weather Station
#define EFM8BB1_SUPPORT_ALDI_4x_PROTOCOL 1 // ALDI Remote controlled wall sockets, 4x
#define EFM8BB1_SUPPORT_SP45_PROTOCOL 1 // Meteo SPxx - Weather station (PHU Metrex)
#define EFM8BB1_SUPPORT_DC90_PROTOCOL 1 // Dooya DC90 remote
#define EFM8BB1_SUPPORT_DG_HOSA_PROTOCOL 1 // Digoo DG-HOSA Smart 433MHz Wireless Household Carbon Monoxide Sensor
#define EFM8BB1_SUPPORT_HT12a_PROTOCOL 1 // HT12A/HT12E chips - Generic Doorbell
#define EFM8BB1_SUPPORT_HT12_Atag_PROTOCOL 1 // HT12A/HT12E chips - Atag Extractor - Plus/Minus/Lights/Timer
13 changes: 12 additions & 1 deletion inc/RF_Handling.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#ifndef INC_RF_HANDLING_H_
#define INC_RF_HANDLING_H_

#include "RF_Config.h"

extern bool buffer_out(SI_VARIABLE_SEGMENT_POINTER(bucket, uint16_t, SI_SEG_XDATA));
extern void HandleRFBucket(uint16_t duration, bool high_low);
extern uint8_t PCA0_DoSniffing(uint8_t active_command);
Expand All @@ -29,15 +31,21 @@ extern void Bucket_Received(uint16_t duration, bool high_low);
// 112 byte == 896 bits, so a RF signal with maximum of 896 bits is possible
// for bucket transmission, this depends on the number of buckets.
// E.g. 4 buckets have a total overhead of 11, allowing 101 bits (high/low pairs)
#if INCLUDE_BUCKET_SNIFFING == 1
#define RF_DATA_BUFFERSIZE 112
#else
#define RF_DATA_BUFFERSIZE 32
#endif

typedef enum
{
RF_IDLE,
RF_IN_SYNC,
#if INCLUDE_BUCKET_SNIFFING == 1
RF_BUCKET_REPEAT,
RF_BUCKET_IN_SYNC,
RF_DECODE_BUCKET,
#endif
RF_FINISHED
} rf_state_t;

Expand Down Expand Up @@ -65,8 +73,11 @@ extern SI_SEGMENT_VARIABLE(BIT_LOW, uint16_t, SI_SEG_XDATA);

extern SI_SEGMENT_VARIABLE(actual_byte, uint8_t, SI_SEG_XDATA);

extern SI_SEGMENT_VARIABLE(bucket_sync, uint16_t, SI_SEG_XDATA);
extern SI_SEGMENT_VARIABLE(buckets[7], uint16_t, SI_SEG_XDATA);

#if INCLUDE_BUCKET_SNIFFING == 1
extern SI_SEGMENT_VARIABLE(bucket_sync, uint16_t, SI_SEG_XDATA);
extern SI_SEGMENT_VARIABLE(bucket_count, uint8_t, SI_SEG_XDATA);
#endif

#endif /* INC_RF_HANDLING_H_ */
6 changes: 5 additions & 1 deletion inc/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef INC_UART_H_
#define INC_UART_H_

#include "RF_Config.h"
//-----------------------------------------------------------------------------
// Global Constants
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -54,8 +55,10 @@ typedef enum
RF_CODE_LEARN_NEW = 0xA9,
RF_CODE_LEARN_KO_NEW = 0xAA,
RF_CODE_LEARN_OK_NEW = 0xAB,
#if INCLUDE_BUCKET_SNIFFING == 1
RF_CODE_RFOUT_BUCKET = 0xB0,
RF_CODE_SNIFFING_ON_BUCKET = 0xB1,
#endif
RF_DO_BEEP = 0xC0,
RF_ALTERNATIVE_FIRMWARE = 0xFF
} uart_command_t;
Expand All @@ -71,7 +74,8 @@ extern unsigned int uart_getc(void);
extern void uart_put_command(uint8_t command);
extern void uart_put_RF_Data_Advanced(uint8_t Command, uint8_t protocol_index);
extern void uart_put_RF_Data_Standard(uint8_t Command);
#if INCLUDE_BUCKET_SNIFFING == 1
extern void uart_put_RF_buckets(uint8_t Command);

#endif

#endif /* INC_UART_H_ */
Loading

0 comments on commit dbb7e71

Please sign in to comment.