Merge branch 'master' into portability

This commit is contained in:
hathach
2023-03-17 23:53:38 +07:00
1109 changed files with 57916 additions and 19747 deletions

View File

@@ -26,4 +26,4 @@ target_include_directories(${PROJECT} PUBLIC
# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${PROJECT})
family_configure_device_example(${PROJECT})

View File

@@ -1,4 +1,3 @@
include ../../../tools/top.mk
include ../../make.mk
INC += \

View File

@@ -1,4 +1,4 @@
/*
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach (tinyusb.org)

View File

@@ -23,11 +23,7 @@
*
*/
#ifdef __ICCARM__
#include <string.h>
#else
#include <strings.h>
#endif
#include <stdlib.h> /* atoi */
#include "tusb.h"
#include "bsp/board.h"
@@ -144,11 +140,14 @@ bool tud_usbtmc_msg_data_cb(void *data, size_t len, bool transfer_complete)
queryState = transfer_complete;
idnQuery = 0;
if(transfer_complete && (len >=4) && !strncasecmp("*idn?",data,4))
if ( transfer_complete && (len >= 4) &&
(!strncmp("*idn?", data, 4) || !strncmp("*IDN?", data, 4)) )
{
idnQuery = 1;
}
if(transfer_complete && !strncasecmp("delay ",data,5))
if ( transfer_complete &&
(!strncmp("delay ", data, 5) || !strncmp("DELAY ", data, 5)) )
{
queryState = 0;
int d = atoi((char*)data + 5);
@@ -243,6 +242,7 @@ void usbtmc_app_task_iter(void) {
break;
default:
TU_ASSERT(false,);
return;
}
}

View File

@@ -36,8 +36,8 @@ def test_trig():
time.sleep(0.3) # SRQ may have some delay
assert (inst.read_stb() & 0x40), "SRQ not set after 0.3 seconds"
assert (inst.read_stb() == 0)
def test_mav():
inst.write("delay 50")
inst.read_stb() # clear STB
@@ -45,15 +45,15 @@ def test_mav():
inst.write("123")
time.sleep(0.3)
assert (inst.read_stb() & 0x10), "MAV not set after 0.5 seconds"
rsp = inst.read()
assert(rsp == "123\r\n")
def test_srq():
assert (inst.read_stb() == 0)
inst.write("123")
#inst.enable_event(pyvisa.constants.VI_EVENT_SERVICE_REQ, pyvisa.constants.VI_QUEUE)
#waitrsp = inst.wait_on_event(pyvisa.constants.VI_EVENT_SERVICE_REQ, 5000)
#inst.discard_events(pyvisa.constants.VI_EVENT_SERVICE_REQ, pyvisa.constants.VI_QUEUE)
@@ -64,7 +64,7 @@ def test_srq():
assert (stb == 0x50),msg
assert (inst.read_stb() == 0x10), "SRQ set at second read!"
rsp = inst.read()
assert(rsp == "123\r\n")
@@ -110,7 +110,7 @@ def test_abort_in():
inst.timeout = 800
y = inst.read()
assert(y == "xxx\r\n")
def test_indicate():
# perform indicator pulse
usb_iface = inst.get_visa_attribute(pyvisa.constants.VI_ATTR_USB_INTFC_NUM)
@@ -120,8 +120,8 @@ def test_indicate():
assert(retv == b'\x01')
else:
assert((retv[1] == pyvisa.constants.StatusCode(0)) and (retv[0] == b'\x01')), f"indicator pulse failed: retv={retv}"
def test_multi_read():
old_chunk_size = inst.chunk_size
longstr = "0123456789abcdefghijklmnopqrstuvwxyz" * 10
@@ -133,7 +133,7 @@ def test_multi_read():
y = inst.read()
assert (x + "\r\n" == y)
#inst.chunk_size = old_chunk_size
def test_stall_ep0():
usb_iface = inst.get_visa_attribute(pyvisa.constants.VI_ATTR_USB_INTFC_NUM)
inst.read_stb()
@@ -143,7 +143,7 @@ def test_stall_ep0():
assert(False)
except pyvisa.VisaIOError:
pass
assert (inst.read_stb() == 0)
@@ -153,7 +153,7 @@ print(reslist)
if (len(reslist) == 0):
sys.exit()
inst = rm.open_resource(reslist[0]);
inst.timeout = 3000