Go Down

Topic: Getting a compiler error for Due but not for Uno (Read 907 times) previous topic - next topic

maui7733

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: [Select]
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 ;)
Code: [Select]
#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.

johnwasser

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.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy