add cardkb_hat

This commit is contained in:
vany5921
2019-10-25 17:46:12 +08:00
parent b496aa8154
commit 855b7d7f7c
15 changed files with 269 additions and 18 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

+119
View File
@@ -0,0 +1,119 @@
# CardKB HAT{docsify-ignore-all}
<img src="assets/img/product_pics/hat/cardkb_hat/cardkb_hat_01.jpg" width="30%" height="30%"><img src="assets/img/product_pics/hat/cardkb_hat/cardkb_hat_02.jpg" width="30%" height="30%"><img src="assets/img/product_pics/hat/cardkb_hat/cardkb_hat_03.jpg" width="30%" height="30%">
***
:memo:**[Description](#Description)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[Example](#Example)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[Purchase](https://m5stack.com/collections/m5-unit/products/cardkb_hat)**&nbsp;&nbsp;&nbsp;:clapper:**[Related Video](#Related-Video)**&nbsp;&nbsp;&nbsp;<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/EasyLoader_logo-min.jpg">**[EasyLoader](#EasyLoader)**
## Description
**CardKB HAT** is an implementation of a full-featured QWERTY keyboard tailored as a HAT for the M5StickC. Consider that you want to make some cool stuff that require interaction through typing on a keyboard. But M5StickC itself just has 2 buttons. So, here comes the flexible and yet powerful “CardKB HAT” to solve the issue.
The CardKB HAT also offers support for several button combinations (Shift+Key, Fn+Key) adding virtually many different keys. This comes with an RGB LED to indicate the keyboard state. IIC address is 0x5F.
**Button combination description:**
* **Single button is pressed**,once pressed button the led flashing blue.keyboard will output the first (normal) key value in its lower case. E.g. if "Q" is pressed, keyboard will output "q"(lower case).
* **Shift+Key**, After pressing the Shift key, led flashing red,if a letter button is pressed, it'll output the letter in its upper case or the second value.
E.g. if "Shift" is pressed once, then "Q" is pressed, the keyboard will output "Q". If "Shift" is double clicked, then the keyboard will lock this function and all the letter keys pressed will give output in CAPITALS.
* **Fn+Key**(custom function key combination), led flashing green,keyboard will output the third key value, which you can customize based on the requirement.
* **Double-click Shift or fn** to lock Shift(red always on) or Fn(green always on) and output the combined value multiple times.
<img src="assets/img/product_pics/hat/cardkb_hat/cardkb_hat_04.jpg">
## Product Features
- Full-function keyboard with multi-key combination support
- IIC Address : 0X5F(I2C)
- Product Size84.6mm x 54.2mm x 6.5mm
## Include
- 1x CardKB HAT
## Application
- Keyboard peripheral
## Related Link
- **[Offical Video](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
- **[Forum](http://forum.m5stack.com/)**
- **[CardKB HAT Firmware](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Hat/CardKB_HAT/firmware_328p/cardKB_HAT)**
## EasyLoader
<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/EasyLoader_logo.png" width="100px" style="margin-top:20px">
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/HAT/CardKB/EasyLoader_CardKB_HAT.exe"><button type="button" class="btn btn-primary">click to download EasyLoader</button></a>
>1. EasyLoader is a simple and fast program burner. Every product page in EasyLoader provides a product-related case program. This can be burned to the M5 device through simple steps, and a series of function verifications can be performed.
>After downloading the software, double-click to run the application, connect the M5 device to the computer through the data cable, select the port parameters, click **"Burn"** to burn the program (**For M5StickC, set the baud rate to 115200 or 750000**)
?>3. Currently EasyLoader is only available for Windows operating system, Before installing and using the Easyloader for M5Core, you need to install CP210X driver (you do not need to install with M5StickC as controller)[Click here to view the driver installation tutorial](en/related_documents/M5Burner#install-usb-driver)
## PinMap
**ATMega328 ISP**Download interface Pin foot definition
<img src="assets\img\product_pics\app\mega328_isp.png" width="30%" height="30%">
## Example
### Arduino IDE
*To get the code, please click [here](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Hat/CardKB_HAT/Arduino)。*
```arduino
#include <M5StickC.h>
#include <Wire.h>
#define CARDKB_ADDR 0x5F
void setup()
{
M5.begin();
Wire.begin(0, 26);
M5.Lcd.setRotation(3);
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setCursor(0, 0, 2 );
M5.Lcd.setTextColor(YELLOW);
M5.Lcd.println("IIC Address: 0x5F\n");
M5.Lcd.println(">>");
}
void loop()
{
Wire.requestFrom(CARDKB_ADDR, 1);
while(Wire.available())
{
char c = Wire.read(); // receive a byte as characterif
if (c != 0)
{
M5.Lcd.printf("%c", c);
Serial.println(c, HEX);
Serial.println(char(c));
}
}
// delay(10);
}
```
## Related Video
- **CardKB HAT**
<video class="video_size" controls>
<source src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Product_example_video/HAT/CardKB_HAT.mp4" type="video/mp4">
</video>
+4 -2
View File
@@ -121,8 +121,10 @@ void setup() {
M5.begin();
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, 16, 17);
pinMode(5, OUTPUT);
digitalWrite(5, 1);
pinMode(2, OUTPUT);
digitalWrite(2, 0);
delay(3000);
digitalWrite(2, 1);
}
void loop() {
+4 -2
View File
@@ -127,8 +127,10 @@ void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, 16, 17);
pinMode(5, OUTPUT);
digitalWrite(5, 1);
pinMode(2, OUTPUT);
digitalWrite(2, 0);
delay(3000);
digitalWrite(2, 1);
}
void loop() {
+4 -2
View File
@@ -154,8 +154,10 @@ void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, 16, 17);
pinMode(5, OUTPUT);
digitalWrite(5, 1);
pinMode(2, OUTPUT);
digitalWrite(2, 0);
delay(3000);
digitalWrite(2, 1);
}
+5 -5
View File
@@ -12,21 +12,21 @@
## RS485&nbsp;Introduction
>RS485 is a data transmission standard. Its basic usage is the same as that of the serial port. It defines the RX and TX ports, communication baud rate and data bits for communication. Usually configured as (9600, Serial_8N1, RX_PIN, TX_PIN), 9600 baud rate, 8 data bits, no parity, 1 stop bit
>RSRS485 is the data transmission standard used mostly for industrial purposes. It is a form of asynchronous serial communication (UART). This is similar to but more powerful than RS232 which is commonly used in almost all the microcontrollers. It defines the RX and TX ports, communication baud rate and data bits for communication just like any other serial communication protocol. Usual configuration is as follows: (9600, Serial_8N1, RX_PIN, TX_PIN), 9600 baud rate, 8 data bits, no parity, 1 stop bit.
## RS485&nbsp;example
>1. Serial port 2 is defined during program initialization. Normally, the serial port of M5Stack is 16 (RX_PIN) and 17 (TX_PIN), the serial port of M5StickC is 33 (RX_PIN) and 32 (TX_PIN), and the HAT serial port is 26 (RX_PIN) and 0 (TX_PIN).
>1. Second serial port is defined during program initialization. Normally, the serial port on M5Stack is 16 (RX_PIN) and 17 (TX_PIN), the serial port on M5StickC is 33 (RX_PIN) and 32 (TX_PIN), and the HAT's serial port is 26 (RX_PIN) and 0 (TX_PIN).
Serial2.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN);
>2. Send data can use Serial2.print ("x") or Serial.write ("x"). For the difference between the two, please refer to the use of Serial in Arduino.
>2. To send data Serial.print ("x") or Serial.write ("x") can be used. For the difference between the two, please refer to the use of Serial in Arduino.
Serial2.print("97");或者Serial2.write("97");
Serial2.print("97"); or Serial2.write("97");
>3. Read data can be read from the buffer using Serial2.read().
>3. Data can be read from the buffer using Serial.read().
if(Serial2.available()){
char c = Serial2.read();
+10
View File
@@ -937,6 +937,16 @@
</div>
<div class="item">
<a href="/#/en/hat/hat-cardkb">
<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_homepage/hat/cardkb_hat_01.jpg">
<p class="item-title">CardKB</p>
</a>
</div>
</div>
+110
View File
@@ -0,0 +1,110 @@
# CardKB HAT {docsify-ignore-all}
<img src="assets/img/product_pics/hat/cardkb_hat/cardkb_hat_01.jpg" width="30%" height="30%"><img src="assets/img/product_pics/hat/cardkb_hat/cardkb_hat_02.jpg" width="30%" height="30%"><img src="assets/img/product_pics/hat/cardkb_hat/cardkb_hat_03.jpg" width="30%" height="30%">
***
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://m5stack.com/collections/m5-unit/products/cardkb-hat)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:clapper:**[相关视频](#相关视频)**&nbsp;&nbsp;&nbsp;<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/EasyLoader_logo-min.jpg">**[EasyLoader](#EasyLoader)**
## 描述
**CardKB HAT** 是一款功能齐全的QWERTY键盘.如果你想要实现一些复杂的键盘输入交互,单纯依靠M5StickC上的按键实现起来很有难度,为了解决这一问题我们推出了CardKB HAT.
使用CardKB HAT不仅能够实现全键盘输入,还支持多种按键组合(Shift + Key,Fn + Key)输出更丰富的键值,一颗板载彩色LED能根据按键的输入模式会发出不同颜色的灯光提示,CardKB HAT的I2C地址为0x5F.
**按钮组合说明:**
* **按下单个按键**(蓝灯亮一次),键盘将输出第一键值(字母键值则输出小写形式). 例如,按下"Q",键盘将输出"q"(小写形式).
* **双击Shift或fn**,锁定Shift(红灯常亮)或Fn(绿灯常亮),多次输出组合值
* **Shift+key**(红灯闪烁),键盘将输出字母的大写形式,复用按键将输出第二键值.例如,单击"Shift"后,按下"Q",键盘将输出"Q"(大写形式).双击"Shift"锁定功能,之后按下的任意字母按键都将输出大写形式,按下的数字和符号按键输出第二键值,再次单击"Shift"进行解锁.
* **Fn+key(自定义功能键组合)**(绿灯闪烁),键盘将输出第三键值.你可以自定义按下的按键其对应的功能.
<img src="assets/img/product_pics/hat/cardkb_hat/cardkb_hat_04.jpg">
## 产品特性
- 全键盘输入,多种按键组合.
## 包含
- 1x CardKB HAT
## 应用
- M5StickC键盘输入外设
## 相关链接
- **[CardKB HAT固件](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Hat/CardKB_HAT/firmware_328p/cardKB_HAT)**
## EasyLoader
<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/EasyLoader_logo.png" width="100px" style="margin-top:20px">
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/HAT/CardKB/EasyLoader_CardKB_HAT.exe"><button type="button" class="btn btn-primary">点击下载EasyLoader</button></a>
>1.EasyLoader是一个简洁快速的程序烧录器,每一个产品页面里的EasyLoader都提供了一个与产品相关的案例程序,通过简单步骤将其烧录至主控,能够进行一系列的功能验证.
>2.下载软件后,双击运行应用程序,将M5设备通过数据线连接至电脑,选择端口参数,点击 **"Burn"** 即可开始烧录.(**为M5StickC烧录时,请将波特率设置在750000或115200**)
?>3.目前EasyLoader仅适用于Windows操作系统、兼容M5体系采用ESP32作为控制核心的主机.在为M5Core烧录前需要安装CP210X驱动程序(使用M5StickC作为控制器的则无需安装)[点击此处查看驱动安装教程](zh_CN/related_documents/M5Burner#安装串口驱动)
## 管脚映射
**Mega328 ISP**下载接口Pin脚定义
<img src="assets\img\product_pics\app\mega328_isp.png">
## 例程
### Arduino IDE
*以下代码仅为片段,如需获取完整代码, [请点击此处](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Hat/CardKB_HAT/Arduino)。*
```arduino
#include <M5StickC.h>
#include <Wire.h>
#define CARDKB_ADDR 0x5F
void setup()
{
M5.begin();
Wire.begin(0, 26);
M5.Lcd.setRotation(3);
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setCursor(0, 0, 2 );
M5.Lcd.setTextColor(YELLOW);
M5.Lcd.println("IIC Address: 0x5F\n");
M5.Lcd.println(">>");
}
void loop()
{
Wire.requestFrom(CARDKB_ADDR, 1);
while(Wire.available())
{
char c = Wire.read(); // receive a byte as characterif
if (c != 0)
{
M5.Lcd.printf("%c", c);
Serial.println(c, HEX);
Serial.println(char(c));
}
}
// delay(10);
}
```
## 相关视频
**CardKB HAT 的使用演示**
<video class="video_size" controls>
<source src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Product_example_video/HAT/CardKB_HAT.mp4" type="video/mp4">
</video>
+4 -2
View File
@@ -122,8 +122,10 @@ void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, 16, 17);
pinMode(5, OUTPUT);
digitalWrite(5, 1);
pinMode(2, OUTPUT);
digitalWrite(2, 0);
delay(3000);
digitalWrite(2, 1);
}
void loop() {
+4 -2
View File
@@ -124,8 +124,10 @@ void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, 16, 17);
pinMode(5, OUTPUT);
digitalWrite(5, 1);
pinMode(2, OUTPUT);
digitalWrite(2, 0);
delay(3000);
digitalWrite(2, 1);
}
void loop() {
+4 -2
View File
@@ -158,8 +158,10 @@ void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, 16, 17);
pinMode(5, OUTPUT);
digitalWrite(5, 1);
pinMode(2, OUTPUT);
digitalWrite(2, 0);
delay(3000);
digitalWrite(2, 1);
}
+1 -1
View File
@@ -8,7 +8,7 @@
## 描述
**CardKB** 是一款功能齐全的QWERTY键盘.如果你想要实现一些复杂的键盘输入交互,仅仅依靠N5Core上的3个按键恐怕有些难度.面对这一难题 CardKB ,横空出世.
**CardKB** 是一款功能齐全的QWERTY键盘.如果你想要实现一些复杂的键盘输入交互,仅仅依靠M5Core上的3个按键恐怕有些难度.面对这一难题 CardKB ,横空出世.
使用 CardKB Unit 不仅能够实现全键盘输入,还支持多种按键组合(Sym + KeyShift + KeyFn + Key)输出更丰富的键值.该 Unit 通过GROVE A端口(IIC接口)与M5Core通信. I2C地址为0x5F.