1 local cmds
= require('commands')
2 local getopt
= require('getopt')
3 local bin
= require('bin')
4 local utils
= require('utils')
5 local ansicolors
= require('ansicolors')
11 This script will program a T55x7 TAG with the configuration: block 0x00 data 0x000100
12 The outlined procedure is as following:
20 "lf t55xx write -b 0 -d 00007040"
25 change the configuretion block 0 with:
35 testsuit for the ASK/MANCHESTER demod
38 1. script run lf_t55xx_defaultfsk
41 script run lf_t55xx_defaultfsk [-h]
47 local DEBUG
= true -- the debug flag
50 --BLOCK 0 = 00008040 FSK
54 local procedurecmds
= {
56 [2] = 'lf t55xx detect',
57 [3] = 'lf t55xx info',
60 -- A debug printout-function
61 local function dbg(args
)
62 if not DEBUG
then return end
63 if type(args
) == 'table' then
74 -- This is only meant to be used when errors occur
75 local function oops(err
)
77 core
.clearCommandBuffer()
87 print(ansicolors
.cyan
..'Usage'..ansicolors
.reset
)
89 print(ansicolors
.cyan
..'Arguments'..ansicolors
.reset
)
91 print(ansicolors
.cyan
..'Example usage'..ansicolors
.reset
)
96 local function ExitMsg(msg
)
97 print( string.rep('--',20) )
98 print( string.rep('--',20) )
103 local function test(modulation
)
105 local password
= '00000000'
108 for y
= 0x0, 0x1d, 0x4 do
109 for _
= 1, #procedurecmds
do
110 local pcmd
= procedurecmds
[_
]
116 local config
= pcmd
:format(config1
, y
, modulation
, config2
)
117 dbg(('lf t55xx write -b 0 -d %s'):format(config
))
118 local data
= ('%s%s%s%s'):format(utils
.SwapEndiannessStr(config
, 32), password
, block
, flags
)
120 local wc
= Command
:newNG
{cmd
= cmds
.CMD_LF_T55XX_WRITEBL
, data
= data
}
121 local response
, err
= wc
:sendNG(false, TIMEOUT
)
122 if not response
then return oops(err
) end
128 core
.clearCommandBuffer()
130 print( string.rep('--',20) )
133 local function main(args
)
135 print( string.rep('--',20) )
136 print( string.rep('--',20) )
138 -- Arguments for the script
139 for o
, arg
in getopt
.getopt(args
, 'h') do
140 if o
== 'h' then return help() end
143 core
.clearCommandBuffer()
148 print( string.rep('--',20) )