Shop OBEX P1 Docs P2 Docs Learn Events
Easy way to divert printf output spin2cpp'd display driver? — Parallax Forums

Easy way to divert printf output spin2cpp'd display driver?

RaymanRayman Posts: 14,665
edited 2013-04-24 03:36 in Propeller 1
Maybe this has been asked before...
But, I'd like to try sending output to a display device instead of over a serial connection...

Perhaps I'm supposted to use fprintf and somehow invoke a driver?
Is there a simple example of doing this?

Comments

  • jazzedjazzed Posts: 11,803
    edited 2013-04-23 15:29
    Rayman wrote: »
    Maybe this has been asked before...
    But, I'd like to try sending output to a display device instead of over a serial connection...

    Perhaps I'm supposted to use fprintf and somehow invoke a driver?
    Is there a simple example of doing this?

    It's not exactly easy, but there is an example in the link below. Look at TvDriver.c
    https://code.google.com/p/propgcc/source/browse/#hg%2Fdemos%2Ftvkbfile
  • RaymanRayman Posts: 14,665
    edited 2013-04-23 17:44
    Thanks, I think I kinda see what you have going on there. The .cfg file support is nice but seems to add some complexity.
    Also, It appears that you've rigged it to use either fprintf or printf. If so, that might be nice too, but I'm guessing it's easier and maybe
    better to use fprintf and save printf for debugging...
  • jazzedjazzed Posts: 11,803
    edited 2013-04-23 18:54
    Rayman wrote: »
    Thanks, I think I kinda see what you have going on there. The .cfg file support is nice but seems to add some complexity.
    Also, It appears that you've rigged it to use either fprintf or printf. If so, that might be nice too, but I'm guessing it's easier and maybe
    better to use fprintf and save printf for debugging...

    The tvkbfile.c assigns the tv/kbd driver to stdio. TvDemo.c uses the serial port for debug and tv/kbd driver using fprintf and a file handle.

    The config file support makes it easy to just choose a platform without modifying code. It's easy if your board.cfg has the right lines in it. I find it much more difficult to modify code than just choose an appropriate board type. The .cfg choice is much simpler than the 100+ lines of code alternative I've seen in other methods. The file demo for example used to require a block for every board and a -D flag; now it comes automatically with the board type. Of course it is still possible to hard code things if that's what you like.
  • RaymanRayman Posts: 14,665
    edited 2013-04-24 03:36
    Ok, I didn't realize it was the same cfg file as the memory board file. That sounds nicer now...
Sign In or Register to comment.