Adapted to cinterop now capable of #define foo "bar".
This commit is contained in:
committed by
alexander-gorshenev
parent
0de9b3a9b6
commit
feaf220f5b
@@ -18,13 +18,3 @@
|
|||||||
headers = autoconf.h zephyr.h board.h device.h gpio.h
|
headers = autoconf.h zephyr.h board.h device.h gpio.h
|
||||||
compilerOpts = -DKERNEL -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -D_FORTIFY_SOURCE=2 -D__ZEPHYR__=1 -ffreestanding -std=c99 -nostdinc
|
compilerOpts = -DKERNEL -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -D_FORTIFY_SOURCE=2 -D__ZEPHYR__=1 -ffreestanding -std=c99 -nostdinc
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
// cinterop doesn't support `#define FOO "string"` constructs as of yet.
|
|
||||||
// so we provide this accessor for now. Because the port names
|
|
||||||
// are resolved to string literals.
|
|
||||||
|
|
||||||
extern const char* led0_gpio_port(void) {
|
|
||||||
return LED0_GPIO_PORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ import kotlinx.cinterop.*
|
|||||||
|
|
||||||
fun blinky(value: Int) {
|
fun blinky(value: Int) {
|
||||||
|
|
||||||
// See the .def file for details of led0_gpio_port()
|
val port = LED0_GPIO_PORT
|
||||||
val port = led0_gpio_port()!!.toKString()
|
|
||||||
val led = LED0_GPIO_PIN
|
val led = LED0_GPIO_PIN
|
||||||
var toggler = false
|
var toggler = false
|
||||||
val dev = device_get_binding(port)
|
val dev = device_get_binding(port)
|
||||||
|
|||||||
Reference in New Issue
Block a user