- wait until (gpio_clk'event and gpio_clk='1');
- if (spi_clk='1' and spiclk_old_lvl='0') then --rising edge, faze cteni
+ --position is obtained on rising edge -> we should write it on falling edge
+ wait until (gpio_clk'event and gpio_clk='0');
+
+ spiclk_old(0)<=spi_clk;
+ spiclk_old(1)<=spiclk_old(0);
+
+ ce0_old(0)<=gpio7;
+ ce0_old(1)<=ce0_old(0);
+
+ if (spiclk_old="01") then --rising edge, faze cteni