Skip to content

Instantly share code, notes, and snippets.

View shabaz123's full-sized avatar

shabaz123

View GitHub Profile
/************************************************************************
* ble_handler.cpp
* shabaz - oct 2023
* this file encapsulates the BLE related functions used in the project
************************************************************************/
// includes
#include "ble_handler.h"
#include "config_gatt.h"
#include "btstack.h"
/********* animation test *************
* tested with an Arduino Mega
**************************************/
#include <Servo.h>
#include <animationTools.h>
// ********** definitions ************************
// total number of servos
#define SERVO_TOTAL 6
// enumerate the servos from 0 to SERVO_TOTAL-1
@shabaz123
shabaz123 / btn_pwr_ctrl.c
Last active March 9, 2024 04:20
MSP430 code (MSP430G2452) to implement a push-button power on/off system
/***********************************************
* Button Power Control
*
* rev 1 - shabaz - December 2023
* This code expects a push-button wired to GPIO pin P1.2 and VCC.
* The output is on pin P2.3
* The delays for turn-on and turn-off are separately configurable
* (see the definitions below)
* *********************************************/
Details: An error occurred while executing command: 'host-status --ide-path=/root/.cache/JetBrains/RemoteDev/dist/5e0b8d8cdf7c1_CLion-2023.3.1 --project-path=/IdeaProjects/project1' Exit code: 1
2024-01-12 01:35:33,005 INFO sh -c "uname -sm"
stdout:
Linux x86_64
2024-01-12 01:35:33,276 INFO sh -c "echo $SHELL"
FROM alpine:3.17.0
# Install toolchain
RUN apk update && \
apk upgrade && \
apk add git \
python3 \
py3-pip \
cmake \
build-base \
@shabaz123
shabaz123 / FindLibUSB.cmake
Created January 15, 2024 23:42
cmake file used for building libmirisdr-4
# FindLibUSB.cmake - Try to find the Hiredis library
# Once done this will define
#
# LIBUSB_FOUND - System has libusb
# LIBUSB_INCLUDE_DIR - The libusb include directory
# LIBUSB_LIBRARIES - The libraries needed to use libusb
# LIBUSB_DEFINITIONS - Compiler switches required for using libusb
find_path(LIBUSB_INCLUDE_DIR
NAMES libusb.h
PATHS
# de_embed.py - VNA Measurement De-Embedding
# rev 1 - shabaz - January 2024
# This code reads three .s1p files, (for S11 Open, Short, and for the DUT).
# Then, the DUT is de-embedded using the Open and Short files.
# The corrected DUT is saved to a new file, and is also displayed on a Smith chart.
import numpy as np
import matplotlib.pyplot as plt
import skrf as rf
from scipy.optimize import minimize
@shabaz123
shabaz123 / elec_comp.py
Created January 29, 2024 04:14
Electrical Length Compensation for VNA Measurements
# elec_comp.py - Electrical length compensation
# rev 1 - shabaz - January 2024
# based on code by Keisuke Kawahara
# This code reads two .s1p files, (for S11 Open and DUT).
# Then, the electrical length is calculated from the Open file,
# and applied to the DUT file. The corrected DUT file is saved to a new file,
# and is also displayed on a Smith chart.
import skrf as rf
import matplotlib.pyplot as plt
@shabaz123
shabaz123 / plot_ind.py
Created January 31, 2024 19:05
Charts inductance from .s1p Touchstone file (from S11 Reflection Coefficients)
# plot_ind.py - Reads a .s1p file and plots the inductance vs frequency on a graph
# uses DraggableMarker class from https://stackoverflow.com/questions/43982250/draggable-markers-in-matplotlib
# rev 1 - shabaz - January 2024
import skrf as rf
import numpy as np
import matplotlib.pyplot as plt
import sys
# set the filename
@shabaz123
shabaz123 / main.py
Created May 28, 2024 00:13
remote control example for up/down volume control
# sny_ir_receiver.py - A Pi Pico MicroPython based SNY IR receiver
# rev 1 - shabaz - October 2023
# modified for controlling up/down outputs - shabaz - May 2024
import time
from machine import Pin
from rp2 import asm_pio, PIO, StateMachine
# IR sensor pin
ir_pin = Pin(15, Pin.IN, Pin.PULL_UP)