Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 3157745

Browse files
Merge branch 'master' into lib_refactoring
2 parents d418048 + ca7ff9b commit 3157745

File tree

11 files changed

+50
-13
lines changed

11 files changed

+50
-13
lines changed

Diff for: .github/workflows/check-arduino.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020

2121
- name: Arduino Lint
2222
uses: arduino/arduino-lint-action@v1

Diff for: .github/workflows/compile-examples.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
steps:
3636
- name: Checkout repository
37-
uses: actions/checkout@v3
37+
uses: actions/checkout@v4
3838

3939
- name: Compile example sketches
4040
uses: arduino/compile-sketches@v1

Diff for: .github/workflows/spell-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020

2121
- name: Spell check
2222
uses: codespell-project/actions-codespell@master

Diff for: .github/workflows/sync-labels.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
steps:
2929
- name: Checkout repository
30-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
3131

3232
- name: Download JSON schema for labels configuration file
3333
id: download-schema
@@ -105,7 +105,7 @@ jobs:
105105
echo "::set-output name=flag::--dry-run"
106106
107107
- name: Checkout repository
108-
uses: actions/checkout@v3
108+
uses: actions/checkout@v4
109109

110110
- name: Download configuration files artifact
111111
uses: actions/download-artifact@v3

Diff for: examples/Analog_input/Analog_input_0_10V/Analog_input_0_10V.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <Arduino_MachineControl.h>
1818

1919
const float RES_DIVIDER = 0.28057;
20-
const float REFERENCE = 3.3;
20+
const float REFERENCE = 3.0;
2121

2222
void setup() {
2323
Serial.begin(9600);

Diff for: examples/Analog_input/Analog_input_4_20mA/Analog_input_4_20mA.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#define SENSE_RES 120
2020

21-
const float REFERENCE = 3.3;
21+
const float REFERENCE = 3.0;
2222

2323
void setup() {
2424
Serial.begin(9600);

Diff for: examples/Analog_input/Analog_input_NTC/Analog_input_NTC.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#define REFERENCE_RES 100000
2222

23-
const float REFERENCE = 3.3;
23+
const float REFERENCE = 3.0;
2424
const float LOWEST_VOLTAGE = 2.7;
2525

2626
void setup() {

Diff for: src/utility/QEI/QEI.cpp

+26-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ QEI::QEI(PinName channelA,
152152
//X4 encoding uses interrupts on channel A,
153153
//and on channel B.
154154
channelA_.rise(mbed::callback(this, &QEI::encode));
155-
channelA_.fall(mbed::callback(this, &QEI::encode));
155+
if(encoding != X1_ENCODING){
156+
channelA_.fall(mbed::callback(this, &QEI::encode));
157+
}
156158

157159
//If we're using X4 encoding, then attach interrupts to channel B too.
158160
if (encoding == X4_ENCODING) {
@@ -191,6 +193,20 @@ int QEI::getRevolutions(void) {
191193

192194
}
193195

196+
// +-------------+
197+
// | X1 Encoding |
198+
// +-------------+
199+
//
200+
// When observing states two patterns will appear:
201+
//
202+
// Counter clockwise rotation:
203+
//
204+
// 10 -> 10 -> 10 -> 10 -> ...
205+
//
206+
// Clockwise rotation:
207+
//
208+
// 11 -> 11 -> 11 -> ...
209+
//
194210
// +-------------+
195211
// | X2 Encoding |
196212
// +-------------+
@@ -243,8 +259,15 @@ void QEI::encode(void) {
243259

244260
//2-bit state.
245261
currState_ = (chanA << 1) | (chanB);
246-
247-
if (encoding_ == X2_ENCODING) {
262+
263+
if(encoding_ == X1_ENCODING){
264+
if(currState_ == 0x3){
265+
pulses_++;
266+
}
267+
if(currState_ == 0x2){
268+
pulses_--;
269+
}
270+
} else if (encoding_ == X2_ENCODING) {
248271

249272
//11->00->11->00 is counter clockwise rotation or "forward".
250273
if ((prevState_ == 0x3 && currState_ == 0x0) ||

Diff for: src/utility/QEI/QEI.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class QEI {
148148
public:
149149

150150
typedef enum Encoding {
151-
151+
X1_ENCODING,
152152
X2_ENCODING,
153153
X4_ENCODING
154154

Diff for: src/utility/RTC/PCF8563T.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void PCF8563TClass::setHourAlarm(uint8_t hours) {
347347
uint8_t dec = hours / 10;
348348
uint8_t unit = hours - (dec * 10);
349349
uint8_t hour_alarm = PCF8563T_HOUR_ALARM_AE_H_MASK & ((dec << 4) + unit);
350-
writeByte(PCF8563T_HOURS_REG, hour_alarm); //check formula on datasheet val + 6 * (val / 10)
350+
writeByte(PCF8563T_HOUR_ALARM_REG, hour_alarm); //check formula on datasheet val + 6 * (val / 10)
351351
}
352352

353353
/**

Diff for: src/utility/ioexpander/ArduinoIOExpander.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ void ArduinoIOExpanderClass::initPins()
103103
{
104104

105105
if (_tca.getAddress() == IO_ADD) {
106+
PinStatus status = SWITCH_OFF;
107+
set(IO_WRITE_CH_PIN_00, status);
108+
set(IO_WRITE_CH_PIN_01, status);
109+
set(IO_WRITE_CH_PIN_02, status);
110+
set(IO_WRITE_CH_PIN_03, status);
111+
set(IO_WRITE_CH_PIN_04, status);
112+
set(IO_WRITE_CH_PIN_05, status);
113+
set(IO_WRITE_CH_PIN_06, status);
114+
set(IO_WRITE_CH_PIN_07, status);
115+
set(IO_WRITE_CH_PIN_08, status);
116+
set(IO_WRITE_CH_PIN_09, status);
117+
set(IO_WRITE_CH_PIN_10, status);
118+
set(IO_WRITE_CH_PIN_11, status);
119+
106120
pinMode(IO_WRITE_CH_PIN_00, OUTPUT);
107121
pinMode(IO_WRITE_CH_PIN_01, OUTPUT);
108122
pinMode(IO_WRITE_CH_PIN_02, OUTPUT);

0 commit comments

Comments
 (0)