Skip to content

Commit d03ff9f

Browse files
committed
Add Wio BG770A v1.1
1 parent b26d917 commit d03ff9f

File tree

4 files changed

+53
-7
lines changed

4 files changed

+53
-7
lines changed

.github/workflows/compile-examples-and-tools.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
board_version:
1212
- 1_0
1313
- es2
14+
- 1_1
1415
debug_output:
1516
- none
1617
- rtt

examples/basic/vsys/vsys.ino

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* vsys.ino
3+
* Copyright (C) Seeed K.K.
4+
* MIT License
5+
*/
6+
7+
#include <Adafruit_TinyUSB.h>
8+
9+
#define INTERVAL (500)
10+
11+
void setup() {
12+
Serial.begin(115200);
13+
{
14+
const auto start = millis();
15+
while (!Serial && millis() - start < 5000) {
16+
delay(2);
17+
}
18+
}
19+
Serial.println();
20+
Serial.println();
21+
22+
analogReadResolution(14);
23+
analogSampleTime(40);
24+
analogOversampling(256);
25+
}
26+
27+
void loop() {
28+
const auto raw = analogRead(PIN_VSYS_DIV);
29+
30+
// Convert raw value to voltage
31+
//
32+
// Voltage = Value / Resolution * Reference voltage / Gain
33+
// Resolution : 16383 ... 14-bit resolution = 2^14-1
34+
// Reference voltage: 0.6 ... Internal reference = 0.6V
35+
// Gain : 1/6 ... 1/6
36+
const auto voltage = (float)raw / 16383 * 0.6f / (1.0f / 6);
37+
38+
const auto vsys = voltage / 130.0f * (750.0f + 130.0f);
39+
40+
Serial.println(vsys, 3);
41+
42+
delay(INTERVAL);
43+
}

src/module/bg770a/Bg770a.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ namespace wiocellular
312312
wiocellular::internal::WioLog(wiocellular::internal::WioLogType::WARNING, "Interface is not active when powerOn()");
313313
return WioCellularResult::NotActivate;
314314
}
315-
#elif defined(BOARD_VERSION_1_0)
315+
#elif defined(BOARD_VERSION_1_0) || defined(BOARD_VERSION_1_1)
316316
wiocellular::internal::WioLog(wiocellular::internal::WioLogType::WARNING, "Interface is not active when powerOn()");
317317
return WioCellularResult::NotActivate;
318318
#else
@@ -334,7 +334,7 @@ namespace wiocellular
334334
wiocellular::internal::WioLog(wiocellular::internal::WioLogType::WARNING, "Interface is not active when powerOn()");
335335
return WioCellularResult::NotActivate;
336336
}
337-
#elif defined(BOARD_VERSION_1_0)
337+
#elif defined(BOARD_VERSION_1_0) || defined(BOARD_VERSION_1_1)
338338
getInterface().reset();
339339
#else
340340
#error "Unknown board version"

src/module/bg770a/Bg770aInterface.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ namespace wiocellular
3535
suli3::arduino::DigitalInputPin<CONSTANT::VDD_EXT_PIN> VddExt_;
3636
suli3::arduino::DigitalOutputPin<CONSTANT::PWRKEY_PIN> Pwrkey_;
3737
#if defined(BOARD_VERSION_ES2)
38-
#elif defined(BOARD_VERSION_1_0)
38+
// Nothing to do
39+
#elif defined(BOARD_VERSION_1_0) || defined(BOARD_VERSION_1_1)
3940
suli3::arduino::DigitalOutputPin<CONSTANT::RESET_N_PIN> ResetN_;
4041
#else
4142
#error "Unknown board version"
@@ -138,7 +139,7 @@ namespace wiocellular
138139
VddExt_.begin(INPUT_PULLUP);
139140
#if defined(BOARD_VERSION_ES2)
140141
Pwrkey_.begin(OUTPUT, 0);
141-
#elif defined(BOARD_VERSION_1_0)
142+
#elif defined(BOARD_VERSION_1_0) || defined(BOARD_VERSION_1_1)
142143
Pwrkey_.begin(OUTPUT_S0D1, 1);
143144
ResetN_.begin(OUTPUT_S0D1, 1);
144145
#else
@@ -180,7 +181,7 @@ namespace wiocellular
180181
Pwrkey_.write(1);
181182
delay(500 + 2);
182183
Pwrkey_.write(0);
183-
#elif defined(BOARD_VERSION_1_0)
184+
#elif defined(BOARD_VERSION_1_0) || defined(BOARD_VERSION_1_1)
184185
Pwrkey_.write(0);
185186
delay(500 + 2);
186187
Pwrkey_.write(1);
@@ -201,7 +202,7 @@ namespace wiocellular
201202
Pwrkey_.write(1);
202203
delay(650 + 2);
203204
Pwrkey_.write(0);
204-
#elif defined(BOARD_VERSION_1_0)
205+
#elif defined(BOARD_VERSION_1_0) || defined(BOARD_VERSION_1_1)
205206
Pwrkey_.write(0);
206207
delay(650 + 2);
207208
Pwrkey_.write(1);
@@ -219,7 +220,8 @@ namespace wiocellular
219220
void reset()
220221
{
221222
#if defined(BOARD_VERSION_ES2)
222-
#elif defined(BOARD_VERSION_1_0)
223+
// Nothing to do
224+
#elif defined(BOARD_VERSION_1_0) || defined(BOARD_VERSION_1_1)
223225
ResetN_.write(0);
224226
delay(100 + 2);
225227
ResetN_.write(1);

0 commit comments

Comments
 (0)