Skip to content

Instantly share code, notes, and snippets.

@jancumps
jancumps / Lora_LED_ON_OFF.ino
Created January 13, 2024 16:10
The Things Network (TTN) replacement example. Alternative for the no longer available LoRa LED/ON off basic sketch for Arduino MKR WAN 1310.
/*
Lora_LED_ON_OFF: The Things Network testsketch that integrates with their payload formatters and tutorials
Altrnative for the no longer available LoRa LED/ON off basic sketch:
Please refer to https://create.arduino.cc/editor/FT-CONTENT/043f42fb-2b04-4cfb-a277-b1a3dd5366c2/preview
Jan Cumps 15-03-2024
With code from:
Lora Send And Receive
@jancumps
jancumps / bufferfiller.cpp
Created December 21, 2023 11:50
mock example for a sensor that works with stl containers and traditional C arrays as buffer
#include <algorithm>
#include <span>
#include <iterator>
#include <numeric>
#include <stdint.h>
#include <stdio.h>
#define SAMPLES (10)
@jancumps
jancumps / FIR Acceleration on PYNQ.ipynb
Last active November 21, 2021 11:43 — forked from fpgadeveloper/FIR Acceleration on PYNQ.ipynb
How to accelerate a Python function with PYNQ
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jancumps
jancumps / create_project.tcl
Last active January 8, 2022 17:42
Vivado create a Zynq project with common AXI reset
set projectname myProject
set projectroot C:/xilinx_vivado_prj
create_project $projectname $projectroot/$projectname -part xc7z020clg400-1
set_property board_part tul.com.tw:pynq-z2:part0:1.0 [current_project]
set_property target_language VHDL [current_project]
create_bd_design "design_1"
startgroup
create_bd_cell -type ip -vlnv xilinx.com:ip:processing_system7:5.5 processing_system7_0
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity variable_clock is
Port (
clk_i : in STD_LOGIC;
resetn_i : in STD_LOGIC;
ticks_i : in STD_LOGIC_VECTOR (7 downto 0);
clk_o : out STD_LOGIC
@jancumps
jancumps / collect_pynq_artifacts.tcl
Created August 13, 2021 19:51
collect and name the .hwh and .bit file from a Vivado project for deploy on Pynq. Execute from IDE or Tcl Shell with the project open.
set project_path [get_property directory [current_project]]
set project_file [file rootname $project_path]
set __project [current_project]
set hw_dir [file dirname [get_files *.hwh]]
set hwhandoff [glob [file join $hw_dir *.hwh]]
set bitstream [glob [file join $project_path $__project.runs impl_1 *.bit]]
#gather in the .prj directory
file copy -force $hwhandoff $project_file.hwh
file copy -force $bitstream $project_file.bit
@jancumps
jancumps / quadrature_oscillator.vdh
Created August 10, 2021 14:11
vhdl Quadrature Oscillator. 3 implementations. The one from Jon Clift is active, two others commented out.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity quadrature_oscillator is
Port (
i_clk: in std_logic;
i_nReset: in std_logic;
o_outputs: out std_logic_vector (3 downto 0)
);
@jancumps
jancumps / memory_ram.vhd
Created August 10, 2021 14:07
vhdl RAM memory, adapted to 1024 addresses, 12 bit data, from Michael Kellett
-- from Micheal Kellett: https://www.element14.com/community/groups/fpga-group/blog/2021/07/31/cheap-cyclone-10
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.NUMERIC_STD.all;
entity mem_inf_sp_1024_12 is
port(
we : in STD_LOGIC;
@jancumps
jancumps / quadrature_decoder.vhd
Created August 10, 2021 14:01
VHDL Quadrature (scrollwheel) decoder, based on a design of hackmeister.dk and fpga4fun.com
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 03.07.2021 21:17:08
-- Design Name:
-- Module Name: quadrature_decoder - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
@jancumps
jancumps / pwm.vhd
Last active April 22, 2023 12:17
vhdl PWM with dead band. Based on PWM example code from XESS Corp
--**********************************************************************
-- Copyright (c) 2011-2014 by XESS Corp <http://www.xess.com>.
-- All rights reserved.
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 3.0 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,