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)
96 for y = 0x0, 0x1d, 0x4 do
97 for _ = 1, #procedurecmds do
98 local pcmd = procedurecmds[_]
104 local config = pcmd:format(config1, y, modulation, config2)
105 dbg(('lf t55xx write 0 %s'):format(config))
107 config = tonumber(config,16)
108 local writecmd = Command:new{cmd = cmds.CMD_T55XX_WRITE_BLOCK,arg1 = config, arg2 = block, arg3 = "00", data = "00"}
109 local err = core.SendCommand(writecmd:getBytes())
110 if err then return oops(err) end
111 local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT)
118 core.clearCommandBuffer()
120 print( string.rep('--',20) )
123 local function main(args)
125 print( string.rep('--',20) )
126 print( string.rep('--',20) )
128 -- Arguments for the script
129 for o, arg in getopt.getopt(args, 'h') do
130 if o == "h" then return help() end
133 core.clearCommandBuffer()
138 print( string.rep('--',20) )