mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
ci: add tpmb
This commit is contained in:
parent
1be5e577ee
commit
24fff39314
21
ci/hardware_tests/tpmb/LICENSE
Normal file
21
ci/hardware_tests/tpmb/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Marek Mahut
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
4
ci/hardware_tests/tpmb/Makefile
Normal file
4
ci/hardware_tests/tpmb/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
default: compile
|
||||
|
||||
compile:
|
||||
arduino --upload tpmb.ino --port /dev/ttyACM1
|
21
ci/hardware_tests/tpmb/README.md
Normal file
21
ci/hardware_tests/tpmb/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Trezor (one), press my buttons.
|
||||
|
||||
A simple hardware testing drone for Trezor One.
|
||||
|
||||
![](demo.gif)
|
||||
|
||||
## Hardware
|
||||
|
||||
To build this simple bot, we are using:
|
||||
|
||||
* Arduino UNO R3 (or compatible)
|
||||
* 2x Tower Pro Micro Servo 9g SG9
|
||||
|
||||
## Software
|
||||
|
||||
* ```arduino/``` includes the code for the hardware
|
||||
* ```scripts/``` includes the control scripts
|
||||
|
||||
## 3D Models
|
||||
|
||||
* ```model/``` includes the STL as well as OpenSCAD files
|
5
ci/hardware_tests/tpmb/arduino/default.nix
Normal file
5
ci/hardware_tests/tpmb/arduino/default.nix
Normal file
@ -0,0 +1,5 @@
|
||||
with import <nixpkgs> {};
|
||||
stdenv.mkDerivation rec {
|
||||
name = "tpmb-arduino";
|
||||
buildInputs = [ arduino ];
|
||||
}
|
77
ci/hardware_tests/tpmb/arduino/tpmb.ino
Normal file
77
ci/hardware_tests/tpmb/arduino/tpmb.ino
Normal file
@ -0,0 +1,77 @@
|
||||
#include <Servo.h>
|
||||
|
||||
#define right_unpressed 79
|
||||
#define right_pressed 0
|
||||
#define left_unpressed 0
|
||||
#define left_pressed 79
|
||||
|
||||
|
||||
String command;
|
||||
Servo servo_right;
|
||||
Servo servo_left;
|
||||
|
||||
void setup() {
|
||||
// Starting the serial console
|
||||
Serial.begin(9600);
|
||||
|
||||
// Attaching both servos
|
||||
servo_right.attach(7);
|
||||
servo_left.attach(8);
|
||||
|
||||
// Setting them un unpressed position
|
||||
servo_right.write(right_unpressed);
|
||||
servo_left.write(left_unpressed);
|
||||
Serial.println("Ready for commands, press my buttons!");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if(Serial.available()){
|
||||
command = Serial.readStringUntil('\n');
|
||||
|
||||
if(command.equals("right press")){
|
||||
Serial.println("Pressing right button.");
|
||||
servo_right.write(right_pressed);
|
||||
}
|
||||
|
||||
else if(command.equals("right unpress")){
|
||||
Serial.println("Unpressing right button.");
|
||||
servo_right.write(right_unpressed);
|
||||
}
|
||||
|
||||
else if(command.equals("left press")){
|
||||
Serial.println("Pressing the left button.");
|
||||
servo_left.write(left_pressed);
|
||||
}
|
||||
|
||||
else if(command.equals("left unpress")){
|
||||
Serial.println("Unpressing the left button.");
|
||||
servo_left.write(left_unpressed);
|
||||
}
|
||||
|
||||
else if(command.equals("left click")){
|
||||
Serial.println("Clicking the left button.");
|
||||
servo_left.write(left_pressed);
|
||||
delay(500);
|
||||
servo_left.write(left_unpressed);
|
||||
}
|
||||
|
||||
else if(command.equals("right click")){
|
||||
Serial.println("Clicking the right button.");
|
||||
servo_right.write(right_pressed);
|
||||
delay(500);
|
||||
servo_right.write(right_unpressed);
|
||||
}
|
||||
|
||||
else if(command.equals("all press")){
|
||||
Serial.println("Pressing all buttons.");
|
||||
servo_right.write(right_pressed);
|
||||
servo_left.write(left_pressed);
|
||||
}
|
||||
|
||||
else if(command.equals("all unpress")){
|
||||
Serial.println("Unpressing all buttons.");
|
||||
servo_right.write(right_unpressed);
|
||||
servo_left.write(left_unpressed);
|
||||
}
|
||||
}
|
||||
}
|
BIN
ci/hardware_tests/tpmb/ci_video_demo.mp4
Normal file
BIN
ci/hardware_tests/tpmb/ci_video_demo.mp4
Normal file
Binary file not shown.
BIN
ci/hardware_tests/tpmb/demo.gif
Normal file
BIN
ci/hardware_tests/tpmb/demo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.0 MiB |
8
ci/hardware_tests/tpmb/model/README.md
Normal file
8
ci/hardware_tests/tpmb/model/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# 3D print model for tpmb
|
||||
|
||||
This is pretty easy to print. First open ```base.scad``` with OpenSCAD and
|
||||
export your ```.stl``` file with it.
|
||||
|
||||
Open it with your slider, we are using
|
||||
Original Priska i3 MK3 to print our models. 0.15mm quality setting with standard
|
||||
PLA works fine for us.
|
61
ci/hardware_tests/tpmb/model/base.scad
Normal file
61
ci/hardware_tests/tpmb/model/base.scad
Normal file
@ -0,0 +1,61 @@
|
||||
// Version: 0.8
|
||||
|
||||
// Horizontal wall
|
||||
difference() {
|
||||
// Creating the base
|
||||
cube([100,80,7]);
|
||||
|
||||
// Cutting a hole for trezor to sit in
|
||||
translate([0,25,2])
|
||||
cube([65,30,10]);
|
||||
}
|
||||
|
||||
// Vertical wall
|
||||
difference() {
|
||||
// Creating the vertical block
|
||||
cube([10, 80, 98]);
|
||||
// Cutting an opening for stuck trezor
|
||||
translate([0,26,-2])
|
||||
cube([10,28,12]);
|
||||
|
||||
// Creating opening for right servo
|
||||
translate([0,7-3,12])
|
||||
cube([10,23,92]);
|
||||
translate([0,0,40])
|
||||
cube([10,23,92]);
|
||||
|
||||
// Creating opening for left servo
|
||||
translate([0,50+3,12])
|
||||
cube([10,23,92]);
|
||||
translate([0,50+8,40])
|
||||
cube([10,23,92]);
|
||||
|
||||
// Holes
|
||||
translate([5,2,20])
|
||||
rotate([0,90,0])
|
||||
cylinder(40,1);
|
||||
|
||||
// Holes
|
||||
translate([5,2+27,20])
|
||||
rotate([0,90,0])
|
||||
cylinder(40,1);
|
||||
|
||||
// Holes
|
||||
translate([5,80-29,20])
|
||||
rotate([0,90,0])
|
||||
cylinder(40,1);
|
||||
|
||||
// Holes
|
||||
translate([5,80-2,20])
|
||||
rotate([0,90,0])
|
||||
cylinder(40,1);
|
||||
}
|
||||
|
||||
// Creating stopper
|
||||
translate([0,25,0])
|
||||
cube([5, 6,10]);
|
||||
|
||||
|
||||
// Creating the blocker block
|
||||
translate([0,85,0])
|
||||
cube([28, 6,10]);
|
1318
ci/hardware_tests/tpmb/model/base.stl
Normal file
1318
ci/hardware_tests/tpmb/model/base.stl
Normal file
File diff suppressed because it is too large
Load Diff
5
ci/hardware_tests/tpmb/model/default.nix
Normal file
5
ci/hardware_tests/tpmb/model/default.nix
Normal file
@ -0,0 +1,5 @@
|
||||
with import <nixpkgs> {};
|
||||
stdenv.mkDerivation rec {
|
||||
name = "tpmb-model";
|
||||
buildInputs = [ openscad prusa-slicer ];
|
||||
}
|
Loading…
Reference in New Issue
Block a user