Undeclared identifiers in tdisp_lld.c

motley
Posts: 24
Joined: Fri May 10, 2013 3:51 pm

Undeclared identifiers in tdisp_lld.c

Postby motley » Wed May 15, 2013 1:08 pm

Hi,

I get compile warnings for undeclared identifiers "DISPLAY_ON" "CURSOR_ON" and "CURSOR_BLINK" in tdisp_lld.c

This is the relevant code block:

Code: Select all

void tdisp_lld_control(uint16_t what, uint16_t value) {
     
   switch(what) {
      case TDISP_CTRL_BACKLIGHT:
         if ((uint8_t)value)
            displaycontrol |= DISPLAY_ON;
         else
            displaycontrol &= ~DISPLAY_ON;
         write_cmd(0x08 | displaycontrol);
         break;
      case TDISP_CTRL_CURSOR:
         switch((uint8_t)value) {
         case cursorOff:
            displaycontrol &= ~CURSOR_ON;
            break;
         case cursorBlock:
         case cursorUnderline:
         case cursorBar:
            displaycontrol = (displaycontrol | CURSOR_ON) & ~CURSOR_BLINK;
            break;
         case cursorBlinkingBlock:
         case cursorBlinkingUnderline:
         case cursorBlinkingBar:
         default:
            displaycontrol |= (CURSOR_ON | CURSOR_BLINK);
            break;
         }
         write_cmd(0x08 | displaycontrol);
         break;
   }
}


However at the top of the file is this section:

Code: Select all

/* Our display control */
#define TDISP_DISPLAY_ON      0x04
#define TDISP_CURSOR_ON      0x02
#define TDISP_CURSOR_BLINK      0x01


Are these the intended ones ?

Chris

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undeclared identifiers in tdisp_lld.c

Postby Tectu » Wed May 15, 2013 1:16 pm

This does definitely not seem to be right. Please replace them with the correct ones (just add TDISP_ in front of those in the actual source code).
I never tried the TDISP module after a complete restructuring has been contributed. I should definitely do that.

If you got everything working, I'd be thankful for a patch.


~ Tectu

motley
Posts: 24
Joined: Fri May 10, 2013 3:51 pm

Re: Undeclared identifiers in tdisp_lld.c

Postby motley » Wed May 15, 2013 1:34 pm

Tectu,

I would be happy to do that once I get there, I have changed the identifiers now I have problems with these two:

tdispDrawStringLocation() - implicit declaration
tdispCreateChar() - argument 2 pointer has differing signedness

both are called in main.c as follows:

Code: Select all

#include "ch.h"
#include "hal.h"
#include "gfx.h"

int main(void) {
   char charmap[8];

   halInit();
   chSysInit();

   tdispInit();

   /* reset cursor position and clear the screen */
   tdispHome();
   tdispClear();

   /* set cursor position and draw single characters */
   tdispSetCursor(4, 0);
   tdispDrawChar('H');
   tdispDrawChar('D');
   tdispDrawChar('4');
   tdispDrawChar('4');
   tdispDrawChar('7');
   tdispDrawChar('8');
   tdispDrawChar('0');

   /* draw a string to a given location */
   tdispDrawStringLocation(0, 1, "chibios-gfx.com");

   /* create and display a custom made character */
   charmap[0] = 0b00000;
   charmap[1] = 0b00100;
   charmap[2] = 0b00010;
   charmap[3] = 0b11111;
   charmap[4] = 0b00010;
   charmap[5] = 0b00100;
   charmap[6] = 0b00000;
   charmap[7] = 0b00000;
   tdispCreateChar(0, charmap);
   tdispHome();
   tdispDrawChar(0);

   while(TRUE) {
      chThdSleepMilliseconds(250);   
   }
}


I will have a play around this afternoon.

I have been trying to download that other toolchain you linked me to but the download keeps stalling - it's probably the rubbish adsl link we have at my placement - probably be OK at home this evening.

Chris

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undeclared identifiers in tdisp_lld.c

Postby Tectu » Wed May 15, 2013 2:47 pm

Hello Chris,

Both things you have listed are warnings and not errors. A build should still be possible. Of course those warnings have to disappear. I cannot promise you but I will try to take a look at the TDISP module this evening. I don't have any hardware to try it out but I can still take a look at it and make sure it compiles fine.
Sorry for the trouble... Should you ever decide to go with graphic displays I can guarantee you that the other modules of the GFX project work nicer ;-)


~ Tectu

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undeclared identifiers in tdisp_lld.c

Postby Tectu » Wed May 15, 2013 3:04 pm

I'm currently on the train. I tracked down that the tdispDrawStringLocation function has been somehow removed since the last contribution. I added it again but as I said before, I couldn't try it out.
I also fixed the macros and the pointer warning.


~ Tectu

motley
Posts: 24
Joined: Fri May 10, 2013 3:51 pm

Re: Undeclared identifiers in tdisp_lld.c

Postby motley » Wed May 15, 2013 3:28 pm

Tectu,

As you say it compiled fine - just getting used to OpenOCD at the moment, I will keep going with the tdisp since I already have the displays

btw the base board I am using http://www.wvshare.com/column/STM32_DevelopmentBoard.htm#Open407V-D has an LCD display that uses SSD1289 controller so is compatible with your library. The display plugs directly into the baseboard which makes life easy, unfortunately I only have the bare board at the moment :-(

Chris

motley
Posts: 24
Joined: Fri May 10, 2013 3:51 pm

Re: Undeclared identifiers in tdisp_lld.c

Postby motley » Thu May 16, 2013 10:11 am

Hi tectu,

Almost there but there is small difference between the declaration and defintion of tdispCreateChar() :

from tdisp.h:

Code: Select all

void tdispCreateChar(uint8_t address, char* charmap);


and from tdisp.c:

Code: Select all

void tdispCreateChar(uint8_t address, uint8_t *charmap) {
   /* make sure we don't write somewhere we're not supposed to */
   if (address < TDISP.maxCustomChars) {
      MUTEX_ENTER();
      tdisp_lld_create_char(address, charmap);
      MUTEX_LEAVE();
   }
}


I assume that uint8_t is the one !

Cheers,

Chris

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undeclared identifiers in tdisp_lld.c

Postby Tectu » Mon May 20, 2013 2:59 am

Hey motley,

Thanks for pointing out that warning, I fixed it. Did you get your display working so far?


~ Tectu

motley
Posts: 24
Joined: Fri May 10, 2013 3:51 pm

Re: Undeclared identifiers in tdisp_lld.c

Postby motley » Mon May 20, 2013 6:33 pm

Hi Tectu,

Sadly the honest answer to that is no.

I am struggling with the makefile, I used the demo project for my STM32f4 and I modified the makefile according to your instructions. I realise there is code being compiled for the demo which I don't need for my simple tdisp project but I am having difficulty working out which bits I can cut out.

For instance here is a section of the makefile:

Code: Select all

CSRC = $(PORTSRC) \
       $(KERNSRC) \
       $(TESTSRC) \
       $(HALSRC) \
       $(PLATFORMSRC) \
       $(BOARDSRC) \
      $(GFXSRC) \
       $(CHIBIOS)/os/various/lis302dl.c \
       $(CHIBIOS)/os/various/chprintf.c \
       main.c


Obviously some of it is essential and some belongs to the Chibios demo - trouble is working out which is which ? I will get there in the end it's just a bit frustrating at the moment.

Cheers,

Chris

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Undeclared identifiers in tdisp_lld.c

Postby Tectu » Mon May 20, 2013 7:27 pm

Hey Chris,

Don't worry, just ask and we will do our best to help you :)
I wouldn't strip away parts of the Makefile so far. Code size shouldn't be a problem at the moment and compiling time is like gaining 500ms. Just take the bare F4 demo from the ChibiOS/RT directory, add the lines which are hilighted in the GFX Makefile and you should be ready to go. Including code in the Makefile that you don't need is really no issue at all (for example the accelerometer).


~ Tectu


Return to “LCD Driver and Graphic Framework”

Who is online

Users browsing this forum: No registered users and 1 guest