Jump to content
43oh

Turning a Launchpad into a poor mans IOIO


Recommended Posts

I've been working on turning a Launchpad into a poor mans IOIO. The latest version of the IOIO adds support for connecting from the computer to the board using a bluetooth serial connection. This means if I copy the underlying protocol[or at least as much as I need] - I can then emulate the IOIO for my real goal[see below].

 

I'm just in the beginning phase right now, my initial goal is to get it working so I can use the IOIO protocol to turn on and off the 2 LED's on board. IE just cloning the Digital Output functionality and only on 2 pins.

 

I'm hoping to finish that this weekend. Right now I just have the initial skeleton of combining the TI example code for 9600 baud uart and some basic IOIO headers.

https://github.com/garyamort/IOIOExtension

 

Once I get the 2 pins working, the next step is to allow for access to all 10 available pins on the MSP430G2553 [there is 1 and a half ports available, but 2 pins have to be used form the serial connection].

 

This is where I figured I'd ask if there is a standard way of doing things as I'm re-learning C as I go along.

A command will consist of a few bytes of data:

The command byte, such as I beleive 6 and 7 for digital output. 6 to turn a pin into a digital output, 7 to change the value being sent out. Following the command is the "pin number" - where pin number is defined by where they come out on the board, not where they are on the launchpad.

 

For my purposes:

Pin 1: Port 1.0

Pin 2: Port 1.3

Pin 3: Port 1.4

Pin 4: Port 1.5

Pin 5: Port 1.6

Pin 6: Port 1.7

Pin 7: Port 1.0

Pin 8: Port 2.1

Pin 9: Port 2.2

Pin 10: Port 2.3

Pin 11: Port 2.4

 

For the simple case of:

Pins 1 and 5[1.0 and 1.6] I can use a simple switch/case to send the correct BIT to P1SEL

 

However, to expand it to all 10 pins, I would rather not have a humungous SWITCH/CASE. It would be better to have a mapping of pins to their appropriate bit, port address, and value. Something like:

 

PINDEF selectedPin = pinmap[1];

selectedPin->port |= selectedPin->digitalOutBit;

selectedPin->iovalue |= selectedPin->digitalOn;

 

While I understand easily how to do the digitalOutBit and digitalOn - they are just values. The question is how to I assign a variable[selectedPin->port] so that it can be used in the same manner as P1SEL ?

 

 

Thanks for any feedback.

 

Sidenote: my /goal/ is yet another oscilliscope. However, since my strongest skillset is website engineering[php/HTML/CSS/Javascript] - my preference is to make the scope as a Javascript application run from the web browser. I can hack enough Python to use the Python serial and websocket library to provide access to the com port from the web browser - so with that in place it makes it a lot faster for me to write IOIO apps which will also be usable with a Launchpad by using Javascript.

 

For added fun, I want to setup a PHP library so that I can have the launchpad display the number of users on a website via an LED bargraph and maybe have it play a sound when different "goals" are met.

 

 

NOTE: I found I had to hunt through the project settings in CCS to find and enable the "relaxed-ansi" option in order to get the "packed" structures to work.

Link to post
Share on other sites

Browsing around other projects, I noticed that the Ethernet Boosterpack demo code in this thread, viewtopic.php?f=35&t=2529&start=110#p21392 has similar functionality[receive commands via http, do something with pins]

 

While I'm using a completely different protocol, he does do what I need to do - use a map to map pin numbers from the http command to a port and bit combo - so I now have a working model for that bit of code.

Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...