Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e008c8

Browse filesBrowse files
authored
Merge branch 'master' into mixing_digital_analog_read_write
2 parents 8cd18ac + 9e2f755 commit 7e008c8
Copy full SHA for 7e008c8

File tree

Expand file treeCollapse file tree

2 files changed

+50
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+50
-2
lines changed

‎cores/esp32/esp32-hal-misc.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-misc.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "esp_ota_ops.h"
2626
#endif //CONFIG_APP_ROLLBACK_ENABLE
2727
#include "esp_private/startup_internal.h"
28-
#ifdef CONFIG_BT_ENABLED
28+
#if defined(CONFIG_BT_ENABLED) && SOC_BT_SUPPORTED
2929
#include "esp_bt.h"
3030
#endif //CONFIG_BT_ENABLED
3131
#include <sys/time.h>
@@ -305,7 +305,7 @@ void initArduino() {
305305
if (err) {
306306
log_e("Failed to initialize NVS! Error: %u", err);
307307
}
308-
#ifdef CONFIG_BT_ENABLED
308+
#if defined(CONFIG_BT_ENABLED) && SOC_BT_SUPPORTED
309309
if (!btInUse()) {
310310
esp_bt_controller_mem_release(ESP_BT_MODE_BTDM);
311311
}

‎tests/validation/i2c_master/i2c_master.ino

Copy file name to clipboardExpand all lines: tests/validation/i2c_master/i2c_master.ino
+48Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
#include <Arduino.h>
66
#include <unity.h>
77
#include <Wire.h>
8+
#include <vector>
9+
#include <algorithm>
10+
#include <WiFi.h>
11+
12+
#include "sdkconfig.h"
813

914
/* DS1307 functions */
1015

@@ -24,6 +29,9 @@ static uint8_t read_month = 0;
2429
static uint16_t read_year = 0;
2530
static int peek_data = -1;
2631

32+
const char *ssid = "Wokwi-GUEST";
33+
const char *password = "";
34+
2735
const auto BCD2DEC = [](uint8_t num) -> uint8_t {
2836
return ((num / 16 * 10) + (num % 16));
2937
};
@@ -245,6 +253,42 @@ void test_api() {
245253
Wire.flush();
246254
}
247255

256+
bool device_found() {
257+
uint8_t err;
258+
259+
for (uint8_t address = 1; address < 127; ++address) {
260+
Wire.beginTransmission(address);
261+
err = Wire.endTransmission();
262+
log_d("Address: 0x%02X, Error: %d", address, err);
263+
if (err == 0) {
264+
log_i("Found device at address: 0x%02X", address);
265+
} else if (address == DS1307_ADDR) {
266+
log_e("Failed to find DS1307");
267+
return false;
268+
}
269+
}
270+
271+
return true;
272+
}
273+
274+
void scan_bus() {
275+
TEST_ASSERT_TRUE(device_found());
276+
}
277+
278+
#if SOC_WIFI_SUPPORTED
279+
void scan_bus_with_wifi() {
280+
// delete old config
281+
WiFi.disconnect(true, true, 1000);
282+
delay(1000);
283+
WiFi.begin(ssid, password);
284+
delay(5000);
285+
bool found = device_found();
286+
WiFi.disconnect(true, true, 1000);
287+
288+
TEST_ASSERT_TRUE(found);
289+
}
290+
#endif
291+
248292
/* Main */
249293

250294
void setup() {
@@ -258,6 +302,10 @@ void setup() {
258302

259303
log_d("Starting tests");
260304
UNITY_BEGIN();
305+
RUN_TEST(scan_bus);
306+
#if SOC_WIFI_SUPPORTED
307+
RUN_TEST(scan_bus_with_wifi);
308+
#endif
261309
RUN_TEST(rtc_set_time);
262310
RUN_TEST(rtc_run_clock);
263311
RUN_TEST(change_clock);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.