LCDMsg_ChangeColor() using from C code - General Discussion and Assistance - CHDK Forum

LCDMsg_ChangeColor() using from C code

  • 4 Replies
  • 2914 Views
*

Offline alvm

  • ***
  • 123
LCDMsg_ChangeColor() using from C code
« on: 19 / April / 2012, 10:37:47 »
Advertisements
Hi,

I'd like use LCDMsg_ChangeColor() and some like it functions from C code. This function get two params in Canon Basic but if take a look at its code (a495/100f)

ROM:FFE1FC6C LCDMsg_ChangeColor                      ; DATA XREF: ROM:FFEDA2A4
ROM:FFE1FC6C                 ADD     R1, R0, #4
ROM:FFE1FC70                 LDRB    R1, [R1]
ROM:FFE1FC74                 LDRB    R0, [R0]
ROM:FFE1FC78                 B       sub_FFE1FC20
ROM:FFE1FC78 ; End of function LCDMsg_ChangeColor
 
only first param (R0) is used.

Any body have a experience for using the functions from C program? How should I set params for the function:  LCDMsg_ChangeColor(lcdmsg, color) or  LCDMsg_ChangeColor(argbuf), where argbuf is structure?

Thanks,
Alex.

*

Offline funnel

  • ****
  • 349
Re: LCDMsg_ChangeColor() using from C code
« Reply #1 on: 19 / April / 2012, 10:52:51 »
You can take a look at the reyalp's loader code on the wiki page http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Loader. Looks like the first argument is what LCDMsg_Create returns.
« Last Edit: 19 / April / 2012, 10:58:42 by funnel »

*

Offline alvm

  • ***
  • 123
Re: LCDMsg_ChangeColor() using from C code
« Reply #2 on: 19 / April / 2012, 10:59:01 »
You can take a look at the reyalps loader code on the wiki page http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Loader. Looks like the first argument is what LCDMsg_Create returns.

Yes, I use

unsigned lsdmsg = ExecuteEventProcedure("LCDMsg_Create");
_LCDMsg_ChangeColor(lsdmsg , 2);

but cam go off.

If I use

unsigned *argbuf=NULL;
unsigned *argbuf1;

unsigned char color = 2;
      
argbuf = malloc(10 * 4);

argbuf1 = argbuf;

*argbuf++ = lcdmsg;
*argbuf++ = &color;

_LCDMsg_ChangeColor(&argbuf1);

I have

ASSERT!! DlgItm.c Line 313
Occured Time  2012:04:19 00:37:17
Task ID: 11337752
Task name: SpyTask
« Last Edit: 19 / April / 2012, 13:23:44 by alvm »

*

Offline funnel

  • ****
  • 349
Re: LCDMsg_ChangeColor() using from C code
« Reply #3 on: 19 / April / 2012, 13:05:39 »
I tried right now and works like in the loader code. From lua it throws an assert - UTF8Str.c

Code: [Select]
_ExecuteEventProcedure("UI.CreatePublic");

int lcdmsg = _ExecuteEventProcedure("LCDMsg_Create");
if (lcdmsg >= 0)
{
int i=0;
while(i<10)
{
_ExecuteEventProcedure("LCDMsg_ChangeColor",lcdmsg,i);
_ExecuteEventProcedure("LCDMsg_SetStr",lcdmsg,"Hello");
i++;
msleep(500);
}
}

*

Offline alvm

  • ***
  • 123
Re: LCDMsg_ChangeColor() using from C code
« Reply #4 on: 19 / April / 2012, 13:25:25 »
LCDMsg_ChangeColor() works fine throws ExecuteEventProcedure() .

Thank you  funnel!

 

Related Topics


SimplePortal © 2008-2014, SimplePortal