diff --git a/BackBuffer.c b/BackBuffer.c index fa61d97..9a7caa4 100644 --- a/BackBuffer.c +++ b/BackBuffer.c @@ -64,4 +64,22 @@ void draw_bezier(const int *points_x, const int *points_y, size_t num_points, ui // Установка пикселя на экране set_pixel((int)(x + 0.5f), (int)(y + 0.5f), color); } +} + +void grid (uint16_t x, uint16_t y, uint16_t step, uint16_t color){ + for (uint16_t vgrid = x; vgrid < WIDTH; vgrid+=step) + { + for (uint16_t hgrid = 0; hgrid< HEIGHT; hgrid++) + { + set_pixel(vgrid,hgrid,reverse(color)); + } + } + + for (uint16_t hgrid = y; hgrid< HEIGHT; hgrid+=step) + { + for (uint16_t vgrid = 0; vgrid < WIDTH; vgrid++) + { + set_pixel(vgrid,hgrid,reverse(color)); + } + } } \ No newline at end of file diff --git a/BackBuffer.h b/BackBuffer.h index db1e691..a5a0d92 100644 --- a/BackBuffer.h +++ b/BackBuffer.h @@ -16,5 +16,5 @@ void draw_bezier(const int *points_x, const int *points_y, size_t num_points, ui unsigned short reverse(unsigned short x); void set_pixel(uint16_t x, uint16_t y, uint16_t color); void generate_sine_wave_points(uint16_t num_points, int amplitude, float frequency, int offset_x, int offset_y, float phase_shift); - +void grid (uint16_t x, uint16_t y, uint16_t step, uint16_t color); #endif // __BACKBUFFER_H__ \ No newline at end of file diff --git a/main.c b/main.c index ceedd44..4fafe93 100644 --- a/main.c +++ b/main.c @@ -26,6 +26,7 @@ int main() { data = multicore_fifo_pop_blocking(); fillBufer(frame_buffer,reverse(0x4A69));// + grid(20,20,40,0x634d); generate_sine_wave_points(num_points, 50, freq, 0, HEIGHT / 2,x); draw_string(20,110,L"Кириллица работает!!!",0b1111111111111111); // draw_string(50,130,L"Does Latin work?",0b0000000000011111); //Does Latin work? @@ -36,13 +37,13 @@ int main() { { if (freq<=0.0){ minmax=false;} - else freq-=0.005; + else freq-=0.05; } else { if (freq>=10.0){ minmax=true;} - else freq+=0.005; + else freq+=0.05; }