Backlight Flashing Images
Before I work on accessing the lcd display and writing a driver for it, I thought I'd post my work in its current state -- a flashing backlight that litterally looks like a strobe light. Its kinda hard to tell from the pics, but visuals are fun anyways.


The general code for this is as follows:
First you need to initialize the MBAR (Module Base Address Register). Heres my code to do so (with MBAR and MBAR2 already defined):
#if MBAR & 1
#define MBAR_SET MBAR
#else
#define MBAR_SET MBAR+1
#endif
#if MBAR2 & 1
#define MBAR2_SET MBAR2
#else
#define MBAR2_SET MBAR2+1
#endif
move.l #MBAR_SET, %d0
movec.l %d0, %mbar
move.l #MBAR2_SET, %d0
movec.l %d0, %mbar2
Next, you can enable and turn on and off the light with some simple c code:
#define GPIO1_OUT *((int *)(MBAR2 + 0x000000B4))
#define GPIO1_ENABLE *((int *)(MBAR2 + 0x000000B8))
To enable the light:
GPIO1_ENABLE |= 0x00020000;
To turn it on:
GPIO1_OUT &= 0xFFFDFFFF;
To turn it off:
GPIO1_OUT |= 0x00020000;
I am really surprised, because if you set a bit > than the 16th bit in c with binary or, gcc optimizes it to bitset while if its less than 16, it is a binary or with a word. I didn't expect it do be this smart.


The general code for this is as follows:
First you need to initialize the MBAR (Module Base Address Register). Heres my code to do so (with MBAR and MBAR2 already defined):
#if MBAR & 1
#define MBAR_SET MBAR
#else
#define MBAR_SET MBAR+1
#endif
#if MBAR2 & 1
#define MBAR2_SET MBAR2
#else
#define MBAR2_SET MBAR2+1
#endif
move.l #MBAR_SET, %d0
movec.l %d0, %mbar
move.l #MBAR2_SET, %d0
movec.l %d0, %mbar2
Next, you can enable and turn on and off the light with some simple c code:
#define GPIO1_OUT *((int *)(MBAR2 + 0x000000B4))
#define GPIO1_ENABLE *((int *)(MBAR2 + 0x000000B8))
To enable the light:
GPIO1_ENABLE |= 0x00020000;
To turn it on:
GPIO1_OUT &= 0xFFFDFFFF;
To turn it off:
GPIO1_OUT |= 0x00020000;
I am really surprised, because if you set a bit > than the 16th bit in c with binary or, gcc optimizes it to bitset while if its less than 16, it is a binary or with a word. I didn't expect it do be this smart.
<< Home