Skip to content

Commit

Permalink
OLED code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ishtob authored Mar 22, 2017
1 parent 65317a3 commit 30f4507
Showing 1 changed file with 6 additions and 46 deletions.
52 changes: 6 additions & 46 deletions keyboards/lets_split/ssd1306.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ bool iota_gfx_init(void) {
send_cmd2(SetChargePump, 0x14 /* Enable */);
send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);

/* Flips the display orientation 0 degrees
/// Flips the display orientation 0 degrees
send_cmd1(SegRemap | 0x1);
send_cmd1(ComScanDec);
*/
// the following Flip the display orientation 180 degrees */
/*
// the following Flip the display orientation 180 degrees
send_cmd1(SegRemap);
send_cmd1(ComScanInc);
//end flip
*/end flip
send_cmd2(SetComPins, 0x2);
send_cmd2(SetContrast, 0x8f);
send_cmd2(SetPreCharge, 0xf1);
Expand Down Expand Up @@ -379,21 +379,6 @@ void iota_gfx_flush(void) {
matrix_render(&display);
}

//#include "LUFA/Drivers/Peripheral/ADC.h"

/* Returns the battery voltage; returns the number of millivolts
static uint32_t read_battery_voltage(void) {
if (last_battery_update == 0 ||
timer_elapsed(last_battery_update) > BatteryUpdateInterval) {
ADC_Init(ADC_SINGLE_CONVERSION | ADC_PRESCALE_32);
ADC_SetupChannel(12);
vbat = 2 * 3.3 * ADC_GetChannelReading(ADC_REFERENCE_AVCC | ADC_CHANNEL12);
last_battery_update = timer_read();
}
return vbat;
} */

static void matrix_update(struct CharacterMatrix *dest,
const struct CharacterMatrix *source) {
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
Expand Down Expand Up @@ -438,18 +423,7 @@ static void render_status_info(void) {
}
#endif

// matrix_write_P(&matrix, (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? PSTR("\n NUMLOCK") : PSTR("\n"));
// matrix_write_P(&matrix, PSTR("\nBLE: "));
//#ifdef ADAFRUIT_BLE_ENABLE
// matrix_write_P(&matrix, adafruit_ble_is_connected() ? PSTR("Connected")
// : PSTR("Not Connected"));
//#endif

// char buf[40];
// snprintf(buf, sizeof(buf), "VBat: %4lumV\nLayer: 0x%04lx %s",
// read_battery_voltage(), layer_state,
// (host_keyboard_leds() & USB_LED_CAPS_LOCK) ? "CAPS" : "");
// matrix_write(&matrix, buf);
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below

char buf[40];
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
Expand All @@ -464,28 +438,14 @@ static void render_status_info(void) {
case _LOWER:
matrix_write_P(&matrix, PSTR("Lower"));
break;
case _MOUSECURSOR:
matrix_write_P(&matrix, PSTR("Mouse/Macro"));
break;
case _FNLAYER:
matrix_write_P(&matrix, PSTR("Symbols/Fn"));
break;
case _NUMLAY:
matrix_write_P(&matrix, PSTR("Numbers"));
break;
case _NLOWER:
matrix_write_P(&matrix, PSTR("Num + Lower"));
break;
case _NFNLAYER:
matrix_write_P(&matrix, PSTR("Num + FN"));
break;
case _ADJUST:
matrix_write_P(&matrix, PSTR("ADJUST"));
break;
default:
matrix_write(&matrix, buf);
}

// Host Keyboard LED Status
char led[40];
snprintf(led, sizeof(led), "\n%s %s %s",
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
Expand Down

0 comments on commit 30f4507

Please sign in to comment.