- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I feel somewhat guilty about calling this a sample,
but knowing that we have access to an I2C Full Keyboard may be good!
これをサンプルと言い張るのは少しずうずうしいかもしれませんが、
I2C で接続できるフルキーボードが安価に入手できるのは良い知らせかも知れません。
In the discussion of Data entry from keyboard to PSOC
I encountered M5Stack Official CardKB Mini Keyboard Unit MEGA328P GROVE I2C USB ISP Programmer for ESP32 Arduino D...
Data entry from keyboard to PSOC のスレで、I2C で接続できるミニキーボードを見つけました。
So I ordered a couple of these and they arrived today.
スイッチサイエンスさんのウェブにあったのでポチッたところ、今日到着しました。
M5Stack用カード型キーボードユニット - スイッチサイエンス
Pins from top to bottom are
============
1 GND
2 5V
3 SDA
4 SCL
============
schematic
pins
main.c
====================
#include "project.h"
#include "stdio.h"
#define CARDKB_I2C_SLAVE_ADDR 0x5F
#define STR_LEN 64
char str[STR_LEN+1] ;
void print(char *str)
{
UART_PutString(str) ;
}
void printc(char c)
{
UART_PutChar(c) ;
}
void cls(void)
{
print("\033c") ; /* reset */
CyDelay(20) ;
print("\033[2J") ; /* clear screen */
CyDelay(20) ;
}
void splash(void)
{
cls() ;
print("5LP CardKb Test") ;
snprintf(str, STR_LEN, "(%s %s)\n", __DATE__, __TIME__) ;
print(str) ;
}
void init_hardware(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
UART_Start() ;
splash() ;
I2C_Start() ;
}
uint8_t myI2C_ReadByte(uint8_t reg_addr)
{
uint8_t status ;
uint8_t value = 0 ;
I2C_MasterClearStatus();
status = I2C_MasterSendStart(CARDKB_I2C_SLAVE_ADDR, I2C_WRITE_XFER_MODE) ;
if (I2C_MSTR_NO_ERROR == status) {
I2C_MasterWriteByte(reg_addr);
status = I2C_MasterSendRestart(CARDKB_I2C_SLAVE_ADDR, I2C_READ_XFER_MODE);
}
if (I2C_MSTR_NO_ERROR == status) {
value = I2C_MasterReadByte(I2C_ACK_DATA);
}
I2C_MasterSendStop();
return(value) ;
}
uint8_t read_cardkb(void)
{
uint8_t key = 0 ;
key = myI2C_ReadByte(1) ;
return( key ) ;
}
int main(void)
{
uint8_t key ;
init_hardware() ;
for(;;)
{
key = read_cardkb() ;
if (key) {
// snprintf(str, STR_LEN, "%02X ", key) ;
// print(str) ;
printc(key) ;
}
CyDelay(10) ;
}
}
====================
Tera Term log
moto
- Labels:
-
PSoC 345 LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Motoo,
Thank you for project
Best Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Motoo;
if i want to use lcd. What should I do to make the articles I write appear on the LCD?
Best Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Eemuh-san,
Nice to hear from you 😉
Have your "CardKb" arrived?
Anyway, I have seen there are LCD components in PSoC Creator
And also there are many LCD Displays available like the one I used for PSoC 4
So first of all, you need to decide what kind of output you'd like to display
and which "LCD" module you'd like to use.
Having written that, would you create a new question/discussion about LCD display and 5LP,
so that many can notice your question and will help you?
Although I will try to join, I'm sure that there are many experts about this topic (LCD and 5LP) than I.
Best Regards,
17-Mar-2020
Motoo Tanaka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Motoo Tanaka,
CardKb came. I can use it after doing deep cleaning..:)
I want to use character LCD.
I want to write the letters I write side by side and create a word.
I changed the function as follows. On the LCD screen, 1 letter is written and the other letter is pressed. I want to write a word.
void printc(char c)
{
UART_PutChar(c) ;
sprintf(yaz, "%c",c);
lcd_Position(1u,0u);
lcd_PrintString(yaz);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Moto,
I opened a new discussion. I would be glad if you can look at it.
Best Regards.