Giter VIP home page Giter VIP logo

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
Instead of ftdi_sio kernel module , libftdi user space libary can be used to 
program 
FTDI chips.

Original comment by [email protected] on 21 Apr 2010 at 11:48

from omapterisk.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
Ftdi_sio module is not required.

Here is sample prog to use 
/* Sample program for Matrix Orital LK202 25USB using Libftdi user space library
Needs libftdi-devel package,compile as "gcc -lftdi lcd.c"
*/


#include <stdio.h>
#include <ftdi.h>
unsigned char ClearScreen[] = {254,88};
unsigned char lf[]={254,0x0a};
unsigned char cr[]={254,0x0d};

int main(void)
{
    int ret;
    struct ftdi_context ftdic;
    char buf[]="Hello World";
    if (ftdi_init(&ftdic) < 0)
    {
        fprintf(stderr, "ftdi_init failed\n");
        return EXIT_FAILURE;
    } 

    if ((ret = ftdi_usb_open(&ftdic, 0x1b3d, 0x0155)) < 0)
    {
        fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret, 
ftdi_get_error_string(&ftdic));
        return EXIT_FAILURE;
    }

    ftdi_set_baudrate(&ftdic,19200);
    ftdi_set_line_property( &ftdic,8,1,NONE);
    ftdi_write_data(&ftdic,ClearScreen,sizeof(ClearScreen));
    ftdi_write_data(&ftdic,cr,sizeof(cr));
    ftdi_write_data(&ftdic,lf,sizeof(lf));
    ftdi_write_data(&ftdic,buf,sizeof(buf)-1);

    if ((ret = ftdi_usb_close(&ftdic)) < 0)
    {
        fprintf(stderr, "unable to close ftdi device: %d (%s)\n", ret, 
ftdi_get_error_string(&ftdic));
        return EXIT_FAILURE;
    }

    ftdi_deinit(&ftdic);

    return EXIT_SUCCESS;
}

Original comment by [email protected] on 22 Apr 2010 at 6:49

  • Added labels: Milestone-Release1.0

from omapterisk.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024

Original comment by [email protected] on 2 Aug 2010 at 1:36

  • Changed state: Fixed

from omapterisk.

Related Issues (5)

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.