Skip to content

Commit 80e5d8d

Browse files
fix implicit call to nanosleep and use github arm64 beta
1 parent a8ebc73 commit 80e5d8d

7 files changed

Lines changed: 12 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,14 @@ jobs:
6464

6565
build-arm64:
6666
name: Build (ARM64)
67-
runs-on: ubuntu-22.04
68-
container:
69-
image: ubuntu:22.04
70-
# request ARM64 emulation — GitHub runners will use qemu for multiarch containers
71-
options: --platform linux/arm64
72-
67+
runs-on: ubuntu-22.04-arm64 # native ARM64 runner beta support
7368
steps:
7469
- uses: actions/checkout@v4
7570

7671
- name: Install dependencies
7772
run: |
78-
apt-get update
79-
apt-get install -y cmake ninja-build gcc g++ libc6-dev
73+
sudo apt-get update
74+
sudo apt-get install -y cmake ninja-build gcc g++ libc6-dev
8075
8176
- name: Configure
8277
run: cmake -S . -B build -G Ninja -DBUILD_TESTING=ON

examples/c/i2c_scanner/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <stdio.h>
77
#include <stdint.h>
88
#include <sys/types.h>
9+
#include <unistd.h>
910
#include "linux_wire.h"
1011

1112
int main(void)

examples/c/i2c_scanner_strict/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <stdio.h>
77
#include <stdint.h>
88
#include <sys/types.h>
9+
#include <unistd.h>
910
#include "linux_wire.h"
1011

1112
int main(void)

examples/c/master_multiplier/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
* Sends a byte to a device and reads the response (expected multiply result).
44
*/
55

6+
#define _POSIX_C_SOURCE 199309L
67
#include <stdio.h>
78
#include <stdint.h>
89
#include <sys/types.h>
10+
#include <unistd.h>
911
#include <time.h>
1012
#include "linux_wire.h"
1113

examples/c/master_reader/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <stdio.h>
77
#include <stdint.h>
88
#include <sys/types.h>
9+
#include <unistd.h>
910
#include "linux_wire.h"
1011

1112
static const uint16_t DEVICE_ADDR = 0x40;

examples/c/master_writer/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <stdio.h>
77
#include <stdint.h>
88
#include <sys/types.h>
9+
#include <unistd.h>
910
#include "linux_wire.h"
1011

1112
static const uint16_t DEVICE_ADDR = 0x40;

examples/cpp/master_multiplier/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <cstdio>
2-
#include <time.h>
2+
#include <thread>
3+
#include <chrono>
34
#include "Wire.h"
45

56
/*
@@ -33,8 +34,7 @@ int main()
3334
}
3435

3536
// Wait briefly to allow the Nano to process the value (~1ms)
36-
struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000 * 1000 };
37-
nanosleep(&ts, NULL);
37+
std::this_thread::sleep_for(std::chrono::milliseconds(1));
3838

3939
// Request 1 byte back
4040
uint8_t count = Wire.requestFrom(DEVICE_ADDR, (uint8_t)1);

0 commit comments

Comments
 (0)