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_fsk
10 usage = "script run test_t55x7_fsk"
12 This script will program a T55x7 TAG with the configuration: block 0x00 data 0x000100
13 The outlined procedure is as following:
21 "lf t55xx write 0 00007040"
26 change the configuretion block 0 with:
37 testsuit for the ASK/MANCHESTER demod
43 local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
44 local DEBUG = true -- the debug flag
46 --BLOCK 0 = 00008040 FSK
50 local procedurecmds = {
52 [2] = 'lf t55xx detect',
53 [3] = 'lf t55xx info',
56 -- A debug printout-function
62 if type(args) == "table" then
73 -- This is only meant to be used when errors occur
81 print("Example usage")
87 print( string.rep('--',20) )
88 print( string.rep('--',20) )
93 function test(modulation)
95 for y = 0x0, 0x1d, 0x4 do
96 for _ = 1, #procedurecmds do
97 local pcmd = procedurecmds[_]
103 local config = pcmd:format(config1, y, modulation, config2)
104 dbg(('lf t55xx write 0 %s'):format(config))
106 config = tonumber(config,16)
107 local writecmd = Command:new{cmd = cmds.CMD_T55XX_WRITE_BLOCK, arg1 = config}
108 local err = core.SendCommand(writecmd:getBytes())
109 if err then return oops(err) end
110 local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT)
117 core.clearCommandBuffer()
119 print( string.rep('--',20) )
122 local function main(args)
124 print( string.rep('--',20) )
125 print( string.rep('--',20) )
127 -- Arguments for the script
128 for o, arg in getopt.getopt(args, 'h') do
129 if o == "h" then return help() end
132 core.clearCommandBuffer()
137 print( string.rep('--',20) )