Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/quickstart/firmware/hardware.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ To flash the Ocre Runtime to your device follow these steps:
```
3. After flashing, restart/reset your board to run the application. If successful, you should see the following output on your console:

![](../success.png)
```sh
ocre:~$

Ocre runtime started
Hello world from Ocre.
```

---

Expand Down
7 changes: 6 additions & 1 deletion docs/quickstart/firmware/simulated.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ To run the application, simply run the following command:

If successful, you should see the following output:

![](../success.png)
```sh
ocre:~$

Ocre runtime started
Hello world from Ocre.
```

---

Expand Down
Binary file removed docs/quickstart/firmware/success.png
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: GPIO
layout: default
parent: Container APIs
parent: Container
has_toc: false
---

Expand Down Expand Up @@ -439,4 +439,4 @@ int main() {
| [`ocre_gpio_pin_toggle`](#toggle-gpio-pin) | Toggles a GPIO pin state | `pin`: GPIO pin number | `0` on success, negative on error | `ENODEV`, `EINVAL` |
| [`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` |
| [`ocre_gpio_unregister_callback`](#unregister-gpio-callback) | Removes GPIO callback | `pin`: GPIO pin number | `0` on success, negative on error | `ENODEV`, `EINVAL` |
| [`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 |
| [`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 |
23 changes: 23 additions & 0 deletions docs/reference/apis/container-api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Container
layout: default
parent: APIs
has_toc: false
---
# Container APIs

Container APIs provide direct interfaces for containers to efficiently interact with underlying system resources and capabilities. Designed with simplicity, security, and consistency in mind, these APIs follow well-defined patterns to facilitate ease of use and seamless integration.

---

## Available APIs

Below are the core APIs available for Ocre containers. Each API includes detailed documentation with usage examples, error handling patterns, and best practices.

### System Interaction

| API | Description |
|-----|-------------|
| **[GPIO](gpio)** | Control digital pins for input/output operations with hardware peripherals and external components |
| **[Sensors](sensors)** | Interface with hardware sensors for environmental and motion data |
| **[Timers](timers)** | Create and manage timed events with millisecond precision |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Sensors
layout: default
parent: Container APIs
parent: Container
---

# Sensors
Expand Down Expand Up @@ -58,7 +58,7 @@ typedef struct ocre_sensor_handle_t {
} ocre_sensor_handle_t;
```

The sensor handle contains a unique ID, device name, and a reference to the underlying device structure. It is used to reference a specific sensor in all operations.
The sensor handle contains a unique `ID`, device name, and a reference to the underlying device structure. It is used to reference a specific sensor in all operations.

### Sensor Instance

Expand Down Expand Up @@ -169,8 +169,8 @@ ocre_sensors_status_t ocre_sensors_discover_sensors(ocre_sensor_t *sensors, int

| Name | Type | Description |
| ------ | ------ | ----------- |
| `sensors` | *ocre_sensor_t** | Pointer to the sensor list to store the discovered info about available sensors |
| `sensors_count` | *int** | Pointer to variable to store the number of discovered sensors |
| `sensors` | *ocre_sensor_t* * | Pointer to the sensor list to store the discovered info about available sensors |
| `sensors_count` | *int* * | Pointer to variable to store the number of discovered sensors |

**Returns**:

Expand All @@ -191,7 +191,7 @@ ocre_sensors_status_t ocre_sensors_open(ocre_sensor_handle_t *sensor_handle);

| Name | Type | Description |
| ------ | ------ | ----------- |
| `sensor_handle` | *ocre_sensor_handle_t** | Pointer to the sensor handle to open |
| `sensor_handle` | *ocre_sensor_handle_t* * | Pointer to the sensor handle to open |

**Returns**:

Expand All @@ -213,7 +213,7 @@ ocre_sensors_sample_t sensor_read_sample(ocre_sensor_handle_t *sensor_handle);

| Name | Type | Description |
| ------ | ------ | ----------- |
| `sensor_handle` | *ocre_sensor_handle_t** | Pointer to the sensor handle to read from |
| `sensor_handle` | *ocre_sensor_handle_t* * | Pointer to the sensor handle to read from |

**Returns**:

Expand Down Expand Up @@ -264,7 +264,7 @@ ocre_sensors_status_t ocre_sensors_set_trigger(ocre_sensor_handle_t sensor_handl
| `channel` | *sensor_channel_t* | Channel to set the trigger on |
| `trigger_type` | *enum sensor_trigger_type* | Type of trigger (e.g., data ready, threshold) |
| `callback` | *ocre_sensor_trigger_cb* | Function to be called when trigger occurs |
| `subscription_id` | *int** | Pointer to store the subscription ID |
| `subscription_id` | *int* * | Pointer to store the subscription `ID` |

**Returns**:

Expand All @@ -288,7 +288,7 @@ ocre_sensors_status_t ocre_sensors_clear_trigger(ocre_sensor_handle_t sensor_han
| ------ | ------ | ----------- |
| `sensor_handle` | *ocre_sensor_handle_t* | Handle of the sensor |
| `channel` | *sensor_channel_t* | The specific channel (e.g., `SENSOR_CHANNEL_TEMPERATURE`) from which the trigger should be removed |
| `subscription_id` | *int* | ID of the subscription to remove |
| `subscription_id` | *int* | `ID` of the subscription to remove |

**Returns**:

Expand Down Expand Up @@ -463,6 +463,6 @@ int main() {
| [`ocre_sensors_open`](#open-sensor) | Opens sensor | `sensor_handle`: Sensor to open | Status code | `SENSOR_API_STATUS_OK`,<br/>`SENSOR_API_STATUS_ERROR` |
| [`sensor_read_sample`](#read-sensor-sample) | Reads sensor data | `sensor_handle`: Sensor to read from | `ocre_sensors_sample_t` structure | N/A |
| [`sensor_get_channel`](#get-sensor-channel) | Gets channel data | `sample`: Sensor sample<br/>`channel`: Channel to retrieve | `ocre_sensor_value_t` structure | N/A |
| [`ocre_sensors_set_trigger`](#set-sensor-trigger) | Sets sensor trigger | `sensor_handle`: Target sensor<br/>`channel`: Target channel<br/>`trigger_type`: Trigger type<br/>`callback`: Callback function<br/>`subscription_id`: ID output | Status code | `SENSOR_API_STATUS_OK`,<br/>`SENSOR_API_STATUS_ERROR` |
| [`ocre_sensors_set_trigger`](#set-sensor-trigger) | Sets sensor trigger | `sensor_handle`: Target sensor<br/>`channel`: Target channel<br/>`trigger_type`: Trigger type<br/>`callback`: Callback function<br/>`subscription_id`: `ID` output | Status code | `SENSOR_API_STATUS_OK`,<br/>`SENSOR_API_STATUS_ERROR` |
| [`ocre_sensors_clear_trigger`](#clear-sensor-trigger) | Removes sensor trigger | `sensor_handle`: Target sensor<br/>`channel`: Target channel<br/>`subscription_id`: Subscription to remove | Status code | `SENSOR_API_STATUS_OK`,<br/>`SENSOR_API_STATUS_ERROR` |
| [`ocre_sensors_cleanup`](#clean-up-sensor-environment) | Cleans up resources | None | Status code | `SENSOR_API_STATUS_OK`,<br/>`SENSOR_API_STATUS_ERROR` |
| [`ocre_sensors_cleanup`](#clean-up-sensor-environment) | Cleans up resources | None | Status code | `SENSOR_API_STATUS_OK`,<br/>`SENSOR_API_STATUS_ERROR` |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Timers
layout: default
parent: Container APIs
parent: Container
---

# Timers
Expand Down
27 changes: 27 additions & 0 deletions docs/reference/apis/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: APIs
layout: default
parent: Reference
has_toc: false
---

# APIs

This page provides an overview of the Application Programming Interfaces (APIs) available in the Ocre platform. These APIs allow developers to interact with various features of the Ocre runtime and create containerized applications.

---

## Overview

Ocre provides *two* primary categories of APIs:

1. **[Container APIs:](../apis/container-api)** APIs that are accessible from within containers and allow applications to interact with hardware, timers, and other system resources. These are designed for application developers building solutions that will run within Ocre containers.

2. **[Runtime API:](../apis/runtime-api)** The API for managing the Ocre 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.


---

## Next Steps

Check out some of the the [Sample Applications](../../samples) for practical examples using these APIs
Loading
Loading