https://github.com/doohinkus/daisy-seed-oled
Example of using OLED 1306 via I2C (2 Wire) with Electrosmith Daisy Seed music microcontroller
https://github.com/doohinkus/daisy-seed-oled
daisy-seed i2c oled-ssd1306
Last synced: about 2 months ago
JSON representation
Example of using OLED 1306 via I2C (2 Wire) with Electrosmith Daisy Seed music microcontroller
- Host: GitHub
- URL: https://github.com/doohinkus/daisy-seed-oled
- Owner: doohinkus
- Created: 2024-09-02T02:30:01.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-07T17:06:20.000Z (8 months ago)
- Last Synced: 2024-09-08T18:31:24.263Z (8 months ago)
- Topics: daisy-seed, i2c, oled-ssd1306
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Daisy Seed OLED 1306 I2C/ 2 Wire (gnd, vcc, slc, sda)
Example of using OLED with Electrosmith Daisy Seed music microcontroller.
### Wiring
### Fork / Clone ( https://github.com/electro-smith/DaisyExamples/tree/master )
### Copy OLED example
Use the helper script to copy the OLED example into a new folder.```shell
./helper.py copy seed/IC2_OLED --source seed/OLED
```
Change directories into the new folder:
```shell
cd ./seed/IC2OLED
```
### Config the copied OLED code
```cpp
#include
#include
#include "daisy_seed.h"
#include "dev/oled_ssd130x.h"using namespace daisy;
/** Typedef the OledDisplay to make syntax cleaner below
* This is a 2Wire I2C Transport controlling an 128x64 sized SSDD1306
*
* There are several other premade test
*/
using MyOledDisplay = OledDisplay;DaisySeed hw;
MyOledDisplay display;int main(void)
{
uint8_t message_idx;
hw.Configure();
hw.Init();/** Configure the Display */
MyOledDisplay::Config display_config;display_config.driver_config.transport_config.i2c_address = 0x3C;
display_config.driver_config.transport_config.i2c_config.periph = I2CHandle::Config::Peripheral::I2C_1;
display_config.driver_config.transport_config.i2c_config.speed = I2CHandle::Config::Speed::I2C_100KHZ;
display_config.driver_config.transport_config.i2c_config.mode = I2CHandle::Config::Mode::I2C_MASTER;
display_config.driver_config.transport_config.i2c_config.pin_config.scl = {DSY_GPIOB, 8};
display_config.driver_config.transport_config.i2c_config.pin_config.sda = {DSY_GPIOB, 9};display.Init(display_config);
/** And Initialize */
display.Init(display_config);message_idx = 0;
char strbuff[128];
while(1){
System::Delay(500);
switch(message_idx){
case 0: sprintf(strbuff, " Testing. . ."); break;
case 1: sprintf(strbuff, " Daisy. . ."); break;
case 2: sprintf(strbuff, " 1. . ."); break;
case 3: sprintf(strbuff, " 2. . ."); break;
case 4: sprintf(strbuff, " 3. . ."); break;
default: break;
}
message_idx = (message_idx + 1) % 5;display.SetCursor(0, 0);
display.WriteString(strbuff, Font_7x10, true);
display.Update();
}
}```
### Compile
```shell
make .
```
### Reset seed
Press both white buttons.
### Upload
```shell
make program-dfu
```## Why DSY_GPIOB, 8 and DSY_GPIOB, 9?
```c++
display_config.driver_config.transport_config.i2c_config.pin_config.scl = {DSY_GPIOB, 8};
display_config.driver_config.transport_config.i2c_config.pin_config.sda = {DSY_GPIOB, 9};
```## Why Ox3C?
