int fd;
int ret = 0;
unsigned char difunc=0, dofunc=0;
if ( (fd = MT_Open(NULL) ) < 0) {
printf("Faild to open i2c port\n");
return 1;
}
ret = MT_GetDioFuncMode(fd, &difunc, &dofunc);
if (ret == 0) {
printf("Get DIO Func DI:%02X DO:%02X\n", difunc, dofunc);
}
else {
printf("MT_GetDioFuncMode Failled %d\n", ret);
}
MT_Close(fd);
import ctypes
import sys
import mtdll_arm
fd = mtdll_arm.MT_Open(None);
if fd < 0:
print("Faild to open i2c port");
sys.exit()
difunc = ctypes.c_ubyte();
dofunc = ctypes.c_ubyte();
ret = mtdll_arm.MT_GetDioFuncMode(fd, difunc, dofunc);
if ret == 0:
print("Get DIO Func DI:", '{:02x}'.format(difunc.value), " DO:", '{:02x}'.format(dofunc.value));
else:
print("MT_GetDioFuncMode Failled", '{:d}'.formart(ret));
mtdll_arm.MT_Close(fd);