PDA

View Full Version : Uart interface to propeller microcontroller



stickynicky
December 7th, 2009, 05:34
Is there any way to interface the psp to the parallax propeller microcontroller? I want to interface a gsm modem to the psp and store it in the umd bay, using a simple homebrew program to send AT commands (like ATD15555551234) to the modem from the psp. maybe like simple numbered button clicks to send commands? the propeller supports bit-banging uart using 2 of its cogs with 6 of them left over for, i dont know, harddrive interface, gsm modem, gps, all kinds of possibilities. wich serial port should i use for ttl level serial? any coding suggestions for accessing this serial port? i have eclipse installed and a basic understanding of coding for the psp and can live debug with usbhost.





Edit:I think I have found the software to do the trick

http://www.qj.net/psp/homebrew-development/mypsp-robotics-with-mygprs-from-psp-robot-to-psp-phone.html

Download Mypsp Robotics Here (http://dl.qj.net/download/mypsp-robotics-v521-with-modules-for-psp-fat.html)

stickynicky
December 7th, 2009, 06:20
Also, the gsm modem i am looking at also has built-in gps sirf 3. can I mod the map this source to send a query data command through the uart or remote or usb wichever port is easiest, preferrably one inside the psp so I still have access to the external ports

stickynicky
December 7th, 2009, 06:34
http://www.sparkfun.com/commerce/product_info.php?products_id=7917 Modem
http://www.sparkfun.com/commerce/product_info.php?products_id=277 Breakout Board
http://www.sparkfun.com/commerce/product_info.php?products_id=8539 Microcontroller with
SD slot and OLED display
I think it will all fit in the umd drive with the drive removed. I may have to add a higher capacity battery for improved battery life and a custom umd door for it to fit. possibly I could also buy the chotto shot cam and internalize it as well for a wifi gaming cameraphone with gps. sweet.

stickynicky
December 20th, 2009, 09:59
http://master.dl.sourceforge.net/project/psppockettool/Psp%20Phone/PspPhone1.bmp

http://master.dl.sourceforge.net/project/psppockettool/Psp%20Phone/PspPhone1.bmp

This is something along the lines of what I would like the psp phone interface to look like. I am trying to make this work with the lte engine but, alas, my efforts have failed. I have edited the lte user interface example by adding a button and event reciever to go with it. I eventually want to move things around and add the buttons, wording to go along with it (when you type a number and press dial a window should pop up and say "ATD5555555555" or whatever number you enter in the text input field)/serout that data thru remote port. After I did my first little bit of editing, cleaned, recompiled, reset psp link, and debug UserInterface.prx, click debug button twice to find that the portion of the code that I have edited does not show up on the psp, just the demo as it was before i edited the c file. What the heck am I doing wrong?


ORIGINAL

/*
This tutorial shows how to use the built in User Interface of
the engine. It will give a brief overview and show
how to create and use windows, buttons, scroll bars, static
texts and list boxes.

As always, we include the header files, and use the engine
namespaces. We also store a pointer to the engine device,
a counter variable for changing the creation position of a window,
and a pointer to a listbox.
*/
#include "../engine.h"
#include "../common.h"


using namespace engine;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

engineDevice *device = 0;
s32 cnt = 0;
IGUIListBox* listbox = 0;


/*
The Event Receiver is not only capable of getting keyboard and
mouse input events, but also events of the graphical user interface
(gui). There are events for almost everything: Button click,
Listbox selection change, events that say that a element was hovered
and so on. To be able to react to some of these events, we create
an event receiver.
We only react to gui events, and if it's such an event, we get the
id of the caller (the gui element which caused the event) and get
the pointer to the gui environment.
*/
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();

switch(event.GUIEvent.EventType)
{

/*
If a scrollbar changed its scroll position, and it is 'our'
scrollbar (the one with id 104), then we change the
transparency of all gui elements. This is a very easy task:
There is a skin object, in which all color settings are stored.
We simply go through all colors stored in the skin and change
their alpha value.
*/
case EGET_SCROLL_BAR_CHANGED:
if (id == 104)
{
s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();

for (s32 i=0; i<EGDC_COUNT ; ++i)
{
SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
col.setAlpha(pos);
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
}

}
break;

/*
If a button was clicked, it could be one of 'our'
three buttons. If it is the first, we shut down the engine.
If it is the second, we create a little window with some
text on it. We also add a string to the list box to log
what happened. And if it is the third button, we create
a file open dialog, and add also this as string to the list box.
That's all for the event receiver.
*/
case EGET_BUTTON_CLICKED:

if (id == 101)
{
device->closeDevice();
return true;
}

if (id == 102)
{
listbox->addItem(L"Window created");
cnt += 30;
if (cnt > 200)
cnt = 0;

IGUIWindow* window = env->addWindow(
rect<s32>(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt),
false, // modal?
L"Test window");

env->addStaticText(L"Please close me",
rect<s32>(35,35,140,50),
true, // border?
false, // wordwrap?
window);

return true;
}

if (id == 103)
{
listbox->addItem(L"File open");
env->addFileOpenDialog(L"Please choose a file.");
return true;
}

break;
}
}

return false;
}
};


/*
Ok, now for the more interesting part. First, create the
engine device.
*/
int engineMain(unsigned int argc, void *argv )
{
// setup psp
setupPSP();

device = createDevice();
/* The creation was successful, now we set the event receiver and
store pointers to the driver and to the gui environment. */

MyEventReceiver receiver;
device->setEventReceiver(&receiver);

video::IVideoDriver* driver = device->getVideoDriver();
IGUIEnvironment* env = device->getGUIEnvironment();

/*
We add three buttons. The first one closes the engine. The second
creates a window and the third opens a file open dialog. The third
parameter is the id of the button, with which we can easily identify
the button in the event receiver.
*/

env->addButton(rect<s32>(10,190,100,210), 0, 101, L"Quit");
env->addButton(rect<s32>(10,220,100,260), 0, 102, L"New Window");
env->addButton(rect<s32>(10,10,100,50), 0, 103, L"File Open");

/*
To make the font a little bit nicer, we load an external font
and set it as new font in the skin.
*/

IGUISkin* skin = env->getSkin();
IGUIFont* font = env->getFont("ms0:/media/fonttahoma.bmp");
if (font)
skin->setFont(font);

/*
Now, we add a static text and a scrollbar, which modifies the
transparency of all gui elements. We set the maximum value of
the scrollbar to 255, because that's the maximal value for
a color value.
Then we create an other static text and a list box.
*/

env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true);
IGUIScrollBar* scrollbar = env->addScrollBar(true, rect<s32>(150, 45, 350, 60), 0, 104);
scrollbar->setMax(255);

env->addEditBox(L"Logging ListBox:", rect<s32>(50,80,250,100), true);
listbox = env->addListBox(rect<s32>(50, 110, 250, 180));

/*
That's all, we only have to draw everything.
*/

while(device->run())
{
driver->beginScene(true, true, SColor(0,200,200,200));

env->drawAll();

driver->endScene();
}

sceKernelExitGame();
return 0;
}


Mine (add button 105+event reciever)
/*
This tutorial shows how to use the built in User Interface of
the engine. It will give a brief overview and show
how to create and use windows, buttons, scroll bars, static
texts and list boxes.

As always, we include the header files, and use the engine
namespaces. We also store a pointer to the engine device,
a counter variable for changing the creation position of a window,
and a pointer to a listbox.
*/
#include <engine.h>
#include "../common.h"


using namespace engine;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

engineDevice *device = 0;
s32 cnt = 0;
IGUIListBox* listbox = 0;


/*
The Event Receiver is not only capable of getting keyboard and
mouse input events, but also events of the graphical user interface
(gui). There are events for almost everything: Button click,
Listbox selection change, events that say that a element was hovered
and so on. To be able to react to some of these events, we create
an event receiver.
We only react to gui events, and if it's such an event, we get the
id of the caller (the gui element which caused the event) and get
the pointer to the gui environment.
*/
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();

switch(event.GUIEvent.EventType)
{

/*
If a scrollbar changed its scroll position, and it is 'our'
scrollbar (the one with id 104), then we change the
transparency of all gui elements. This is a very easy task:
There is a skin object, in which all color settings are stored.
We simply go through all colors stored in the skin and change
their alpha value.
*/
case EGET_SCROLL_BAR_CHANGED:
if (id == 104)
{
s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();

for (s32 i=0; i<EGDC_COUNT ; ++i)
{
SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
col.setAlpha(pos);
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
}

}
break;

/*
If a button was clicked, it could be one of 'our'
three buttons. If it is the first, we shut down the engine.
If it is the second, we create a little window with some
text on it. We also add a string to the list box to log
what happened. And if it is the third button, we create
a file open dialog, and add also this as string to the list box.
That's all for the event receiver.
*/
case EGET_BUTTON_CLICKED:

if (id == 101)
{
device->closeDevice();
return true;
}

if (id == 102)
{
listbox->addItem(L"Window created");
cnt += 30;
if (cnt > 200)
cnt = 0;

IGUIWindow* window = env->addWindow(
rect<s32>(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt),
false, // modal?
L"test window");

env->addStaticText(L"Calling #",
rect<s32>(35,35,140,50),
false, // border?
true, // wordwrap?
window);

return true;
}

if (id == 103)
{
listbox->addItem(L"File open");
env->addFileOpenDialog(L"Please choose a file.");
return true;
}

if (id == 105)
{
listbox->addItem(L"Call Ended");
cnt += 30;
if (cnt > 200)
cnt = 0;

IGUIWindow* window = env->addWindow(
rect<s32>(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt),
false, // modal?
L"Test window");

env->addStaticText(L"Call Ended.",
rect<s32>(35,35,140,50),
false, // border?
true, // wordwrap?
window);

return true;
}

break;
}
}

return false;
}
};


/*
Ok, now for the more interesting part. First, create the
engine device.
*/
int engineMain(unsigned int argc, void *argv )
{
// setup psp
setupPSP();

device = createDevice();
/* The creation was successful, now we set the event receiver and
store pointers to the driver and to the gui environment. */

MyEventReceiver receiver;
device->setEventReceiver(&receiver);

video::IVideoDriver* driver = device->getVideoDriver();
IGUIEnvironment* env = device->getGUIEnvironment();

/*
We add three buttons. The first one closes the engine. The second
creates a window and the third opens a file open dialog. The third
parameter is the id of the button, with which we can easily identify
the button in the event receiver.
*/

env->addButton(rect<s32>(10,190,100,210), 0, 101, L"Quit");
env->addButton(rect<s32>(10,220,100,260), 0, 102, L"Dial");
env->addButton(rect<s32>(10,10,100,50), 0, 103, L"File Open");
env->addButton(rect<s32>(10,160,100,160), 0, 105, L"End");

/*
To make the font a little bit nicer, we load an external font
and set it as new font in the skin.
*/

IGUISkin* skin = env->getSkin();
IGUIFont* font = env->getFont("ms0:/media/fonttahoma.bmp");
if (font)
skin->setFont(font);

/*
Now, we add a static text and a scrollbar, which modifies the
transparency of all gui elements. We set the maximum value of
the scrollbar to 255, because that's the maximal value for
a color value.
Then we create an other static text and a list box.
*/

env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true);
IGUIScrollBar* scrollbar = env->addScrollBar(true, rect<s32>(150, 45, 350, 60), 0, 104);
scrollbar->setMax(255);

env->addEditBox(L"Logging ListBox:", rect<s32>(50,80,250,100), true);
listbox = env->addListBox(rect<s32>(50, 110, 250, 180));

/*
That's all, we only have to draw everything.
*/

while(device->run())
{
driver->beginScene(true, true, SColor(0,200,200,200));

env->drawAll();

driver->endScene();
}

sceKernelExitGame();
return 0;
}

I also tried to use the code tags to post this but I lost all of my code structure. Any help is much appreiciated.