Show Posts
Pages: [1] 2 3
1  Using Arduino / Programming Questions / Re: const PROGMEM compilation error with latest avr-gcc on: June 13, 2014, 11:40:20 am
That works, thank you very much!
2  Using Arduino / Programming Questions / const PROGMEM compilation error with latest avr-gcc on: June 13, 2014, 10:53:09 am
Hello guys,

Since avr-gcc 4.6.1, we have to put a "const" modifier in front of our "PROGMEM" variables declarations. That's fine, and I won't debate about that. But I have an issue, I'm no longer able to declare a progmem array of progmem string pointers, even if I add the "const" modifier. Here is my SSCCE:

Code:
#define PAUSEMENULENGTH 6

const char strPlay[] PROGMEM = "Play";
const char strRestart[] PROGMEM = "Restart";
const char strHighScores[] PROGMEM = "High scores";
const char strVolume[] PROGMEM = "Volume";
const char strSystemInfo[] PROGMEM = "System Info";
const char strMainMenu[] PROGMEM = "Main Menu";

const char* pauseMenu[] PROGMEM= {
  strPlay,
  strRestart,
  strHighScores,
  strVolume,
  strSystemInfo,
  strMainMenu
};

void setup(){
}

void loop(){
}

The first part where I create the different strings works fine. But when I try to put them in the "pauseMenu" variable, I get the following error:

Code:
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:8:0,
                 from sketch_jun13b.ino:3:
sketch_jun13b.ino:11:25: error: variable 'pauseMenu' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

It asks for "const", but there is "const", so what wrong ?! How to make that compile ? This code works fine with avr-gcc versions older than 4.6.1 (which doesn't require "const" at all).

Another question : I found on some websites that PROGMEM is outdated, and __flash should be used instead. But __flash doesn't compile at all. Anybody heard about that ?
3  Community / Exhibition / Gallery / Re: Gamebuino now on Indiegogo - make your own 8-bit games on: March 15, 2014, 03:20:28 am
If you want a large, beautiful screen with a lot of computing power, you can just buy a cheap Android smartphone/tablet and learn to code java. Here the goal is not to run fancy games, it's to keep everything as cheap and simple as possible, for it to be easily hackable. I don't aim mass market with this project. It's just for tinkerers like me who make projects during weekends. Moreover, some people like what is called "retro", because it reminds them good memories. For example, Gamebuino has the same screen as a Nokia 3310. I spent hours playing on mine, now I'm proud to be able to make better games than the ones included in my phone.
Thank you for your honesty.
Edit: I just visited your website, I understand what you are saying now, I think you could rephrase it this way: "I'm in the early development of a arduino gaming device with a color screen and an atmega1284. Mine is bigger, yours is shit."
4  Using Arduino / Programming Questions / Re: Alter library compilation with preprocessor directives in the sketch on: March 14, 2014, 12:30:37 pm
Thank you for your quick answer!

Actually I already have a "settings.h", but you need to edit it every time depending on what you need in the program/game you are currently compiling... For example, I could only use 1 channel for the sound in a game which require a lot of RAM, and 4 channels in another game. Not really handy smiley-sad
5  Using Arduino / Programming Questions / Alter library compilation with preprocessor directives in the sketch on: March 14, 2014, 12:23:42 pm
Hey there!
I'm wrote a complete library for Gamebuino, a handheld console based on Arduino I released on Indiegogo 3 days ago (check out the trailer on http://igg.me/at/gamebuino). The library includes a lot of things, like a fancy GUI or 4 channel sound generation. That's really handy, but the problem is that it takes a lot of ROM & RAM. I would like to be able to add some preprocessor directives at the beginning of my sketches to disable some parts of the library depending on what I need , like #define NOSOUND 1 to disable the whole sound generation.
Is that possible ? If I use #ifdef NOSOUND in the library and #define NOSOUND 1 in my sketch, it won't work because the sketch comes after the library :'(
I can't put the different parts of the library in different libraries, because they all depend from each other, and that would be really messy.
I didn't find any neat solution, I hope you will! smiley

6  Community / Exhibition / Gallery / Gamebuino now on Indiegogo - make your own 8-bit games on: March 14, 2014, 12:11:48 pm
Hey everybody !
I'm pretty proud to announce that the Arduino console I've been working on for a while is now live on Indigogo !
If you want to see what it's capable of, check out the trailer at http://igg.me/at/gamebuino


Thank you for passing by!
7  Using Arduino / Project Guidance / Re: Which atmega for a portable console on: June 18, 2013, 06:48:13 pm
I dont't speak about building a single, but about designing an open source console for anybody to be able to build one. And I want it to be as cheap as possible. So I was just wondering if the atmega 328 would have enough memory.

I think I'll put an atmega 328 finally because the 644 is far too expensive for a product under 30$ (batteries included), but I'm afraid about the memory.
8  Using Arduino / Project Guidance / Which atmega for a portable console on: June 18, 2013, 05:41:29 pm
Hello everybody,
I'm currently designing a "retro" portable console based on the nokia 5110 screen as it's widely available and very cheap. I've already made few promising prototypes, and I'm hesitating about which atmega I should use. I don't need a lot of input/output, I want it to be cheap, and as much flash/ram as possible.

I hesitate between the atmega328 & atmega644. The atmega644 is cool because it has twice the memory of the atmega328, but it's 3x more expensive, far less available, and is not officially supported by arduino, so I'm worried about the libraries compatibility (spi, tone, millis, pwm...).

Maybe 32k of flash is enough (I already made a full game, and it takes 20k), but I think it may be a little short fo really big games... on the other side the atmega644 is expensive and not fully compatible.

What do you think about that ? I think I should go in the cheap and safe way of the atmega328, but... Arh, I don't know. They should do a atmega648.
9  Using Arduino / Programming Questions / Re: Replacing shiftOut with hard SPI on: June 18, 2013, 10:05:29 am
PROBLEM SOLVED !!!
The DC (select between Data / Command) pin of the screen was connected to the pin 12 of the arduino. What wrong with that ? That's the MISO pin ! So the SPI library was setting it as an input, while the LCD library was setting it as an output. Input = high z = floating, that's why the screen was behaving differently when I touched the DC pin. Sorry for annoying you Nick Gammon smiley-red

Edit : even with clock divider set to 4 (default), the communication with the screen is 16 time faster than before ! It represents 30% more of free cpu for my console running @ 20FPS. Greaaat ! smiley-grin I've done some other tweaks, and added new functions (rotated sprites for example, very useful for games). I'll post the library soon
10  Using Arduino / Programming Questions / Re: Replacing shiftOut with hard SPI on: June 18, 2013, 08:02:24 am
Sounds like a floating input somewhere.
I totally agree with you, but the SPI port uses internal pull up, isn't it ?

Exactly the same thing, except the speed. And the speed might be what is causing it. That is, timing errors are more likely to manifest themselves if you are shoving out data quickly.
That's why I've set the clock divider to have the same clock frequency than with software SPI (measured with a oscilloscope).

I'll look further tonight, 'cause I've to go to school for a Test  smiley-sweat
11  Using Arduino / Programming Questions / Re: Replacing shiftOut with hard SPI on: June 18, 2013, 06:55:04 am
Hem... the CS is always low  smiley-roll... but it works with the soft SPI library smiley-sad
I give it a try, thank you for your feedback ! But the hardware SPI should do exactly the same thing than shiftOut, isn't it ?
I just saw that adafruit and the hard SPI library doesn't init with the same bytes... I'm dipping in the datasheet to see what's behind that.

By the way, the datasheet says 4Mbit/s max, so I won't be able to communicate at full speed (8Mhz on a 16Mhz atmega). Bad news, as I'm designing a portable console, and I need the more free processing time I can get.
12  Using Arduino / Programming Questions / Re: Replacing shiftOut with hard SPI on: June 18, 2013, 06:24:18 am
I already tried it, only mode 0 & 3 display something (but with the same weird horizontal scrolling).
Mode 3 is for data on rising clock and clock at high level when idle. It makes sense that only this mode works, if you look at the working code : the data is set, and then the clock is raised. And once the transmission is done, it remains high. Arh, it's strange...
I found that library that uses the hardware SPI, and I tried the same settings... it still doesn't work.
https://github.com/energia/Energia/tree/master/examples/7.Display/LCD_5110_SPI
13  Using Arduino / Programming Questions / [SOLVED] Replacing shiftOut with hard SPI on: June 18, 2013, 05:04:44 am
Hello,
I'm tweaking the nokia 5110 LCD's library from adafruit for more performance. To do so, I want to replace the shiftOut with hardware SPI.
The original working code is :
Code:
inline void Adafruit_PCD8544::fastSPIwrite(uint8_t d) {
    for(uint8_t bit = 0x80; bit; bit >>= 1) {
    *clkport &= ~clkpinmask;
    if(d & bit) *mosiport |=  mosipinmask;
    else        *mosiport &= ~mosipinmask;
    *clkport |=  clkpinmask;
  }
}
//a slower alternative :
inline void Adafruit_PCD8544::slowSPIwrite(uint8_t c) {
  shiftOut(_din, _sclk, MSBFIRST, c);
}
(line 192 https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library/blob/master/Adafruit_PCD8544.cpp, shiftOut alternative line 202)

So I replace it by (I renamed the library Gamebuino_screen, but don't care about that)
Code:
void Gamebuino_screen::begin(uint8_t contrast) {
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  SPI.setClockDivider(SPI_CLOCK_DIV64); //to have the same clock speed than the "software" SPI
  SPI.setDataMode(SPI_MODE3);
[...]
}

inline void Gamebuino_screen::fastSPIwrite(uint8_t d) {
  SPI.transfer((char)d);
}

And the screen acts weirdly... Here is a video :

The image moves to the right at each frame.
Something strange : if I bridge the pins DC & DIN (MOSI) with my finger, the image stops moving, but the menu's text is not vertically aligned as it should.

So what's the difference between the software SPI above and the hardware SPI ? Please help me smiley-sad
14  Using Arduino / Project Guidance / Re: Open source, cheap and Do It Yourself handeld console on: April 18, 2013, 01:30:11 pm
As a gamer, I am very interested in your project, but im a little concerned about the amount of memory it will use up.

Thank you ! I hope to fit all that stuff in 10kB of ROM, to let 20kB free. I managed to fit a whole game on the 32kB of rom on a previous console with fancy menus, animations, music, a lot of float calculation... it has even been published on hackaday \o/ http://r0d0t.tumblr.com/post/32510849587

About loading games from a SD card, I took a look at it, but the only library able to flash programs from SD card was only able to handle FAT16. FAT16 is for sd cards of 2GB max, and they become hard to find.

I wanted this console to be very simple and cheap. If I manage to raise a community, I'll maybe develop a "slim" version that uses LiPo and surface mounted components, and include an SD card. But I think 32kB of ROM should be enough for a first version ? I hope.
15  Using Arduino / Project Guidance / Re: Open source, cheap and Do It Yourself handeld console on: April 18, 2013, 01:16:59 pm
Oops, I forgot about timezone  smiley-sweat
But I said that because I saw the post sinking to the second page, it was a way to "up" it  smiley-roll
Pages: [1] 2 3