Commit b01ecac3 authored by yuichitamiya's avatar yuichitamiya
Browse files

add eagle sch brd

parent e96a2050
Pipeline #241640 passed with stage
in 33 seconds
......@@ -3,10 +3,13 @@
## pcb
### proto2
![](../images/make/proto2.jpg){width=600}
### b2 (board ver.2)
![](../images/make/proto2.jpg){width=600}
Eagle [sch](../eagle/b2/b2.brd)|[brd](../eagle/b2/b2.sch)
![](../eagle/b2/b2sch.png){width=300}
![](../eagle/b2/b2brd.png){width=300}
### proto1
### b1 (board ver.1)
![](../images/make/proto1.jpg){width=600}
......
# program
## map2_for_b2
``(program ver.2 for Google_map for board ver.2)``
ref. [XIAOでMacのスクリーンショット専用USBキーを作るDIY](https://hack.gpl.jp/2021/03/01/make-mac-sskey-xiao/)
### Library
[TinyUSB_Mouse_and_Keyboard](https://github.com/cyborg5/TinyUSB_Mouse_and_Keyboard/)
ref. Sample: [xiao_usb1.ino](../sketch/xiao_usb1/xiao_usb1.ino)
ref. 4 button keyboard: [ss-key.ino](../sketch/ss-key/ss-key.ino)
<!--
<details closed>
<summary>shownhere</summary>
<pre>
</pre>
</details>
-->
# program
## map2_for_b2
```(program for Google_map ver.2 for board ver.2)```
ref. [XIAOでMacのスクリーンショット専用USBキーを作るDIY](https://hack.gpl.jp/2021/03/01/make-mac-sskey-xiao/)
### Library
[TinyUSB_Mouse_and_Keyboard](https://github.com/cyborg5/TinyUSB_Mouse_and_Keyboard/)
<!--
sample: [xiao_usb1.ino](../sketch/xiao_usb1/xiao_usb1.ino)
<details closed>
<summary>xiao_usb1.ino</summary>
<pre>
include <TinyUSB_Mouse_and_Keyboard.h>
// Launchpad sc > F5
void setup() {
Keyboard.begin(); //Unlike Arduino Keyboard.h, you must use begin.
Serial.begin(115200);
while (! Serial)delay (1);
Serial.println("USB keyboard test");
//find terminal
Keyboard.write(KEY_F5);
Keyboard.press(KEY_LEFT_GUI);
delay(100);
Keyboard.write('f');
Keyboard.releaseAll();
delay(100);
// 英字モードに変更。CTL+SHIFT+;
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.write(';');
Keyboard.releaseAll();
delay(100);
Keyboard.print("terminal");
delay(500);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(200);
// New terminal windows
Keyboard.press(KEY_LEFT_GUI);
Keyboard.write('n');
Keyboard.releaseAll();
//open https://junkhack.gpl.jp/
Keyboard.print("open https://junkhack.gpl.jp/");
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll(); //release the control key
Serial.println("USB keyboard test completed");
};
void loop() {
}
</pre>
</details>
--!>
---
ref: 4 bottom keyboard: [ss-key.ino](../sketch/ss-key/ss-key.ino)
<details closed>
<summary>ss-key.ino</summary>
<pre>
/*
XIAO USB Keyboard.example.
https://junkhack.gpl.jp/2021/03/01/make-mac-sskey-xiao/
*/
// https://github.com/cyborg5/TinyUSB_Mouse_and_Keyboard
//#include <TinyUSB_Mouse_and_Keyboard.h>
#include "TinyUSB_Mouse_and_Keyboard.h"
uint8_t pins[] = { A7 , A8 , A9 , A10 };
uint8_t Key0; //A7
uint8_t Key1; //A8
uint8_t Key2; //A9
uint8_t Key3; //A10
// 残り7Pin
void setup() {
Keyboard.begin();
// led pin
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
//
pinMode(pins[0], INPUT_PULLUP);
pinMode(pins[1], INPUT_PULLUP);
pinMode(pins[2], INPUT_PULLUP);
pinMode(pins[3], INPUT_PULLUP);
}
void loop() {
Key0 = digitalRead(pins[0]);
Key1 = digitalRead(pins[1]);
Key2 = digitalRead(pins[2]);
Key3 = digitalRead(pins[3]);
if (Key0 == LOW ) { // XIAOでは、LOW = On
Key0_act();
}
if (Key1 == LOW ) {
skitch_ss();
}
if (Key2 == LOW ) {
skitch_pict_copy();
}
if (Key3 == LOW ) {
Key3_act();
}
}
void Key0_act() {
// esc
Keyboard.write(KEY_ESC);
digitalWrite(LED_BUILTIN, LOW);
KeyRelease();
}
void skitch_pict_copy() {
//find skitch
Keyboard.write(KEY_F5);
Keyboard.press(KEY_LEFT_GUI);
delay(100);
Keyboard.write('f');
Keyboard.releaseAll();
delay(100);
// 英字モードに変更する必要ある。CTL+SHIFT+;
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.write(';');
Keyboard.releaseAll();
delay(100);
Keyboard.print("skitch");
delay(500);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(200);
// skitch pict copy
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(KEY_LEFT_GUI);
Keyboard.write('c');
Keyboard.releaseAll();
delay(100);
// ひらがなモードに変更。CTL+SHIFT+j
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.write('j');
Keyboard.releaseAll();
digitalWrite(LED_BUILTIN, LOW);// XIAOでは、LOW = On
KeyRelease();
}
void skitch_ss() {
// skitch
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(KEY_LEFT_GUI);
Keyboard.write('5');
digitalWrite(LED_BUILTIN, LOW);
KeyRelease();
}
void Key3_act() {
//find terminal
Keyboard.write(KEY_F5);
Keyboard.press(KEY_LEFT_GUI);
delay(100);
Keyboard.write('f');
Keyboard.releaseAll();
delay(100);
// 英字モードに変更する必要ある。CTL+SHIFT+;
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.write(';');
Keyboard.releaseAll();
delay(100);
Keyboard.print("terminal");
delay(500);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(200);
// New terminal windows
Keyboard.press(KEY_LEFT_GUI);
Keyboard.write('n');
Keyboard.releaseAll();
//open URL
Keyboard.print("open https://www.canva.com/");
Keyboard.press(KEY_RETURN);
digitalWrite(LED_BUILTIN, LOW);
KeyRelease();
}
void KeyRelease() {
Keyboard.releaseAll();
delay(500);
digitalWrite(LED_BUILTIN, HIGH);// XIAOでは、HIGH = Off
}
</pre>
</details>
---
This diff is collapsed.
This diff is collapsed.
/*
XIAO USB Keyboard.example.
https://junkhack.gpl.jp/2021/03/01/make-mac-sskey-xiao/
*/
// https://github.com/cyborg5/TinyUSB_Mouse_and_Keyboard
//#include <TinyUSB_Mouse_and_Keyboard.h>
#include "TinyUSB_Mouse_and_Keyboard.h"
uint8_t pins[] = { A7 , A8 , A9 , A10 };
uint8_t Key0; //A7
uint8_t Key1; //A8
uint8_t Key2; //A9
uint8_t Key3; //A10
// 残り7Pin
void setup() {
Keyboard.begin();
// led pin
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
//
pinMode(pins[0], INPUT_PULLUP);
pinMode(pins[1], INPUT_PULLUP);
pinMode(pins[2], INPUT_PULLUP);
pinMode(pins[3], INPUT_PULLUP);
}
void loop() {
Key0 = digitalRead(pins[0]);
Key1 = digitalRead(pins[1]);
Key2 = digitalRead(pins[2]);
Key3 = digitalRead(pins[3]);
if (Key0 == LOW ) { // XIAOでは、LOW = On
Key0_act();
}
if (Key1 == LOW ) {
skitch_ss();
}
if (Key2 == LOW ) {
skitch_pict_copy();
}
if (Key3 == LOW ) {
Key3_act();
}
}
void Key0_act() {
// esc
Keyboard.write(KEY_ESC);
digitalWrite(LED_BUILTIN, LOW);
KeyRelease();
}
void skitch_pict_copy() {
//find skitch
Keyboard.write(KEY_F5);
Keyboard.press(KEY_LEFT_GUI);
delay(100);
Keyboard.write('f');
Keyboard.releaseAll();
delay(100);
// 英字モードに変更する必要ある。CTL+SHIFT+;
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.write(';');
Keyboard.releaseAll();
delay(100);
Keyboard.print("skitch");
delay(500);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(200);
// skitch pict copy
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(KEY_LEFT_GUI);
Keyboard.write('c');
Keyboard.releaseAll();
delay(100);
// ひらがなモードに変更。CTL+SHIFT+j
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.write('j');
Keyboard.releaseAll();
digitalWrite(LED_BUILTIN, LOW);// XIAOでは、LOW = On
KeyRelease();
}
void skitch_ss() {
// skitch
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(KEY_LEFT_GUI);
Keyboard.write('5');
digitalWrite(LED_BUILTIN, LOW);
KeyRelease();
}
void Key3_act() {
//find terminal
Keyboard.write(KEY_F5);
Keyboard.press(KEY_LEFT_GUI);
delay(100);
Keyboard.write('f');
Keyboard.releaseAll();
delay(100);
// 英字モードに変更する必要ある。CTL+SHIFT+;
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.write(';');
Keyboard.releaseAll();
delay(100);
Keyboard.print("terminal");
delay(500);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(200);
// New terminal windows
Keyboard.press(KEY_LEFT_GUI);
Keyboard.write('n');
Keyboard.releaseAll();
//open URL
Keyboard.print("open https://www.canva.com/");
Keyboard.press(KEY_RETURN);
digitalWrite(LED_BUILTIN, LOW);
KeyRelease();
}
void KeyRelease() {
Keyboard.releaseAll();
delay(500);
digitalWrite(LED_BUILTIN, HIGH);// XIAOでは、HIGH = Off
}
/*
* Sample program demonstrating TinyUSB_Mouse_and_Keyboard.h module which
* auto selects between standard Arduino Mouse.h API and TinyUSB mouse API.
* This program tests the keyboard portion alone.
*/
//Include this module whether using Arduino stack or TinyUSB stack
// https://github.com/cyborg5/TinyUSB_Mouse_and_Keyboards
#include <TinyUSB_Mouse_and_Keyboard.h>
// Launchpad sc > F5
void setup() {
Keyboard.begin(); //Unlike Arduino Keyboard.h, you must use begin.
Serial.begin(115200);
while (! Serial)delay (1);
Serial.println("USB keyboard test");
//find terminal
Keyboard.write(KEY_F5);
Keyboard.press(KEY_LEFT_GUI);
delay(100);
Keyboard.write('f');
Keyboard.releaseAll();
delay(100);
// 英字モードに変更。CTL+SHIFT+;
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.write(';');
Keyboard.releaseAll();
delay(100);
Keyboard.print("terminal");
delay(500);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(200);
// New terminal windows
Keyboard.press(KEY_LEFT_GUI);
Keyboard.write('n');
Keyboard.releaseAll();
//open https://junkhack.gpl.jp/
Keyboard.print("open https://junkhack.gpl.jp/");
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll(); //release the control key
Serial.println("USB keyboard test completed");
};
void loop() {
}
/*
* Click below before uploading and it will type characters in this comment
*
*
*
*
*
*
*
*
*/
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment