Skip to content

Instantly share code, notes, and snippets.

idt12312 idt12312

View GitHub Profile
@idt12312
idt12312 / load_screen.py
Last active Jun 18, 2020
Save screen image of RIGOL MSO5000 series oscilloscope
View load_screen.py
import visa
import argparse
from PIL import Image
import io
argparser = argparse.ArgumentParser()
argparser.add_argument('-a', '--address', required=True, help='VISA address like "TCPIP::{ipaddress}::INSTR"')
argparser.add_argument('-o', '--output', help='Output file name (default: "screen.png")', default='screen.png')
args = argparser.parse_args()
@idt12312
idt12312 / save_as_csv.py
Last active Jun 9, 2020
Load waveform and save it as csv file for RIGOL MSO5000 series oscilloscope
View save_as_csv.py
import visa
import argparse
import csv
def load_waveform(chidx, points_request):
inst.write(f':WAV:SOUR CHAN{chidx}')
inst.write(':WAV:MODE RAW')
inst.write(f':WAV:POIN {points_request}')
inst.write(':WAV:FORM BYTE')
@idt12312
idt12312 / PIDController.h
Last active Sep 7, 2018
This is C++ implementation of MATLAB's 2DOF discrete time PID controller
View PIDController.h
#ifndef PIDCONTROLLER_H_
#define PIDCONTROLLER_H_
class PIDController
{
public:
struct Param
{
float P;
float I;
View kicad3.py
import kicad_tools
#抵抗とLEDを正規表現を使って検索し、リストにする
rList = kicad_tools.findModulesByRe("R\d+")
ledList = kicad_tools.findModulesByRe("D\d+")
#LEDを(100mm,100mm)を始点に(10mm,0)間隔で直線上に並べる
kicad_tools.arrangeInLine(ledList, (100,100), (10,0))
#抵抗を(100mm,150mm)を始点に3x4行列のように並べる
View kicad2.py
#R1を90度回転する
r1.SetOrientation(90*10)
#R1を(100mm, 100mm)に移動する
r1.SetPosition(pcbnew.wxPointMM(100,100))
#R1を現在位置から(50mm, 0mm)だけ移動する
r1.Move(pcbnew.wxPointMM(50,0))
View kicad1.py
import pcbnew
#pcbnewで開いている基板(BORAD)への参照を取得する
board = pcbnew.GetBoard()
#基板上の"R1"というリファレンスを持つ部品(MODULE)への参照を取得する
r1 = board.FindModuleByReference("R1")
#r1(MODULE)のもつリファレンスを文字列として取得する
print r1.GetReference()
@idt12312
idt12312 / TaskBase.h
Created Feb 1, 2017
FreeRTOSのタスクを楽に扱うクラス
View TaskBase.h
#ifndef TASK_TASKBASE_H_
#define TASK_TASKBASE_H_
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
class TaskBase {
@idt12312
idt12312 / led_blink_systick.s
Last active Dec 25, 2016
アセンブリでSystickを使ってLチカをする : Nucleo STM32F103
View led_blink_systick.s
@idt12312
idt12312 / led_blink.s
Last active Dec 25, 2016
アセンブリでLチカをする : Nucleo STM32F103
View led_blink.s
View kicad_tools.py
# -*- coding: utf-8 -*-
import pcbnew
import re
import math
(
HORIZON_THEN_VERTICAL,
VERTICAL_THEN_HORIZON
) = range(0,2)
You can’t perform that action at this time.