1 local cmds
= require('commands')
2 local getopt
= require('getopt')
3 local bin
= require('bin')
4 local utils
= require('utils')
7 1. script run test_t55x7_bi
10 usage
= "script run test_t55x7_bi"
12 This script will program a T55x7 TAG with the configuration: block 0x00 data 0x00010040
13 The outlined procedure is as following:
18 "lf t55xx write 0 00010040"
23 change the configuretion block 0 with:
34 testsuit for the BIPHASE demod
40 local TIMEOUT
= 2000 -- Shouldn't take longer than 2 seconds
41 local DEBUG
= true -- the debug flag
43 --BLOCK 0 = 00010040 BIPHASE
45 local config2
= '0040'
47 local procedurecmds
= {
49 [2] = 'lf t55xx detect',
50 [3] = 'lf t55xx info',
53 -- A debug printout-function
59 if type(args
) == "table" then
70 -- This is only meant to be used when errors occur
78 print("Example usage")
84 print( string.rep('--',20) )
85 print( string.rep('--',20) )
94 for _
= 1, #procedurecmds
do
95 local pcmd
= procedurecmds
[_
]
101 local config
= pcmd
:format(config1
, y
, config2
)
102 dbg(('lf t55xx write 0 %s'):format(config
))
104 config
= tonumber(config
,16)
105 local writecmd
= Command
:new
{cmd
= cmds
.CMD_T55XX_WRITE_BLOCK
,arg1
= config
, arg2
= block
, arg3
= "00", data
= "00"}
106 local err
= core
.SendCommand(writecmd
:getBytes())
107 if err
then return oops(err
) end
108 local response
= core
.WaitForResponseTimeout(cmds
.CMD_ACK
,TIMEOUT
)
114 core
.clearCommandBuffer()
116 print( string.rep('--',20) )
120 local function main(args
)
122 print( string.rep('--',20) )
123 print( string.rep('--',20) )
125 -- Arguments for the script
126 for o
, arg
in getopt
.getopt(args
, 'h') do
127 if o
== "h" then return help() end
130 core
.clearCommandBuffer()
132 print( string.rep('--',20) )