// main.cpp

// https://www.digikey.com/htmldatasheets/production/2047793/0/0/1/ssd1306.html#pf25

#include <Arduino.h>
#include <Wire.h>

#define SSD1306_I2C_ADDRESS 0x3C
void sendCommand(uint8_t command);
void init2();

void sendCommand(uint8_t command) {
  Wire.beginTransmission(SSD1306_I2C_ADDRESS);
  Wire.write(0x00);
  Wire.write(command);
  Wire.endTransmission();
}

void init2() {
  Serial.println("1");
  // Initialize SSD1306
  sendCommand(0xAE); // Display off
  Serial.println("2");
  sendCommand(0xD5); // Set display clock divide ratio/oscillator frequency
  Serial.println("3");
  Serial.println("breaks now");
  sendCommand(0x80); // Set divide ratio
  Serial.println("didn't break?");
  Serial.println("4");
  sendCommand(0xA8); // Set multiplex ratio
  sendCommand(0x27); // 40 (multiplex ratio for 40 rows)
  // cut out some code to fit within char limit. more of the same
  sendCommand(0xAF); // Display on
  sendCommand(0xA7); // Display invert
  Serial.println("yippee");
}

void setup() {
  Serial.begin(115200);
  init2();
  Serial.println("init done");
}

void loop()  {}