vha3 / hunter-adams-rp2040-demos Goto Github PK
View Code? Open in Web Editor NEWDemo code for the Raspberry Pi Pico
Demo code for the Raspberry Pi Pico
VGA_Graphics/Mandelbrot_Set/mandelbrot_fixvfloat.c
Zre_sq + Zim_sq
can overflow, resulting in artifacts. if ((unsigned)(Zre_sq + Zim_sq) > (unsigned)FOURfix28) break;
(or using fix27, but losing precision).
However some points remain for which the iterates will overflow.
Probably better to check for potential overflow before the escape check (affects only iterates outside the circle)
if (Zre < -TWOfix28 || Zre > TWOfix28) break;
if (Zim < -TWOfix28 || Zim > TWOfix28) break;
if ((unsigned)(Zre_sq + Zim_sq) > (unsigned)FOURfix28) break;
In principle the rectangle check is an escape check, so it would also work (the rectangle contains the circle), but the contour lines outside the Mandelbrot set would look different.
I had to restart windows after some of the installation to get around an error when trying to run the command cmake -G "NMake Makefiles" ..
It might have been Cmake or something that needed a restart after installation. Worth adding a restart step to the instructions. Thanks so much for making these instructions publicly available.
I'm having a hard fault on the serial bootloader application.
Running the debugger, it seems to be OK with parsing the "bad checksum" data that the Python program sends initially. But as soon as it starts sending real data from the bootloader_blinky hex file, it goes into hard fault.
I've traced it down to the "transformLine" function, and there is something that it doesn't like about this code, but I don't know why:
for (i=0; i<(char_count>>1); i++) {
// Get the top nibble (careful of ASCII offsets)
if (buffer[i<<1] < 'A') top = buffer[i<<1] - '0' ;
else top = buffer[i<<1] - 'A' + 10 ;
// Get the bottom nibble (careful of ASCII offsets)
if (buffer[(i<<1)+1] < 'A') bottom = buffer[(i<<1)+1] - '0' ;
else bottom = buffer[(i<<1)+1] - 'A' + 10 ;
// Mask the two nibbles into a byte
buffer[i] = (top<<4) | bottom ;
I will keep digging.
This code is almost exactly what I need for a project I am working on. Thanks!
However, I don't want to drive 640x480. Instead, I would like an effective resolution of 320x240. Of course, the actual VGA timing can stay at 640x480, I just need to draw "fat pixels" (x2 on X/Y).
I have tried reducing the buffer by 1/4, changing the timing, etc. but nothing seems to work.
For example:
#define RGB_ACTIVE 159 // (horizontal active)/2 - 1
...
pull block ; Pull from FIFO to OSR (only once)
mov y, osr ; Copy value from OSR to y scratch register
.wrap_target
set pins, 0 ; Zero RGB pins in blanking
mov x, y ; Initialize counter variable
wait 1 irq 1 [3] ; Wait for vsync active mode (starts 5 cycles after execution)
colorout:
pull block ; Pull color value
out pins, 3 [2] ; Push out to pins (first pixel)
out pins, 3 [1] ; Push out to pins (next pixel)
jmp x-- colorout ; Stay here thru horizontal active mode
.wrap
Then, I try drawing a white rect and it only fills 1/4 of the screen. I would expect it to be full screen.
fillRect(0, 0, 319, 239, WHITE);
Drawing a single pixel is obviously still a 640x480 pixel.
What am I doing wrong?
Thanks!
Thanks for the nice lectures!
Your escape check in
VGA_Graphics/Mandelbrot_Set/mandelbrot_fixvfloat.c
should be |z|^2 > 4
, and not
The parameter c=-2
belongs to the Mandelbrot set. For this parameter the critical point is pre-periodic (0 -> -2 -> 2 -> 2 -> ...), so it is bounded and the corresponding Julia set is connected (it is the interval [-2,2] on the real axis).
If the orbit gets outside of radius 2, you can show that it escapes to infinity, i.e. that the parameter is not in the Mandelbrot set.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.