1 local cmds
= require('commands')
2 local getopt
= require('getopt')
3 local bin
= require('bin')
4 local utils
= require('utils')
6 local format=string.format
10 1. script run test_t55x7_ask
13 usage
= "script run test_t55x7_ask"
15 This script will program a T55x7 TAG with the configuration: block 0x00 data 0x000100
16 The outlined procedure is as following:
24 "lf t55xx write 0 00008040"
29 change the configuretion block 0 with:
40 testsuit for the ASK/MANCHESTER demod
46 local TIMEOUT
= 2000 -- Shouldn't take longer than 2 seconds
47 local DEBUG
= true -- the debug flag
49 --BLOCK 0 = 00008040 ASK / MAN
51 local config2
= '8040'
53 local procedurecmds
= {
55 [2] = 'lf t55xx detect',
56 [3] = 'lf t55xx info',
59 -- A debug printout-function
65 if type(args
) == "table" then
76 -- This is only meant to be used when errors occur
84 print("Example usage")
90 print( string.rep('--',20) )
91 print( string.rep('--',20) )
99 for y
= 0x0, 0x1d, 0x4 do
100 for _
= 1, #procedurecmds
do
101 local pcmd
= procedurecmds
[_
]
107 local config
= pcmd
:format(config1
, y
, config2
)
108 dbg(('lf t55xx write 0 %s'):format(config
))
109 config
= tonumber(config
,16)
111 local writecmd
= Command
:new
{cmd
= cmds
.CMD_T55XX_WRITE_BLOCK
,arg1
= config
, arg2
= block
, arg3
= "00", data
= "00"}
112 local err
= core
.SendCommand(writecmd
:getBytes())
113 if err
then return oops(err
) end
114 local response
= core
.WaitForResponseTimeout(cmds
.CMD_ACK
,TIMEOUT
)
121 core
.clearCommandBuffer()
123 print( string.rep('--',20) )
126 local function main(args
)
128 print( string.rep('--',20) )
129 print( string.rep('--',20) )
131 -- Arguments for the script
132 for o
, arg
in getopt
.getopt(args
, 'h') do
133 if o
== "h" then return help() end
136 core
.clearCommandBuffer()
138 print( string.rep('--',20) )