Pages: [1]   Go Down
Author Topic: Getting a compiler error for Due but not for Uno  (Read 632 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I was trying to compile some code which runs on the Uno just fine, but when I compile it in 1.5.2 I get this
Code:
C:\*\arduino-1.5.2\libraries\ST7565\ST7565.cpp: In member function 'void ST7565::drawbitmap(uint8_t, uint8_t, const uint8_t*, uint8_t, uint8_t, uint8_t)':
C:\*\arduino-1.5.2\libraries\ST7565\ST7565.cpp:141: error: cast from 'const uint8_t*' to 'uint16_t' loses precision
C:\*\arduino-1.5.2\libraries\ST7565\ST7565.cpp: In member function 'void ST7565::drawstring_P(uint8_t, uint8_t, const char*)':
C:*\arduino-1.5.2\libraries\ST7565\ST7565.cpp:167: error: cast from 'const char*' to 'uint16_t' loses precision
C:*\arduino-1.5.2\libraries\ST7565\ST7565.cpp: In member function 'void ST7565::drawchar(uint8_t, uint8_t, char)':
C:\*\arduino-1.5.2\libraries\ST7565\ST7565.cpp:183: error: cast from 'uint8_t*' to 'uint16_t' loses precision

Here is my code example ... as easy as possible smiley-wink
Code:
#include "ST7565.h"
void setup() {
  // pin 9 - Serial data out (SID)
  // pin 8 - Serial clock out (SCLK)
  // pin 7 - Data/Command select (RS or A0)
  // pin 6 - LCD reset (RST)
  // pin 5 - LCD chip select (CS)
  ST7565 glcd(9, 8, 7, 6, 5);

}

void loop() {
  // put your main code here, to run repeatedly:

}

What gehts me thinking, if I change my board to "Arduino Uno" it compiles w/o errors.
Can you help me?

I mean there shouldn't be any errors.. because I can cast a int to a long too, this should be a warning at least.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like the library is assuming that pointers are 16 bits long.  On the DUE I think they are 32 bits long, hence the warning.  You may have to find a different library that works on DUE.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: