I manged to do it via reading the docs.
The docs are very nicely detailed but not overly detailed. Well done Logitech, you guys are a good example.
I spent about an hour doing this(reading & understanding docs at around 2:30 in the morning) so please don't knock the simplicity.
You need the WIndows 32 api but not MFC because you need access to unsigned longs called 'DWORD' which are Microsoft's version of an integer(aka unsigned long, 64 bit long turned into an unsigned thing which is just 32b).
I'm guessing it has to do with compacting stuff into large bitsets.
Storing 2 DWORD into a single long.
Anyway here's code:
Given as to how bored I am I might right my own vector library to do some basic rendering but generally what I need are some bitmaps that draw icons but before that I need to find something useful to use the LCD with.
Any ideas?
The docs are very nicely detailed but not overly detailed. Well done Logitech, you guys are a good example.
I spent about an hour doing this(reading & understanding docs at around 2:30 in the morning) so please don't knock the simplicity.
You need the WIndows 32 api but not MFC because you need access to unsigned longs called 'DWORD' which are Microsoft's version of an integer(aka unsigned long, 64 bit long turned into an unsigned thing which is just 32b).
I'm guessing it has to do with compacting stuff into large bitsets.
Storing 2 DWORD into a single long.
Anyway here's code:
Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "lglcd.h"
int main(int argc, char *argv[]){
const int BITMAP_AREA = 160 * 43;
DWORD priority;
lgLcdConnectContext connection;
lgLcdOpenContext openContext;
lgLcdDeviceDesc deviceDescription;
lgLcdBitmap160x43x1 bitmap;
if(lgLcdInit() == ERROR_SUCCESS){
connection.appFriendlyName = "Kruno";
connection.isAutostartable = true;
connection.isPersistent = true;
connection.onConfigure.configCallback = NULL;
connection.onConfigure.configContext = NULL;
if(lgLcdConnect(&connection) == ERROR_SUCCESS){
if(lgLcdEnumerate(connection.connection, 0, &deviceDescription) == ERROR_SUCCESS){
openContext.connection = connection.connection;
openContext.index = 0;
openContext.onSoftbuttonsChanged.softbuttonsChangedCallback = NULL;
openContext.onSoftbuttonsChanged.softbuttonsChangedContext = NULL;
if(lgLcdOpen(&openContext) == ERROR_SUCCESS){
priority = LGLCD_ASYNC_UPDATE(LGLCD_PRIORITY_ALERT);
bitmap.hdr.Format = LGLCD_BMP_FORMAT_160x43x1;
for(int i=0; i < BITMAP_AREA; i++)
bitmap.pixels[i] = 0xff;
if(lgLcdUpdateBitmap(openContext.device, &bitmap.hdr, priority) == ERROR_SUCCESS){
Sleep(2000);
}
}
lgLcdClose(openContext.index);
}
}
}
lgLcdDeInit();
return 0;
}
Given as to how bored I am I might right my own vector library to do some basic rendering but generally what I need are some bitmaps that draw icons but before that I need to find something useful to use the LCD with.
Any ideas?