playground project testing RP2040 (Pico) with SSD1309 2.42" OLED from AliExpress
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
pico-ssd1309-test/main.c

92 lines
1.8 KiB

#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "pico/binary_info.h"
#include "hardware/spi.h"
#include "framebuffer.h"
#include "fb_text.h"
#include "oled.h"
#define SSD1309_HEIGHT 64
const uint LED_PIN = 25;
/* Picotool info */
bi_decl(bi_program_description("OLED demo"))
bi_decl(bi_1pin_with_name(LED_PIN, "Blink LED"))
int main() {
stdio_init_all();
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
oled_init();
#define ZIR_W 12
#define ZIR_H 24
const uint8_t zirafa[(ZIR_H/8) * ZIR_W] = {
// levo
0b10000000,
0b01000000,
0b00100000,
0b00010000,
0b00001000,
0b00000100,
0b00000010,
0b00011001,
0b00011111,
0b11111000,
0b00011111,
0b00001000,
//
0b10000000,
0b01000000,
0b00100000,
0b00010000,
0b00001000,
0b00000100,
0b00000010,
0b00000001,
0b10000000,
0b11111111,
0b00100000,
0b00010000,
//
0b00110000,
0b10001000,
0b11111000,
0b00011000,
0b11111000,
0b10011000,
0b00011000,
0b10011000,
0b11111000,
0b00011111,
0b11111000,
0b10000000,
};
fb_clear();
fb_bitmap(5, 5, ZIR_W, ZIR_H, zirafa, 1);
fb_text(40, 35, "MEOW", FONT_DOUBLE, 1);
fb_text(50, 20, "meow", FONT_DOUBLE, 1);
fb_frame(0, 0, 128, 64, 2, 1);
fb_blit();
while (1) {
oled_invert(true);
gpio_put(LED_PIN, 0);
sleep_ms(1000);
oled_invert(false);
gpio_put(LED_PIN, 1);
//puts("Hello World\n");
sleep_ms(1000);
}
}