datacute / Tiny4kOLED

Library for an ATTiny85 to use an SSD1306 powered, double buffered, 128x32 pixel OLED, over I2C
MIT License
247 stars 36 forks source link

There is no documentation of the API whatsoever. #53

Open SpenceKonde opened 1 year ago

SpenceKonde commented 1 year ago

So I've forked your repo largely for the purpose of adding at least a terse API reference so that I can use it. My style of programming is to look at the API reference first. But there isn't one here. I guess we're just supposed to reverse engineer the examples? But I don't learn well that way. I'll also likely end up adding some #ifdefs if I find ways to improve performance on modern (post-2016 revolution) AVRs.

Can you tell me which of the API functions are ones that are only be used internally and which should be called by user code? (should those be made private? or is there a reason they can't be? In any event, stuff that users don't ever call don't need docs, which I feel like might drastically shrink the number of things that require documenting.

#### void begin();
#### void begin(uint8_t init_sequence_length, const uint8_t init_sequence []);
Okay where do we get the init sequences? how do we know what one to use?  Right now I only know how to use the full size ones, I'd like to  be able to use the others. 

#### void begin(uint8_t width, uint8_t height, uint8_t init_sequence_length, const uint8_t init_sequence []);
#### void begin(uint8_t xOffset, uint8_t yOffset, uint8_t width, uint8_t height, uint8_t init_sequence_length, const uint8_t init_sequence []);

#### void switchRenderFrame();
#### void switchDisplayFrame();
#### void switchFrame();
#### uint8_t currentRenderFrame();
#### uint8_t currentDisplayFrame();
I have no idea what these do

#### size_t write(uint8_t)

#### void setFont(const DCfont *font);
#### void setUnicodeFont(const DCUnicodeFont *unicode_font);
#### void setFontX2(const DCfont *font);
#### void setUnicodeFontX2(const DCUnicodeFont *unicode_font);
#### void setFontX2Smooth(const DCfont *font);
#### void setUnicodeFontX2Smooth(const DCUnicodeFont *unicode_font);
#### void setFontOnly(const DCfont *font);
#### void setSpacing(uint8_t spacing);
Is there a list of fonts?

#### void setCombineFunction(uint8_t (*combineFunc)(uint8_t, uint8_t, uint8_t));
#### uint8_t getExpectedUtf8Bytes();
#### uint16_t getCharacterDataOffset(uint8_t c);
These I have not a clue about

#### uint8_t getCharacterWidth(uint8_t c);
#### uint16_t getTextWidth(DATACUTE_F_MACRO_T *text);
These find the width of a character or string in pixels? 

#### void setCursor(uint8_t x, uint8_t y);
#### uint8_t getCursorX()
#### uint8_t getCursorY()
Cursor is where text will appear when written right? Units are pixels? (presumably to the first column of the character, upper or lower left corner?  or is it rows/columns?

#### void newLine();
#### void fill(uint8_t fill);
#### void fillToEOL(uint8_t fill);
#### void fillToEOP(uint8_t fill);
#### void fillLength(uint8_t fill, uint8_t length);
#### void clear();
#### void clearToEOL();
#### void clearToEOP();
What is the meaning of the argument to fill? 
EOL is... end of line? What is EOP? 

#### void bitmap(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, const uint8_t bitmap[]);

#### void setPages(uint8_t pages);
#### void setWidth(uint8_t width);
#### void setHeight(uint8_t height);
#### void setOffset(uint8_t xOffset, uint8_t yOffset);
#### void setRotation(uint8_t rotation);

#### void clipText(uint16_t startPixel, uint8_t width, DATACUTE_F_MACRO_T *text);
#### void clipTextP(uint16_t startPixel, uint8_t width, DATACUTE_F_MACRO_T *text);

#### void setContrast(uint8_t contrast);

#### void setEntireDisplayOn(bool enable);
For debugging?

#### void setInverse(bool enable);
#### void invertOutput(bool enable);
How are these two different? 

#### void off();
#### void on();
Hmmm, this is a real head scratcher, but I think I can figure it out

#### void setExternalIref();
#### void setInternalIref(bool bright);
???

#### void fadeOut(uint8_t interval);
#### void blink(uint8_t interval);
#### void disableFadeOutAndBlinking();
#### void enableZoomIn();
#### void disableZoomIn();
#### void scrollRight(uint8_t startPage, uint8_t interval, uint8_t endPage, uint8_t startColumn = 0x00, uint8_t endColumn = 0xFF);
#### void scrollRightOffset(uint8_t startPage, uint8_t interval, uint8_t endPage, uint8_t offset);
#### void scrollContentRight(uint8_t startPage, uint8_t endPage, uint8_t startColumn, uint8_t endColumn);
#### void scrollLeft(uint8_t startPage, uint8_t interval, uint8_t endPage, uint8_t startColumn = 0x00, uint8_t endColumn = 0xFF);
#### void scrollLeftOffset(uint8_t startPage, uint8_t interval, uint8_t endPage, uint8_t offset);
#### void scrollContentLeft(uint8_t startPage, uint8_t endPage, uint8_t startColumn, uint8_t endColumn);
#### void setVerticalScrollArea(uint8_t top, uint8_t rows);
#### void activateScroll();
#### void deactivateScroll();
These I can probably figure out with some work

#### void setColumnStartAddress(uint8_t startAddress)
#### void setMemoryAddressingMode(uint8_t mode);
#### void setColumnAddress(uint8_t startAddress, uint8_t endAddress);
#### void setPageAddress(uint8_t startPage, uint8_t endPage);
#### void setPageStartAddress(uint8_t startPage);
Are these user facing or internal?

#### void startData();
#### void sendData(const uint8_t data);
#### void repeatData(uint8_t data, uint8_t length);
#### void clearData(uint8_t length);
#### void endData();
Are these even things that should be user facing? 

#### void enableChargePump(uint8_t voltage = SSD1306_VOLTAGE_7_5);
#### void disableChargePump();
#### void setDisplayStartLine(uint8_t startLine);
#### void setSegmentRemap(uint8_t remap);
#### void setMultiplexRatio(uint8_t mux);
#### void setComOutputDirection(uint8_t direction);
#### void setDisplayOffset(uint8_t offset);
#### void setComPinsHardwareConfiguration(uint8_t alternative, uint8_t enableLeftRightRemap);
#### void setDisplayClock(uint8_t divideRatio, uint8_t oscillatorFrequency);
#### void setPrechargePeriod(uint8_t phaseOnePeriod, uint8_t phaseTwoPeriod);
#### void setVcomhDeselectLevel(uint8_t level);
#### void nop();
Same with these? These sound like internal functions? 

#### SSD1306Device(void (*wireBeginFunc)(), bool (*wireBeginTransmissionFunc)(), bool (*wireWriteFunc)(uint8_t byte), uint8_t (*wireEndTransmissionFunc)());