Skip to content

Commit eb1b57c

Browse files
committed
Initial upload
1 parent b31b911 commit eb1b57c

File tree

7 files changed

+404
-0
lines changed

7 files changed

+404
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Deneyap Keypad Arduino Library
2+
[FOR TURKISH VERSION](docs/README_tr.md) ![trflag](https://github.com/deneyapkart/deneyapkart-arduino-core/blob/master/docs/tr.png)
3+
4+
***** Add photo ****
5+
6+
Arduino library for Deneyap Keypad
7+
8+
## :mag_right:Specifications
9+
- `Product ID` **M37**, **mpv1.0**
10+
- `MCU` MSP430G2352
11+
- `Weight`
12+
- `Module Dimension`
13+
- `I2C address` 0x0E, 0x4C, 0x71, 0x72
14+
15+
| Address | |
16+
| :--- | :--- |
17+
| 0x0E | default address |
18+
| 0x4C | address when ADR1 pad is shorted |
19+
| 0x71 | address when ADR2 pad is shorted |
20+
| 0x72 | address when ADR1 and ADR2 pads are shorted |
21+
22+
## :closed_book:Documentation
23+
Deneyap Keypad
24+
25+
[How to install a Arduino Library](https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries)
26+
27+
## :pushpin:Deneyap Keypad
28+
This Arduino library allows you to use Deneyap Keypad with I2C peripheral. You can use this library in your projects with any Arduino compatible board with I2C peripheral.
29+
30+
## :globe_with_meridians:Repository Contents
31+
- `/docs ` README_tr.md and product photos
32+
- `/examples ` Examples with .ino extension sketches
33+
- `/src ` Source files (.cpp .h)
34+
- `keywords.txt ` Keywords from this library that will be highlighted in the Arduino IDE
35+
- `library.properties ` General library properties for the Arduino package manager
36+
37+
## Version History
38+
1.0.0 - initial release
39+
40+
## :rocket:Hardware Connections
41+
- Deneyap Keypad and Board can be connected with I2C cable
42+
- or 3V3, GND, SDA and SCL pins can be connected with jumper cables
43+
44+
| Keypad | Function | Board pins |
45+
|:--- | :--- | :---|
46+
|3.3V | Power |3.3V |
47+
|GND | Ground | GND |
48+
|SDA | I2C Data | SDA pin |
49+
|SCL | I2C Clock | SCL pin |
50+
|SWIM | Debug | no connection |
51+
|RES | Debug | no connection |
52+
|SBWTCK |||
53+
|SBWTDIO|||
54+
|BUT1 |||
55+
|BUT2 |||
56+
|BUT3 |||
57+
|BUT4 |||
58+
|BUT5 |||
59+
|BUT6 |||
60+
|BUT7 |||
61+
|BUT8 |||
62+
|BUT9 |||
63+
64+
## :bookmark_tabs:License Information
65+
Please review the [LICENSE](https://github.com/deneyapkart/deneyap-dokunmatik-tus-takimi-arduino-library/blob/master/LICENSE) file for license information.

docs/README_tr.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Deneyap Dokunmatik Tuş Takımı Arduino Kütüphanesi
2+
3+
***** Fotoğraf eklenecek ****
4+
5+
Deneyap Dokunmatik Tuş Takımı için Arduino kütüphanesidir.
6+
7+
## :mag_right:Özellikler
8+
- `Ürün ID` **M37**, **mpv1.0**
9+
- `MCU` MSP430G2352
10+
- `Ağırlık`
11+
- `Modul Boyutları`
12+
- `I2C Adres` 0x0E, 0x4C, 0x71, 0x72
13+
14+
| Adres | |
15+
| :--- | :--- |
16+
| 0x0E | varsayılan adres |
17+
| 0x4C | ADR1 kısa devre yapıldığındaki adres |
18+
| 0x71 | ADR2 kısa devre yapıldığındaki adres |
19+
| 0x72 | ADR1 ve ADR2 kısa devre yapıldığındaki adres |
20+
21+
## :closed_book:Dokümanlar
22+
Deneyap Dokunmatik Tuş Takımı
23+
24+
[Arduino Kütüphanesi Nasıl İndirilir](https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries)
25+
26+
## :pushpin:Deneyap Dokunmatik Tuş Takımı
27+
Bu Arduino kütüphanesi Deneyap Dokunmatik Tuş Takımının I2C çevre birimi ile kullanılmasını sağlar. Arduino ile uyumlu, I2C çevre birimine sahip herhangi bir geliştirme kartı ile bu kütüphaneyi projelerinizde kullanabilirsiniz.
28+
29+
## :globe_with_meridians:Repo İçeriği
30+
- `/docs` README_tr.md ve ürün fotoğrafları
31+
- `/examples` .ino uzantılı örnek uygulamalar
32+
- `/src` kütüphane için .cpp ve .h uzantılı dosyalar
33+
- `keywords.txt` Arduino IDE'de vurgulanacak anahtar kelimeler
34+
- `library.properties` Arduino yöneticisi için genel kütüphane özellikleri
35+
36+
## Sürüm Geçmişi
37+
1.0.0 - ilk sürüm
38+
39+
## :rocket:Donanım Bağlantıları
40+
- Deneyap Dokunmatik Tuş Takımı ile kullanılan geliştirme kartı I2C kablosu ile bağlanabilir
41+
- veya jumper kablolar ile ile 3V3, GND, SDA ve SCL bağlantıları yapılabilir.
42+
43+
| Dokunmatik Tuş Takımı | Fonksiyon| Kart pinleri |
44+
| :--- | :--- | :--- |
45+
| 3.3V | Güç | 3.3V |
46+
| GND | Toprak |GND |
47+
| SDA | I2C Data | SDA pini |
48+
| SCL | I2C Clock | SCL pini|
49+
|SWIM | Debug | bağlantı yok |
50+
|RES | Debug | bağlantı yok |
51+
| NC | bağlantı yok | |
52+
53+
## :bookmark_tabs:Lisans Bilgisi
54+
Lisans bilgileri için [LICENSE](https://github.com/deneyapkart/deneyap-dokunmatik-tus-takimi-arduino-library/blob/master/LICENSE) dosyasını inceleyin.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Rakam Yazdırma örneği,
3+
*
4+
* Bu örnekte temel konfigürasyon ayarları yapılmaktadır.
5+
* ....
6+
*
7+
* Bu algılayıcı I2C haberleşme protokolü ile çalışmaktadır.
8+
*
9+
* Bu örnek Deneyap TASLAK için oluşturulmuştur
10+
* ------> www.....com <------ //docs
11+
* ------> https://github.com/deneyapkart/deneyap-dokunmatik-tus-takimi-arduino-library <------
12+
*
13+
*/
14+
15+
#include <Deneyap_DokunmatikTusTakimi.h>
16+
17+
Keypad TusTakimi;
18+
19+
void setup(){
20+
Serial.begin(115200);
21+
TusTakimi.begin(0x0E);
22+
}
23+
24+
void loop() {
25+
int keypadDeger = TusTakimi.KeypadRead();
26+
if(keypadDeger != 0xFF)
27+
Serial.println(keypadDeger);
28+
29+
delay(100);
30+
}

keywords.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#######################################
2+
# Syntax Coloring Map For Deneyap_DokunmatikTusTakimi
3+
#######################################
4+
5+
#######################################
6+
# Library (KEYWORD1)
7+
#######################################
8+
9+
Deneyap_DokunmatikTusTakimi KEYWORD1
10+
11+
#######################################
12+
# Class (KEYWORD1)
13+
#######################################
14+
15+
Keypad KEYWORD1
16+
17+
#######################################
18+
# Methods and Functions (KEYWORD2)
19+
#######################################
20+
21+
#######################################
22+
# Constants (LITERAL1)
23+
#######################################

library.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=Deneyap Tus Takimi
2+
version=1.0.0
3+
author=RFtek Electronics <[email protected]>
4+
maintainer=Turkish Technnology Team Foundation (T3)
5+
sentence=Arduino library for Deneyap Keypad
6+
paragraph=A simple and efficient library to use Deneyap Keypad via I2C peripheral.
7+
category=Module
8+
url=https://github.com/deneyapkart/deneyap-dokunmatik-tus-takimi-arduino-library
9+
architectures=*
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
/*
2+
*****************************************************************************
3+
@file Deneyap_DokunmatikTusTakimi.cpp
4+
@mainpage Deneyap Keypad Arduino library source file
5+
@maintainer RFtek Electronics <[email protected]>
6+
@version v1.0.0
7+
@date June 23, 2022
8+
@brief Includes functions to control Deneyap Keypad
9+
Arduino library
10+
11+
Library includes:
12+
--> Configuration functions
13+
--> Data manipulation functions
14+
--> I2C communication functions
15+
*****************************************************************************
16+
*/
17+
18+
#include "Deneyap_DokunmatikTusTakimi.h"
19+
20+
/* Device Status Functions ---------------------------------------------------*/
21+
22+
/**
23+
* @brief Configures I2C connection with user defined address and port
24+
* @param address: I2C address of the device, port: I2C port number (0 or 1)
25+
* @retval connection status (1 --> connected, 0 --> not connected)
26+
*/
27+
bool Keypad::begin(uint8_t address, TwoWire &port)
28+
{
29+
Wire.begin(SDA_PIN,SCL_PIN);
30+
_i2cAddress = address;
31+
_i2cPort = &port;
32+
_dataPacket = {0};
33+
34+
return isConnected();
35+
}
36+
37+
/**
38+
* @brief Checks whether I2C connection established
39+
* @param None
40+
* @retval connection status (1 --> connected, 0 --> not connected)
41+
*/
42+
bool Keypad::isConnected()
43+
{
44+
_i2cPort->beginTransmission(_i2cAddress);
45+
46+
if(_i2cPort->endTransmission() == 0)
47+
return true;
48+
return false;
49+
}
50+
51+
/**
52+
* @brief Requests firmware version of the device
53+
* @param None
54+
* @retval Device firmware version
55+
*/
56+
uint16_t Keypad::getFwVersion()
57+
{
58+
_dataPacket.command = KEYPAD_REQUEST_FW_VERSION;
59+
_dataPacket.dataSize = 0;
60+
return I2C_ReadData16bit(&_dataPacket);
61+
}
62+
63+
/**
64+
* @brief Sets (changes) I2C address of the device
65+
* @param address: I2C address to be set
66+
* @retval Transmission status (1 --> No error, Otherwise --> Transmission error)
67+
*/
68+
69+
bool Keypad::setI2Caddress(uint8_t newAddress)
70+
{
71+
_dataPacket.command = KEYPAD_CHANGE_ADDR;
72+
_dataPacket.dataSize = 1;
73+
_dataPacket.data[0] = newAddress;
74+
75+
bool status = I2C_SendDataPacket(&_dataPacket);
76+
77+
if(status == true)
78+
{
79+
_i2cAddress = newAddress;
80+
return true;
81+
}
82+
else
83+
{
84+
return false;
85+
}
86+
}
87+
88+
/* I2C Data Manipulation Functions -------------------------------------------*/
89+
90+
/**
91+
* @brief Reads the keypad pins.
92+
* @param None
93+
* @retval uint8_t : Keypad pin.
94+
*/
95+
uint8_t Keypad::KeypadRead(void)
96+
{
97+
_dataPacket.command = (uint8_t)KEYPAD_READ;
98+
_dataPacket.dataSize = 0x00;
99+
return I2C_ReadData8bit(&_dataPacket);
100+
}
101+
102+
/* I2C Data Transaction Funstions --------------------------------------------*/
103+
104+
/**
105+
* @brief Reads 8bit data from I2C interface
106+
* @param dataPacket: includes protocol to request data
107+
* @retval I2C 8bit data
108+
*/
109+
uint8_t Keypad::I2C_ReadData8bit(Keypad_DataPacket_TypeDef* dataPacket)
110+
{
111+
_i2cPort->beginTransmission(_i2cAddress);
112+
_i2cPort->write(dataPacket->command);
113+
_i2cPort->endTransmission();
114+
115+
if(_i2cPort->requestFrom(_i2cAddress, static_cast<uint8_t>(1)) != 0)
116+
return _i2cPort->read();
117+
return 0;
118+
}
119+
120+
/**
121+
* @brief Reads 16bit data from I2C interface
122+
* @param dataPacket: includes protocol to request data
123+
* @retval I2C 16bit data
124+
*/
125+
uint16_t Keypad::I2C_ReadData16bit(Keypad_DataPacket_TypeDef* dataPacket)
126+
{
127+
_i2cPort->beginTransmission(_i2cAddress);
128+
_i2cPort->write(dataPacket->command);
129+
_i2cPort->endTransmission();
130+
131+
if(_i2cPort->requestFrom(_i2cAddress, static_cast<uint8_t>(2)) != 0)
132+
{
133+
uint16_t i2cData = _i2cPort->read();
134+
i2cData |= (_i2cPort->read() << 8);
135+
return i2cData;
136+
}
137+
return 0;
138+
}
139+
140+
/**
141+
* @brief Sends data packet based on a custom defined protocol
142+
* @param dataPacket: includes all related data
143+
* @retval Transmission status (1 --> No error, Otherwise --> Transmission error)
144+
*/
145+
bool Keypad::I2C_SendDataPacket(Keypad_DataPacket_TypeDef* dataPacket)
146+
{
147+
_i2cPort->beginTransmission(_i2cAddress);
148+
_i2cPort->write(dataPacket->command);
149+
_i2cPort->write(dataPacket->dataSize);
150+
151+
for(uint8_t i = 0; i < _dataPacket.dataSize; i++)
152+
_i2cPort->write(_dataPacket.data[i]);
153+
154+
if(_i2cPort->endTransmission() == 0)
155+
return true;
156+
return false;
157+
}

0 commit comments

Comments
 (0)