Soldered 125kHz RFID board Arduino library
1.0.0
Library for Soldered 125kHz RFID board.
Toggle main menu visibility
Loading...
Searching...
No Matches
easyC.hpp
Go to the documentation of this file.
1
11
12
#ifndef __EASYC__
13
#define __EASYC__
14
15
#include "Arduino.h"
16
#include "Wire.h"
17
18
class
EasyC
19
{
20
public
:
25
EasyC
()
26
{
27
native
= 0;
28
}
29
33
void
begin
()
34
{
35
if
(
native
)
36
initializeNative
();
37
else
38
begin
(
defaultAddress
);
39
beginDone
= 1;
40
}
41
47
void
begin
(uint8_t _address)
48
{
49
address
= _address;
50
51
Wire.begin();
52
53
beginDone
= 1;
54
}
55
56
int
native
= 0;
57
bool
beginDone
= 0;
58
59
virtual
void
initializeNative
() = 0;
60
61
int
err
;
62
63
char
address
;
64
const
char
defaultAddress
= 0x30;
65
73
int
sendAddress
(
char
regAddr)
74
{
75
Wire.beginTransmission(
address
);
76
Wire.write(regAddr);
77
78
return
err
= Wire.endTransmission();
79
}
80
89
int
readData
(
char
a[],
int
n)
90
{
91
Wire.requestFrom(
address
, n);
92
Wire.readBytes(a, n);
93
94
return
0;
95
}
96
106
int
readRegister
(
char
regAddr,
char
a[],
size_t
n)
107
{
108
if
(
sendAddress
(regAddr))
109
return
err
;
110
111
if
(
readData
(a, n))
112
return
err
;
113
114
return
0;
115
}
116
125
int
sendData
(
const
uint8_t *a,
int
n)
126
{
127
Wire.beginTransmission(
address
);
128
Wire.write(a, n);
129
130
return
err
= Wire.endTransmission();
131
}
132
};
133
134
#endif
EasyC::sendAddress
int sendAddress(char regAddr)
Private function to send a single byte to sensor.
Definition
easyC.hpp:73
EasyC::begin
void begin()
Initializes sensors on native or easyC on default address.
Definition
easyC.hpp:33
EasyC::EasyC
EasyC()
Main constructor for easyC version.
Definition
easyC.hpp:25
EasyC::beginDone
bool beginDone
Definition
easyC.hpp:57
EasyC::readRegister
int readRegister(char regAddr, char a[], size_t n)
Private function to send over i2c and then read n bytes.
Definition
easyC.hpp:106
EasyC::initializeNative
virtual void initializeNative()=0
EasyC::address
char address
Definition
easyC.hpp:63
EasyC::err
int err
Definition
easyC.hpp:61
EasyC::defaultAddress
const char defaultAddress
Definition
easyC.hpp:64
EasyC::readData
int readData(char a[], int n)
Private function to read n bytes over i2c.
Definition
easyC.hpp:89
EasyC::begin
void begin(uint8_t _address)
Initializes sensors on supplied i2c address.
Definition
easyC.hpp:47
EasyC::native
int native
Definition
easyC.hpp:56
EasyC::sendData
int sendData(const uint8_t *a, int n)
Private function to write n bytes over i2c.
Definition
easyC.hpp:125
src
libs
Generic-easyC
easyC.hpp
Generated on
for Soldered 125kHz RFID board Arduino library by
1.18.0. Dark theme by
Tilen Majerle
. All rights reserved. Copyright:
Soldered