Я загрузил пример pio_st7789_lcd из pico-examples (https://github.com/raspberrypi/pico-examples) в VSC, и он отлично работает на моем Pico W с подключенным модулем ST7789 128x160. Но раньше я работал только с микроконтроллерами, используя Arduino IDE и немного MicroPython в Thonny. Может ли кто-нибудь помочь мне с примером кода на C++ или ссылкой здесь, как просто отобразить текст или данные на дисплее?
Это пример кода, который вращает логотип RP на экране. :
#include
#include
#include "pico/stdlib.h"
#include "hardware/pio.h"
#include "hardware/gpio.h"
#include "hardware/interp.h"
#include "st7789_lcd.pio.h"
#include "raspberry_256x256_rgb565.h"
// Tested with the parts that have the height of 240 and 320
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 160
#define IMAGE_SIZE 256
#define LOG_IMAGE_SIZE 8
#define PIN_DIN 0 // Pin 1
#define PIN_CLK 1 // Pin 2
#define PIN_CS 2 // Pin 4
#define PIN_DC 3 // Pin 5
#define PIN_RESET 4 // Pin 6
#define PIN_BL 5 // Pin 7
#define SERIAL_CLK_DIV 1.f
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
// Format: cmd length (including cmd byte), post delay in units of 5 ms, then cmd payload
// Note the delays have been shortened a little
static const uint8_t st7789_init_seq[] = {
1, 20, 0x01, // Software reset
1, 10, 0x11, // Exit sleep mode
2, 2, 0x3a, 0x55, // Set colour mode to 16 bit
2, 0, 0x36, 0x00, // Set MADCTL: row then column, refresh is bottom to top ????
5, 0, 0x2a, 0x00, 0x00, SCREEN_WIDTH >> 8, SCREEN_WIDTH & 0xff, // CASET: column addresses
5, 0, 0x2b, 0x00, 0x00, SCREEN_HEIGHT >> 8, SCREEN_HEIGHT & 0xff, // RASET: row addresses
1, 2, 0x21, // Inversion on, then 10 ms delay (supposedly a hack?)
1, 2, 0x13, // Normal display on, then 10 ms delay
1, 2, 0x29, // Main screen turn on, then wait 500 ms
0 // Terminate list
};
static inline void lcd_set_dc_cs(bool dc, bool cs) {
sleep_us(1);
gpio_put_masked((1u
Подробнее здесь: https://stackoverflow.com/questions/792 ... -pi-pico-w
Настройка TFT-дисплея ST7789 на C++ для Raspberry Pi Pico W ⇐ C++
Программы на C++. Форум разработчиков
-
Anonymous
1734162340
Anonymous
Я загрузил пример pio_st7789_lcd из pico-examples (https://github.com/raspberrypi/pico-examples) в VSC, и он отлично работает на моем Pico W с подключенным модулем ST7789 128x160. Но раньше я работал только с микроконтроллерами, используя Arduino IDE и немного MicroPython в Thonny. Может ли кто-нибудь помочь мне с примером кода на C++ или ссылкой здесь, как просто отобразить текст или данные на дисплее?
Это пример кода, который вращает логотип RP на экране. :
#include
#include
#include "pico/stdlib.h"
#include "hardware/pio.h"
#include "hardware/gpio.h"
#include "hardware/interp.h"
#include "st7789_lcd.pio.h"
#include "raspberry_256x256_rgb565.h"
// Tested with the parts that have the height of 240 and 320
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 160
#define IMAGE_SIZE 256
#define LOG_IMAGE_SIZE 8
#define PIN_DIN 0 // Pin 1
#define PIN_CLK 1 // Pin 2
#define PIN_CS 2 // Pin 4
#define PIN_DC 3 // Pin 5
#define PIN_RESET 4 // Pin 6
#define PIN_BL 5 // Pin 7
#define SERIAL_CLK_DIV 1.f
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
// Format: cmd length (including cmd byte), post delay in units of 5 ms, then cmd payload
// Note the delays have been shortened a little
static const uint8_t st7789_init_seq[] = {
1, 20, 0x01, // Software reset
1, 10, 0x11, // Exit sleep mode
2, 2, 0x3a, 0x55, // Set colour mode to 16 bit
2, 0, 0x36, 0x00, // Set MADCTL: row then column, refresh is bottom to top ????
5, 0, 0x2a, 0x00, 0x00, SCREEN_WIDTH >> 8, SCREEN_WIDTH & 0xff, // CASET: column addresses
5, 0, 0x2b, 0x00, 0x00, SCREEN_HEIGHT >> 8, SCREEN_HEIGHT & 0xff, // RASET: row addresses
1, 2, 0x21, // Inversion on, then 10 ms delay (supposedly a hack?)
1, 2, 0x13, // Normal display on, then 10 ms delay
1, 2, 0x29, // Main screen turn on, then wait 500 ms
0 // Terminate list
};
static inline void lcd_set_dc_cs(bool dc, bool cs) {
sleep_us(1);
gpio_put_masked((1u
Подробнее здесь: [url]https://stackoverflow.com/questions/79280272/setting-up-a-st7789-tft-display-in-c-for-raspberry-pi-pico-w[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия