You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All GPIO functions have an internal `wasm_exec_env_t` parameter that is used by the Ocre runtime. This parameter is NOT needed when calling these functions from within a container. Container applications should omit this parameter.
85
-
86
82
---
87
83
88
84
## Methods
@@ -231,28 +227,6 @@ int ocre_gpio_unregister_callback(int pin);
231
227
|`0`| on success |
232
228
| negative value | on error |
233
229
234
-
### Get Pin ID
235
-
236
-
Calculates a pin ID from port and pin numbers.
237
-
238
-
```c
239
-
intget_pin_id(int port, int pin);
240
-
```
241
-
242
-
**Parameters**:
243
-
244
-
| Name | Type | Description |
245
-
| ------ | ------ | ----------- |
246
-
| `port` | *int* | GPIO port number |
247
-
| `pin` | *int* | Pin number within the port |
248
-
249
-
**Returns**:
250
-
251
-
| Value | Description |
252
-
| ------ | ----------- |
253
-
| positive value (pin ID) | on success |
254
-
| `-1` | on error |
255
-
256
230
---
257
231
258
232
## Error Handling
@@ -380,52 +354,6 @@ int main() {
380
354
}
381
355
```
382
356
383
-
### Using Port and Pin Mapping
384
-
385
-
```c
386
-
#include <stdio.h>
387
-
#include "ocre_gpio.h"
388
-
389
-
#define GPIO_PORT_A 0
390
-
#define GPIO_PIN_5 5
391
-
392
-
int main() {
393
-
// Initialize GPIO subsystem
394
-
if (ocre_gpio_init() != 0) {
395
-
printf("Failed to initialize GPIO\n");
396
-
return -1;
397
-
}
398
-
399
-
// Calculate pin ID from port and pin
400
-
int pin_id = get_pin_id(GPIO_PORT_A, GPIO_PIN_5);
401
-
if (pin_id < 0) {
402
-
printf("Invalid port or pin\n");
403
-
return -1;
404
-
}
405
-
406
-
// Configure the pin as output
407
-
ocre_gpio_config_t config;
408
-
config.pin = pin_id;
409
-
config.direction = OCRE_GPIO_DIR_OUTPUT;
410
-
411
-
if (ocre_gpio_configure(&config) != 0) {
412
-
printf("Failed to configure GPIO pin\n");
413
-
return -1;
414
-
}
415
-
416
-
// Toggle the pin 10 times
417
-
for (int i = 0; i < 10; i++) {
418
-
ocre_gpio_pin_toggle(pin_id);
419
-
printf("Pin toggled\n");
420
-
421
-
// Delay (implementation-specific)
422
-
for (volatile int j = 0; j < 500000; j++);
423
-
}
424
-
425
-
return 0;
426
-
}
427
-
```
428
-
429
357
---
430
358
431
359
## Reference
@@ -438,5 +366,4 @@ int main() {
438
366
| [`ocre_gpio_pin_get`](#get-gpio-pin-state) | Gets a GPIO pin state | `pin`: GPIO pin number | `OCRE_GPIO_PIN_SET`/`OCRE_GPIO_PIN_RESET` or negative error code | `ENODEV`, `EINVAL` |
439
367
| [`ocre_gpio_pin_toggle`](#toggle-gpio-pin) | Toggles a GPIO pin state | `pin`: GPIO pin number | `0` on success, negative on error | `ENODEV`, `EINVAL` |
440
368
| [`ocre_gpio_register_callback`](#register-gpio-callback) | Registers callback for GPIO changes | `pin`: GPIO pin number<br/>`callback`: Callback function | `0` on success, negative on error | `ENODEV`, `EINVAL` |
441
-
|[`ocre_gpio_unregister_callback`](#unregister-gpio-callback)| Removes GPIO callback |`pin`: GPIO pin number |`0` on success, negative on error |`ENODEV`, `EINVAL`|
442
-
|[`get_pin_id`](#get-pin-id)| Calculates pin ID from port and pin |`port`: GPIO port number<br/>`pin`: Pin number within port | Pin ID or `-1` on invalid Pin | N/A |
369
+
| [`ocre_gpio_unregister_callback`](#unregister-gpio-callback) | Removes GPIO callback | `pin`: GPIO pin number | `0` on success, negative on error | `ENODEV`, `EINVAL` |
Copy file name to clipboardExpand all lines: docs/reference/apis/container-api/inter-container-messaging.md
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,13 @@ Navigate this comprehensive API reference using the links below.
36
36
37
37
---
38
38
39
+
40
+
## Execution Environment
41
+
42
+
All messaging functions have an internal `wasm_exec_env_t` parameter that is used by the Ocre runtime. This parameter is NOT needed when calling these functions from within a container. Container applications should omit this parameter.
int ocre_publish_message(wasm_exec_env_t exec_env, char *topic, char *content_type, void *payload, int payload_len);
82
+
int ocre_publish_message(char *topic, char *content_type, void *payload, int payload_len);
76
83
```
77
84
78
85
Fails if the messaging system is not initialized, if `topic`, `content_type`, or `payload` is `NULL`/empty, if `payload_len` is `0`, or if the message queue is full.
@@ -99,7 +106,7 @@ Fails if the messaging system is not initialized, if `topic`, `content_type`, or
Copy file name to clipboardExpand all lines: docs/reference/apis/container-api/sensors.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,12 @@ Navigate this comprehensive API reference using the links below.
35
35
36
36
---
37
37
38
+
## Execution Environment
39
+
40
+
All sensor functions have an internal `wasm_exec_env_t` parameter that is used by the Ocre runtime. This parameter is NOT needed when calling these functions from within a container. Container applications should omit this parameter.
41
+
42
+
---
43
+
38
44
## Types
39
45
40
46
### Sensor Callback Function
@@ -127,10 +133,6 @@ typedef enum {
127
133
} ocre_sensors_status_t;
128
134
```
129
135
130
-
### Execution Environment
131
-
132
-
All sensor functions have an internal `wasm_exec_env_t` parameter that is used by the Ocre runtime. This parameter is NOT needed when calling these functions from within a container. Container applications should omit this parameter.
Copy file name to clipboardExpand all lines: docs/reference/apis/container-api/timers.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,12 @@ Navigate this comprehensive API reference using the links below.
35
35
36
36
---
37
37
38
+
## Execution Environment
39
+
40
+
All timer functions have an internal `wasm_exec_env_t` parameter that is used by the Ocre runtime. This parameter is NOT needed when calling these functions from within a container. Container applications should omit this parameter.
41
+
42
+
---
43
+
38
44
## Types
39
45
40
46
### Timer Callback Function
@@ -53,10 +59,6 @@ typedef int ocre_timer_t;
53
59
54
60
Each timer is assigned a unique ID between `1` and `MAX_TIMERS`, which is used to reference the timer in all operations after creation. The timer handle is an opaque identifier that abstracts the underlying timer implementation.
55
61
56
-
### Execution Environment
57
-
58
-
All timer functions have an internal `wasm_exec_env_t` parameter that is used by the Ocre runtime. This parameter is NOT needed when calling these functions from within a container. Container applications should omit this parameter.
2.**[Container Runtime API:](../apis/runtime-api)** The API for managing the Ocre container runtime environment itself, including container lifecycle operations. The Runtime API is intended for system implementors and integrators looking to incorporate the Ocre runtime into their own solutions.
0 commit comments