Skip to content

Commit ad43e15

Browse files
Merge branch 'development'
2 parents 44126e2 + 2423c78 commit ad43e15

File tree

39 files changed

+1296
-53
lines changed

39 files changed

+1296
-53
lines changed

examples/Analog-AnalogInPwmOutSerial/Analog-AnalogInPwmOutSerial.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ EBF_Core EBF;
66
EBF_AnalogInput analongInput;
77
EBF_PwmOutput pwmOutput;
88

9-
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication
10-
EBF_Serial serial(Serial);
9+
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication by default
10+
EBF_Serial serial;
11+
// You can use any other Serial interface if availalbe for your device
12+
//EBF_Serial serial(Serial2);
1113

1214
int sensorValue = 0; // value read from the pot
1315
int outputValue = 0; // value output to the PWM (analog out)

examples/Analog-AnalogInPwmOutSerialSetPollInterval/Analog-AnalogInPwmOutSerialSetPollInterval.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ EBF_Core EBF;
66
EBF_AnalogInput analongInput;
77
EBF_PwmOutput pwmOutput;
88

9-
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication
10-
EBF_Serial serial(Serial);
9+
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication by default
10+
EBF_Serial serial;
11+
// You can use any other Serial interface if availalbe for your device
12+
//EBF_Serial serial(Serial2);
1113

1214
int sensorValue = 0; // value read from the pot
1315
int outputValue = 0; // value output to the PWM (analog out)

examples/Basics-AnalogReadSerial/Basics-AnalogReadSerial.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// EBF objects creation, should be global
55
EBF_Core EBF;
6-
EBF_Serial serial(Serial);
6+
EBF_Serial serial;
77
EBF_AnalogInput analog0;
88

99
void onAnalog0Change()

examples/Basics-DigitalReadSerial/Basics-DigitalReadSerial.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
EBF_Core EBF;
66
EBF_DigitalInput button;
77

8-
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication
9-
EBF_Serial serial(Serial);
8+
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication by default
9+
EBF_Serial serial;
10+
// You can use any other Serial interface if availalbe for your device
11+
//EBF_Serial serial(Serial2);
1012

1113
// Button change callback function
1214
void onButtonChange()

examples/Basics-ReadAnalogVoltage/Basics-ReadAnalogVoltage.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// EBF objects creation, should be global
55
EBF_Core EBF;
6-
EBF_Serial serial(Serial);
6+
EBF_Serial serial;
77
EBF_AnalogInput analog0;
88

99
void onAnalog0Change()

examples/Basics-ReadAnalogVoltageRaw/Basics-ReadAnalogVoltageRaw.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// EBF objects creation, should be global
55
EBF_Core EBF;
6-
EBF_Serial serial(Serial);
6+
EBF_Serial serial;
77
EBF_AnalogInput analog0;
88

99
void onAnalog0Change()

examples/Communication-AsciiTable/Communication-AsciiTable.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
// EBF objects creation, should be global
55
EBF_Core EBF;
66

7-
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication
8-
EBF_Serial serial(Serial);
7+
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication by default
8+
EBF_Serial serial;
9+
// You can use any other Serial interface if availalbe for your device
10+
//EBF_Serial serial(Serial2);
911

1012
// first visible ASCIIcharacter '!' is number 33:
1113
uint8_t thisByte = 33;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include <Arduino.h>
2+
#include "wiring_private.h" // pinPeripheral() function
3+
4+
#include "EBF.h"
5+
6+
// EBF objects creation, should be global
7+
EBF_Core EBF;
8+
9+
// We will be using SERCOM2 communication module in SparkFun SAMD21 Mini board for that example
10+
TwoWire Wire2(&sercom2, 4, 3);
11+
12+
// Other Wire instances can be specified in the constructor:
13+
EBF_I2C i2c(Wire2);
14+
15+
16+
void setup()
17+
{
18+
EBF.Init();
19+
20+
// EBF_I2C initialization allows providing callback function that will be called when a data
21+
// on I2C bus will be available. Usage of such callback might be helpfull when there is a
22+
// very slow device that you are communicating with.
23+
// Generally the I2C devices are very fast with response, so there is no much usage for that
24+
// callback while using the EBF_I2C class directly. But it might be used for other EBF products
25+
// implementations.
26+
27+
// Althought the EBF_I2C implementation doesn't add anything special on top of the default Wire
28+
// implementation, it is needed for additional EBF classes and can serve as a wrapper for the I2C
29+
// connection that cab be changed to different communication module, as shown in that example,
30+
// without the need to change the rest of the code
31+
32+
// EBF_I2C initialization in master mode (no address should be specified):
33+
i2c.Init();
34+
35+
// PIN re-assignment is required since SERCOM2 lines were configured for other usage by the Arduino code
36+
pinPeripheral(4, PIO_SERCOM_ALT);
37+
pinPeripheral(3, PIO_SERCOM_ALT);
38+
39+
// EBF_I2C initialization in slave mode (address is specified, callback function cab be skipped with NULL pointer)
40+
//i2c.Init(NULL, 0x55);
41+
42+
// I2C bus clock can be changed by calling:
43+
i2c.SetClock(400000);
44+
}
45+
46+
void loop()
47+
{
48+
// Let EBF to do all the processing
49+
// Your logic should be done in the callback functions
50+
EBF.Process();
51+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <Arduino.h>
2+
3+
#include "EBF.h"
4+
5+
// EBF objects creation, should be global
6+
EBF_Core EBF;
7+
8+
// Default Wire instance will be used for the following declaration:
9+
EBF_I2C i2c;
10+
11+
// Other Wire instances can be specified in the constructor:
12+
//EBF_I2C i2c(Wire2);
13+
14+
15+
void setup()
16+
{
17+
EBF.Init();
18+
19+
// EBF_I2C initialization allows providing callback function that will be called when a data
20+
// on I2C bus will be available. Usage of such callback might be helpfull when there is a
21+
// very slow device that you are communicating with.
22+
// Generally the I2C devices are very fast with response, so there is no much usage for that
23+
// callback while using the EBF_I2C class directly. But it might be used for other EBF products
24+
// implementations.
25+
26+
// EBF_I2C initialization in master mode (no address should be specified):
27+
i2c.Init();
28+
29+
// EBF_I2C initialization in slave mode (address is specified, callback function cab be skipped with NULL pointer)
30+
//i2c.Init(NULL, 0x55);
31+
32+
// I2C bus clock can be changed by calling:
33+
i2c.SetClock(400000);
34+
}
35+
36+
void loop()
37+
{
38+
// Let EBF to do all the processing
39+
// Your logic should be done in the callback functions
40+
EBF.Process();
41+
}

examples/Communication-LedDimmer/Communication-LedDimmer.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
EBF_Core EBF;
66
EBF_PwmOutput led;
77

8-
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication
9-
EBF_Serial serial(Serial);
8+
// EBF serial object will use the Arduino's Serial (Hardware Serial) for communication by default
9+
EBF_Serial serial;
10+
// You can use any other Serial interface if availalbe for your device
11+
//EBF_Serial serial(Serial2);
1012

1113
// Serial data callback function
1214
void onSerial()

0 commit comments

Comments
 (0)