Code Monkey home page Code Monkey logo

pyftd2xx's Introduction

pyftd2xx

pyftd2xx is a simple python wrapper around the official d2xx FTDI driver libraries. In order for this python module to work you need this driver to be installed and working.

Version 0.95 is the first release and compatible with Python 3. Next Versions will have more docstrings and more functions available. EEPROM functions are planned after release 1.0. Also Linux and MAC OS support is planned to be beyond 1.0 release.

Usage

This module is not really ment to be used on its own as it only provides bare functions. A documentation is available from FTDI here. Those C functions are wrapped in a pythonic way, so that one does not need to mess around with pointers amd references. The naming of function and parameters should match with the documentation, although that violates PEP 8.

Example

So instead of doing the 'C-Style', with declaring each variable in advance and let the function change them, one can just call it and get all the results as a Munch.

C way to do it:

FT_STATUS ftStatus;
FT_HANDLE ftHandleTemp;
DWORD numDevs;
DWORD Flags;
DWORD ID;
DWORD Type;
DWORD LocId;
char SerialNumber[16];
char Description[64];

ftStatus = FT_GetDeviceInfoDetail(0, &Flags, &Type, &ID, &LocId, SerialNumber,
Description, &ftHandleTemp);

Python way to do it:

import pyftd2xx as ft

ft.createDeviceInfoList()
result = ft.getDeviceInfoDetail(Index=0)
print(result)   #{'Flags': ['FLAGS_OPENED', 'FLAGS_HISPEED'], 'Type': 'FT_DEVICE_2232H', 'ID': 67330064, 'LocId': 401, 'SerialNumber': 'A', 'Description': 'Dual RS232-HS A', 'Handle': c_void_p(None)})

Credits

This is a heavily changed fork from Satya Mishra which probably is more stable than mine. So make sure to give some credit.

pyftd2xx's People

Contributors

abudden avatar abuzarra avatar catskull avatar hmaarrfk avatar julians-uni avatar snmishra avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aung2phyowai

pyftd2xx's Issues

PEP 8 violation

The Naming of functions and variables follows the naming in the official documentation so that the violate PEP8. This is acceptable for the benefit this brings.
But there are still other problems like line length.

  • Fix line length

  • Check PEP 8 for other violations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.