code DIT: Electronics - Adafruit FeatherWing OLED Library

This library implements service functions that make working with the Adafruit FeatherWing OLED more convenient.

It also can serve as a reference implementation on how to use the DIT SSD1306 library.

Hardware

These are the physical properties of the Adafruit FeatherWing OLED:

If you stack the Adafruit FeatherWing OLED on top of a Adafruit FeatherM0 (WiFi) this is how the buttons of the FeatherWing OLED are connected to the Atmel SAMD21G18A MCU used on the FeatherWing M0:

ATSAMD21G18 EIC_Line* JP2/3 SSD1306
PA07 7 Pos. 08 SW2 !Button A active low, no external pull-up resistor
PA20 4 Pos. 09 SW4 !Button B active low, 100k external pull-up resistor
PA15 15 Pos. 10 SW3 !Button C active low, no external pull-up resistor
*EIC = External Interrupt Controller

Global Type Declarations

Button event handler function prototype

typedef void FeatherWing_OLED_button_event_handler( void );

Button event handlers management data structure type

struct FeatherWing_OLED_Buttons_Event_Handlers {
        FeatherWing_OLED_button_event_handler *button_a_on_pressed ;
        FeatherWing_OLED_button_event_handler *button_a_on_released;
        FeatherWing_OLED_button_event_handler *button_b_on_pressed ;
        FeatherWing_OLED_button_event_handler *button_b_on_released;
        FeatherWing_OLED_button_event_handler *button_c_on_pressed ;
        FeatherWing_OLED_button_event_handler *button_c_on_released;
};

Global Variables

Button event handlers management structure

  • Register your button event handler callbacks here.
  • Make sure to unregister your event handler callbacks here, by setting the fields to NULL, when done.

struct FeatherWing_OLED_Buttons_Event_Handlers featherWing_OLED_buttons_event_handlers;

Functions

featherWing_OLED_init() Initialize the FeatherWing_OLED display connected to the i2c SERCOM module.
featherWing_OLED_init_buttons() Enable the buttons on the FeatherWing_OLED display connected to the i2c SERCOM module.
featherWing_OLED_on() Switch the ON state of the OLED display.
featherWing_OLED_update() Update the tiles of the OLED with the tiles of the framebuffer, depending on there dirty state in the framebuffer.
featherWing_OLED_update_all() Update all tiles of the OLED with the tiles of the framebuffer, independent of there dirty state in the framebuffer.

Files in this library

Adafruit_FeatherWing_OLED.h Declarations for the FeatherWingOLED library
Adafruit_FeatherWing_OLED.c Implementation of the FeatherWingOLED library

Notes

  1. Since only the I2C interface of the SSD1306 display driver chip used is connected on the Adafruit FeatherWing OLED, we programmed the Com_Driver_i2c_master dependency directly into the library, instead of using some form of dependency injection.
  2. The implementation uses the generic Framebuffer declaration.
    Still you have to make sure, that it's user_data entry points to a Framebuffer_SSD1306, since that is the controller used on the FeatherWing_OLED.

Examples

See the 07 SSD1306 OLED FeatherM0 ASF Tutorial on how to use the library.