Permalink
Browse files

flashlight mode

- hold up button when powering on
  • Loading branch information...
yyyc514 committed Feb 13, 2016
1 parent 31ec05f commit 363da44b2874e6a7f93977a5dd30ec2460bbef89
Showing with 19 additions and 9 deletions.
  1. +6 −0 Arduboy.cpp
  2. +0 −9 core.cpp
  3. +13 −0 core.h
@@ -27,6 +27,12 @@ void Arduboy::begin()
{
boot(); // required

// flashlight
if(pressed(UP_BUTTON)) {
sendLCDCommand(OLED_ALL_PIXELS_ON); // smaller than allPixelsOn()
while(true) {}
}

// Audio
tunes.initChannel(PIN_SPEAKER_1);
tunes.initChannel(PIN_SPEAKER_2);
@@ -250,29 +250,20 @@ void ArduboyCore::sendLCDCommand(uint8_t command)
LCDDataMode();
}

#define OLED_PIXELS_INVERTED 0xA7 // All pixels inverted
#define OLED_PIXELS_NORMAL 0xA6 // All pixels normal

// invert the display or set to normal
// when inverted, a pixel set to 0 will be on
void ArduboyCore::invert(boolean inverse)
{
sendLCDCommand(inverse ? OLED_PIXELS_INVERTED : OLED_PIXELS_NORMAL);
}

#define OLED_ALL_PIXELS_ON 0xA5 // all pixels on
#define OLED_PIXELS_FROM_RAM 0xA4 // pixels mapped to display RAM contents

// turn all display pixels on, ignoring buffer contents
// or set to normal buffer display
void ArduboyCore::allPixelsOn(boolean on)
{
sendLCDCommand(on ? OLED_ALL_PIXELS_ON : OLED_PIXELS_FROM_RAM);
}

#define OLED_VERTICAL_FLIPPED 0xC0 // reversed COM scan direction
#define OLED_VERTICAL_NORMAL 0xC8 // normal COM scan direction

// flip the display vertically or set to normal
void ArduboyCore::flipVertical(boolean flipped)
{
13 core.h
@@ -98,6 +98,19 @@

#endif

// OLED hardware (SSD1306)

#define OLED_PIXELS_INVERTED 0xA7 // All pixels inverted
#define OLED_PIXELS_NORMAL 0xA6 // All pixels normal

#define OLED_ALL_PIXELS_ON 0xA5 // all pixels on
#define OLED_PIXELS_FROM_RAM 0xA4 // pixels mapped to display RAM contents

#define OLED_VERTICAL_FLIPPED 0xC0 // reversed COM scan direction
#define OLED_VERTICAL_NORMAL 0xC8 // normal COM scan direction

// -----

#define COLUMN_ADDRESS_END (WIDTH - 1) & 0x7F // 128 pixels wide
#define PAGE_ADDRESS_END ((HEIGHT/8)-1) & 0x07 // 8 pages high

0 comments on commit 363da44

Please sign in to comment.