Hi,
I'm currently working on a project that uses a PS2 keyboard-wedge style barcode scanner.
I should start by saying that some of the code in the library is slightly over my head.
Now that the Web IDE supports external files (yay!) it now looks easier to work on converting the library.
I'm currently having problems with variable conversion.
As AVR chips don't have a lot of RAM the library uses PROGMEM to store the keymap array.
Spark Core doesn't support this so I have begun by removing all references to this.
For example I have changed:
extern const PROGMEM PS2Keymap_t PS2Keymap_US;
to:
extern const PS2Keymap_t PS2Keymap_US;
In the header file which I think will change the PROGMEM "array" to one stored in RAM.
I changed:
const PROGMEM PS2Keymap_t PS2Keymap_US = {
to:
const PS2Keymap_t PS2Keymap_US = {
In the cpp file which I believe tells the compiler to save the array to the array created in the header and not into flash.
and lines like:
c = pgm_read_byte(keymap->altgr + s);
to:
c = keymap->altgr + s;
which is where I am running into this problem:
PS2Keyboard.cpp:336:26: error: invalid conversion from 'const uint8_t* {aka const unsigned char*}' to 'char' [-fpermissive]
As far as I can tell there is no issue with the PROGMEM conversion, but it is how the compiler understands different data types? Would I be correct in thinking this?
Would I be correct in thinking that I need to change something in:
typedef struct {
uint8_t noshift[PS2_KEYMAP_SIZE];
uint8_t shift[PS2_KEYMAP_SIZE];
uint8_t uses_altgr;
uint8_t altgr[PS2_KEYMAP_SIZE];
} PS2Keymap_t;
so that it uses a different type the spark compiler understands or am I way off of track.
The library I am trying to convert is the Arduino PS2Keyboard Library Version 2.4 (March 2013)
Any help would be greatly appreciated.
Many thanks.