This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pcbnew | |
import re | |
def _get_selected_modules(): | |
modules = pcbnew.GetBoard().GetModules() | |
return filter(lambda m: m.IsSelected(), modules) | |
def _replace_leading_number(target, new): | |
match = re.search(r'[0-9]', target) | |
idx = match.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PIDCONTROLLER_H_ | |
#define PIDCONTROLLER_H_ | |
class PIDController | |
{ | |
public: | |
struct Param | |
{ | |
float P; | |
float I; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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行列のように並べる |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#R1を90度回転する | |
r1.SetOrientation(90*10) | |
#R1を(100mm, 100mm)に移動する | |
r1.SetPosition(pcbnew.wxPointMM(100,100)) | |
#R1を現在位置から(50mm, 0mm)だけ移動する | |
r1.Move(pcbnew.wxPointMM(50,0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pcbnew | |
#pcbnewで開いている基板(BORAD)への参照を取得する | |
board = pcbnew.GetBoard() | |
#基板上の"R1"というリファレンスを持つ部品(MODULE)への参照を取得する | |
r1 = board.FindModuleByReference("R1") | |
#r1(MODULE)のもつリファレンスを文字列として取得する | |
print r1.GetReference() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef TASK_TASKBASE_H_ | |
#define TASK_TASKBASE_H_ | |
#include "FreeRTOS.h" | |
#include "task.h" | |
#include "queue.h" | |
#include "semphr.h" | |
class TaskBase { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.global _start | |
.code 16 | |
.syntax unified | |
.equ STACK_TOP, 0x20005000 | |
.equ SCB_VTOR, 0xE000ED08 | |
.equ RCC_APB2ENR, 0x40021018 | |
.equ GPIOA_CRL, 0x40010800 | |
.equ GPIOA_ODR, 0x4001080C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.global _start | |
.code 16 | |
.syntax unified | |
.equ STACK_TOP, 0x20005000 | |
.equ RCC_APB2ENR, 0x40021018 | |
.equ GPIOA_CRL, 0x40010800 | |
.equ GPIOA_ODR, 0x4001080C |
NewerOlder