Skip to content

Instantly share code, notes, and snippets.

@jancumps
jancumps / batterymonitor.ino
Created October 19, 2014 19:29
FuelTank boosterpack monitoring with Arduino and LCD shield (Texas Instruments, element14, SainSmart)
/*
Battery Monitor
Sends queries over i2c to the fueltank boosterpack;
Shows results on lcd
=========================================================================
Contains code from the HelloWorld example of the LiquidCrystal library:
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
@jancumps
jancumps / menu.c
Created May 2, 2016 16:14
mini menu system for Educational BoosterPack and Hercules LaunchPad
/*
* menu.c
*
* Created on: 1 mei 2016
* Author: jancu
*/
#include "menu.h"
#include "HX8353E.h"
#include <stdbool.h>
#include <SPI.h>
#include <LCD_screen.h>
#include <LCD_screen_font.h>
#include <LCD_utilities.h>
#include <Screen_HX8353E.h>
#include <Terminal12e.h>
#include <Terminal6e.h>
#include <Terminal8e.h>
#include <scpiparser.h>
#include <Arduino.h>
#define NUMBEROFCHANNELS 2
struct scpi_parser_context ctx;
scpi_error_t identify(struct scpi_parser_context* context, struct scpi_token* command);
scpi_error_t reset(struct scpi_parser_context* context, struct scpi_token* command);
scpi_error_t get_digital_1(struct scpi_parser_context* context, struct scpi_token* command);
/*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
// Based on LAB 6: Blinking LEDs with RPMsg from Linux User Space.
// http://processors.wiki.ti.com/index.php/PRU_Training:_Hands-on_Labs#LAB_6:_Blinking_LEDs_with_RPMsg_from_Linux_User_Space
/*
* Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
#!/bin/bash
PRU_STEPPER_link="$(readlink -f /home/debian/bin/bb_PRU_STEPPER.out)"
fw0_link=${PRU_STEPPER_link}
#include <SPI.h>
#include <Ethernet.h>
void setup() {
/* https://www.arduino.cc/en/Guide/MKRETHShield
* As the W5500 and SD card share the SPI bus,
* only one at a time can be active.
* If you are using both peripherals in your program, this should be taken care of by the corresponding libraries.
* If you're not using one of the peripherals in your program, however, you'll need to explicitly deselect it.
* To do this with the SD card, set pin 4 as an output and write a high to it.
@jancumps
jancumps / types_pkg.vhd
Last active September 23, 2021 19:50
collection of functions used by Catalin Baetoniu for The Art of FPGA Design. https://www.element14.com/community/groups/fpga-group/blog/2018/07/11/the-art-of-fpga-design
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.all;
use IEEE.math_real.all;
package TYPES_PKG is
type BOOLEAN_VECTOR is array(NATURAL range <>) of BOOLEAN; -- this type is already defined in VHDL-2008, use only for VHDL-93 implementations
type INTEGER_VECTOR is array(NATURAL range <>) of INTEGER; -- this type is already defined in VHDL-2008, use only for VHDL-93 implementations
type UNSIGNED_VECTOR is array(INTEGER range <>) of UNSIGNED; -- works only in VHDL-2008
type SIGNED_VECTOR is array(INTEGER range <>) of SIGNED; -- works only in VHDL-2008
@jancumps
jancumps / pwm.vhd
Last active May 5, 2024 08:28
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,