California
Offline
Sr. Member
Karma: 2
Posts: 408
|
 |
« on: July 31, 2012, 08:14:37 pm » |
Can the Nokia 5110 screen be driven by an attiny84 with the arduino tiny library?
Also, can it be driven by 3v instead of 3.3v? My goal is to get it working off of a 3v cr2032 battery.
If not, or if that is a bad idea, what alternatives do I have that are compact and don't waste battery?
Thanks.
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3617
@ssh0le
|
 |
« Reply #1 on: July 31, 2012, 10:57:46 pm » |
probably if theres enough ram, and whats 0.3 volts between friends?
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
California
Offline
Sr. Member
Karma: 2
Posts: 408
|
 |
« Reply #2 on: August 04, 2012, 04:21:59 am » |
Just to update: It does not appear that the library itself even fits on the 84. I also get this error: In file included from pcdtest.cpp:19: C:\Users\Nick\Documents\Arduino\libraries\Adafruit_GFX/Adafruit_GFX.h:74: error: conflicting return type specified for 'virtual size_t Adafruit_GFX::write(uint8_t)' C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/Print.h:71: error: overriding 'virtual void Print::write(uint8_t)'
|
|
|
|
|
Logged
|
|
|
|
|
Leeds, UK
Offline
God Member
Karma: 35
Posts: 980
Once the magic blue smoke is released, it won't go back in!
|
 |
« Reply #3 on: August 04, 2012, 01:29:04 pm » |
Yeah, thats because someone when they updated the tiny core to Arduino 1.0, missed a bit. In Print.h in the tiny core, change the following: virtual size_t write(uint8_t) = 0; virtual void write(const char *str); virtual void write(const uint8_t *buffer, size_t size); To be: virtual size_t write(uint8_t) = 0; virtual size_t write(const char *str); virtual size_t write(const uint8_t *buffer, size_t size); And in Print.cpp, change the following: /* default implementation: may be overridden */ void Print::write(const char *str) { while (*str) write(*str++); }
/* default implementation: may be overridden */ void Print::write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); } To: /* default implementation: may be overridden */ size_t Print::write(const char *str) { size_t n = 0; while (*str){ n += write(*str++); } return n; }
/* default implementation: may be overridden */ size_t Print::write(const uint8_t *buffer, size_t size) { size_t n = 0; while (size--) { n += write(*buffer++); } return n; }
|
|
|
|
« Last Edit: August 04, 2012, 01:30:58 pm by Tom Carpenter »
|
Logged
|
~Tom~
|
|
|
|
California
Offline
Sr. Member
Karma: 2
Posts: 408
|
 |
« Reply #4 on: August 04, 2012, 07:45:48 pm » |
hmmm, now I get this: In file included from C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/WProgram.h:17, from C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/Arduino.h:4, from C:\Users\Nick\Documents\Arduino\libraries\Adafruit_GFX/Adafruit_GFX.h:20, from pcdtest.cpp:19: C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/TinyDebugSerial.h:728: error: conflicting return type specified for 'virtual void TinyDebugSerial::write(uint8_t)' C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/Print.h:71: error: overriding 'virtual size_t Print::write(uint8_t)' In file included from C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/WProgram.h:18, from C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/Arduino.h:4, from C:\Users\Nick\Documents\Arduino\libraries\Adafruit_GFX/Adafruit_GFX.h:20, from pcdtest.cpp:19: C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/HardwareSerial.h:58: error: conflicting return type specified for 'virtual void HardwareSerial::write(uint8_t)' C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/Print.h:71: error: overriding 'virtual size_t Print::write(uint8_t)'
|
|
|
|
|
Logged
|
|
|
|
|
Leeds, UK
Offline
God Member
Karma: 35
Posts: 980
Once the magic blue smoke is released, it won't go back in!
|
 |
« Reply #5 on: August 04, 2012, 07:55:50 pm » |
Eurgh, yeah, woops. I forgot that there are other bits in the core which are based around that version of Print being incorrect.
What you may have to do is to undo the changes to Print.h and Print.cpp, and instead change the Adafruit_GFX.h and Adafruit_GFX.cpp. Could you post the Adafruit library, and I can tell you what needs to be changed.
|
|
|
|
|
Logged
|
~Tom~
|
|
|
|
California
Offline
Sr. Member
Karma: 2
Posts: 408
|
 |
« Reply #6 on: August 04, 2012, 08:01:18 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
California
Offline
Sr. Member
Karma: 2
Posts: 408
|
 |
« Reply #7 on: August 04, 2012, 08:19:40 pm » |
The other thing is though that the library seems to big for the 84. It compiles at almost 9kb. So it would need to be pruned in order to work. To display any text or anything it also requires this library: https://github.com/adafruit/Adafruit-GFX-Library
|
|
|
|
|
Logged
|
|
|
|
|
Leeds, UK
Offline
God Member
Karma: 35
Posts: 980
Once the magic blue smoke is released, it won't go back in!
|
 |
« Reply #8 on: August 04, 2012, 08:19:57 pm » |
If you put the Print library back to how it was (I think i put the original in my first post), and change the following In Adafruit_GFX.cpp #if defined(__AVR_ATtiny84__) void Adafruit_GFX::write(uint8_t c) { //This line has been added #elif ARDUINO >= 100 size_t Adafruit_GFX::write(uint8_t c) { #else void Adafruit_GFX::write(uint8_t c) { #endif if (c == '\n') { cursor_y += textsize*8; cursor_x = 0; } else if (c == '\r') { // skip em } else { drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize); cursor_x += textsize*6; if (wrap && (cursor_x > (_width - textsize*6))) { cursor_y += textsize*8; cursor_x = 0; } } #if defined(__AVR_ATtiny84__) #elif ARDUINO >= 100 return 1; #endif } In Adafruit_GFX.h #if defined(__AVR_ATtiny84__) virtual void write(uint8_t); //this line is new #elif ARDUINO >= 100 virtual size_t write(uint8_t); #else virtual void write(uint8_t); #endif
|
|
|
|
|
Logged
|
~Tom~
|
|
|
|
California
Offline
Sr. Member
Karma: 2
Posts: 408
|
 |
« Reply #9 on: August 04, 2012, 08:41:04 pm » |
I changed back the tiny cores, and added those changes to the GFX files and I still get the same errors but also with this at the end In file included from pcdtest.cpp:19: C:\Users\Nick\Documents\Arduino\libraries\Adafruit_GFX/Adafruit_GFX.h:27: error: virtual outside class declaration
|
|
|
|
|
Logged
|
|
|
|
|
Leeds, UK
Offline
God Member
Karma: 35
Posts: 980
Once the magic blue smoke is released, it won't go back in!
|
 |
« Reply #10 on: August 04, 2012, 09:03:31 pm » |
I must be missing something. I have just tried compiling the example (stripped of all the line, box, circle, triangle stuff) and without modifying anything it compiles fine. Could you post your sketch?
|
|
|
|
|
Logged
|
~Tom~
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3617
@ssh0le
|
 |
« Reply #11 on: August 05, 2012, 12:52:48 am » |
try it in arduino 0.22
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
|