Moar WIP
This commit is contained in:
parent
fba38ea47a
commit
a434bf4cdd
4 changed files with 29 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#include <PicoDVI.h>
|
||||
|
||||
PicoDVI dvi(320, 240, VREG_VOLTAGE_1_20, dvi_timing_640x480p_60hz);
|
||||
PicoDVI dvi(320, 240, VREG_VOLTAGE_1_20, dvi_timing_640x480p_60hz, pimoroni_demo_hdmi_cfg);
|
||||
|
||||
void setup() {
|
||||
dvi.begin();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@
|
|||
// developing on. It's not a particularly important file -- just saves some
|
||||
// copy + paste.
|
||||
|
||||
#if defined(ARDUINO)
|
||||
#include "../libdvi/dvi_serialiser.h"
|
||||
#else
|
||||
#include "dvi_serialiser.h"
|
||||
#endif
|
||||
|
||||
#ifndef DVI_DEFAULT_SERIAL_CONFIG
|
||||
#define DVI_DEFAULT_SERIAL_CONFIG pico_sock_cfg
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
#include "PicoDVI.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
PicoDVI::PicoDVI(uint16_t w, uint16_t h, vreg_voltage v, const struct dvi_timing &t) {
|
||||
PicoDVI::PicoDVI(uint16_t w, uint16_t h, vreg_voltage v, const struct dvi_timing &t, const struct dvi_serialiser_cfg &c) {
|
||||
framebuf_width = w;
|
||||
framebuf_height = h;
|
||||
timing = &t;
|
||||
voltage = v;
|
||||
cfg = &c;
|
||||
}
|
||||
|
||||
PicoDVI::~PicoDVI(void) {
|
||||
|
|
@ -14,6 +16,23 @@ PicoDVI::~PicoDVI(void) {
|
|||
|
||||
bool PicoDVI::begin(void) {
|
||||
if ((framebuf = (uint16_t *)malloc(framebuf_width * framebuf_height * sizeof(uint16_t)))) {
|
||||
vreg_set_voltage(voltage);
|
||||
sleep_ms(10);
|
||||
#ifdef RUN_FROM_CRYSTAL
|
||||
set_sys_clock_khz(12000, true);
|
||||
#else
|
||||
// Run system at TMDS bit clock
|
||||
set_sys_clock_khz(timing->bit_clk_khz, true);
|
||||
#endif
|
||||
|
||||
dvi0.timing = timing;
|
||||
//dvi0.ser_cfg = DVI_DEFAULT_SERIAL_CONFIG;
|
||||
memcpy(&dvi0.ser_cfg, cfg, sizeof dvi0.ser_cfg);
|
||||
#if 0
|
||||
dvi0.scanline_callback = core1_scanline_callback;
|
||||
dvi_init(&dvi0, next_striped_spin_lock_num(), next_striped_spin_lock_num());
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include "pico/stdlib.h" // In Pico SDK
|
||||
#include "hardware/vreg.h" // In Pico SDK
|
||||
#include "libdvi/dvi.h" // Requires soft link in src to ../software/libdvi
|
||||
#include "libdvi/dvi_timing.h"
|
||||
#include "../software/include/common_dvi_pin_configs.h"
|
||||
// Also, one must build PicoDVI via the usual route (mkdir build & cmake, etc.)
|
||||
// and copy dvi_serialiser.pio.h to libdvi. 'build' is in .gitignore and
|
||||
// doesn't get included w/push.
|
||||
|
||||
class PicoDVI {
|
||||
public:
|
||||
PicoDVI(uint16_t w, uint16_t h, vreg_voltage v, const struct dvi_timing &t);
|
||||
PicoDVI(uint16_t w, uint16_t h, vreg_voltage v, const struct dvi_timing &t, const struct dvi_serialiser_cfg &c);
|
||||
~PicoDVI(void);
|
||||
bool begin(void);
|
||||
private:
|
||||
|
|
@ -19,4 +21,5 @@ private:
|
|||
struct dvi_inst dvi0;
|
||||
const struct dvi_timing *timing;
|
||||
vreg_voltage voltage;
|
||||
const struct dvi_serialiser_cfg *cfg;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue