Skip to content

Commit 74e8f86

Browse files
aykevldeadprogram
authored andcommitted
nrf: clean up code after CGo improvements
Make use of a few new features in TinyGo: * Functions and globals in header files are supported. * Static functions are supported. This allows us to remove workarounds specifically used for the lack of support for static functions.
1 parent 47d5346 commit 74e8f86

19 files changed

+12
-139
lines changed

adapter_nrf51.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
package bluetooth
55

66
/*
7-
// Define SoftDevice functions as regular function declarations (not inline
8-
// static functions).
9-
#define SVCALL_AS_NORMAL_FUNCTION
10-
117
#include "nrf_sdm.h"
128
#include "ble.h"
139
#include "ble_gap.h"

adapter_nrf528xx-full.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ package bluetooth
77
// both central and peripheral mode. This includes S132 and S140.
88

99
/*
10-
// Define SoftDevice functions as regular function declarations (not inline
11-
// static functions).
12-
#define SVCALL_AS_NORMAL_FUNCTION
13-
1410
#include "nrf_sdm.h"
1511
#include "nrf_nvic.h"
1612
#include "ble.h"

adapter_nrf528xx-peripheral.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ package bluetooth
77
// mode support. This includes the S113.
88

99
/*
10-
// Define SoftDevice functions as regular function declarations (not inline
11-
// static functions).
12-
#define SVCALL_AS_NORMAL_FUNCTION
13-
1410
#include "nrf_sdm.h"
1511
#include "nrf_nvic.h"
1612
#include "ble.h"

adapter_nrf528xx.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ package bluetooth
66
// This file defines the SoftDevice adapter for all nrf52-series chips.
77

88
/*
9-
// Define SoftDevice functions as regular function declarations (not inline
10-
// static functions).
11-
#define SVCALL_AS_NORMAL_FUNCTION
12-
139
#include "nrf_sdm.h"
1410
#include "nrf_nvic.h"
1511
#include "ble.h"

adapter_s110.c

Lines changed: 0 additions & 11 deletions
This file was deleted.

adapter_s113v7.c

Lines changed: 0 additions & 22 deletions
This file was deleted.

adapter_s113v7.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ package bluetooth
77
// Add the correct SoftDevice include path to CFLAGS, so #include will work as
88
// expected.
99
#cgo CFLAGS: -Is113_nrf52_7.0.1/s113_nrf52_7.0.1_API/include
10+
11+
#include "nrf_nvic.h"
12+
nrf_nvic_state_t nrf_nvic_state = {0};
1013
*/
1114
import "C"

adapter_s132.c

Lines changed: 0 additions & 22 deletions
This file was deleted.

adapter_s132.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ package bluetooth
77
// Add the correct SoftDevice include path to CFLAGS, so #include will work as
88
// expected.
99
#cgo CFLAGS: -Is132_nrf52_6.1.1/s132_nrf52_6.1.1_API/include
10+
11+
#include "nrf_nvic.h"
12+
nrf_nvic_state_t nrf_nvic_state = {0};
1013
*/
1114
import "C"

adapter_s140v6.c

Lines changed: 0 additions & 22 deletions
This file was deleted.

adapter_s140v6.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ package bluetooth
77
// Add the correct SoftDevice include path to CFLAGS, so #include will work as
88
// expected.
99
#cgo CFLAGS: -Is140_nrf52_6.1.1/s140_nrf52_6.1.1_API/include
10+
11+
#include "nrf_nvic.h"
12+
nrf_nvic_state_t nrf_nvic_state = {0};
1013
*/
1114
import "C"

adapter_s140v7.c

Lines changed: 0 additions & 22 deletions
This file was deleted.

adapter_s140v7.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ package bluetooth
77
// Add the correct SoftDevice include path to CFLAGS, so #include will work as
88
// expected.
99
#cgo CFLAGS: -Is140_nrf52_7.3.0/s140_nrf52_7.3.0_API/include
10+
11+
#include "nrf_nvic.h"
12+
nrf_nvic_state_t nrf_nvic_state = {0};
1013
*/
1114
import "C"

gap_nrf51.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
package bluetooth
55

66
/*
7-
// Define SoftDevice functions as regular function declarations (not inline
8-
// static functions).
9-
#define SVCALL_AS_NORMAL_FUNCTION
10-
117
#include "ble_gap.h"
128
*/
139
import "C"

gap_nrf528xx-advertisement.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import (
99
)
1010

1111
/*
12-
// Define SoftDevice functions as regular function declarations (not inline
13-
// static functions).
14-
#define SVCALL_AS_NORMAL_FUNCTION
15-
1612
#include "ble_gap.h"
1713
*/
1814
import "C"

gap_nrf528xx-central.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import (
1111
)
1212

1313
/*
14-
// Define SoftDevice functions as regular function declarations (not inline
15-
// static functions).
16-
#define SVCALL_AS_NORMAL_FUNCTION
17-
1814
#include "ble_gap.h"
1915
*/
2016
import "C"

gattc_sd.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
package bluetooth
55

66
/*
7-
// Define SoftDevice functions as regular function declarations (not inline
8-
// static functions).
9-
#define SVCALL_AS_NORMAL_FUNCTION
10-
117
#include "ble_gattc.h"
128
*/
139
import "C"

gatts_sd.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
package bluetooth
55

66
/*
7-
// Define SoftDevice functions as regular function declarations (not inline
8-
// static functions).
9-
#define SVCALL_AS_NORMAL_FUNCTION
10-
117
#include "ble_gap.h"
128
#include "ble_gatts.h"
139
*/

uuid_sd.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
package bluetooth
55

66
/*
7-
// Define SoftDevice functions as regular function declarations (not inline
8-
// static functions).
9-
#define SVCALL_AS_NORMAL_FUNCTION
10-
117
#include "ble.h"
128
*/
139
import "C"

0 commit comments

Comments
 (0)