Skip to content

Commit

Permalink
propose a v0 for a registers interface
Browse files Browse the repository at this point in the history
  • Loading branch information
XdoctorwhoZ committed Jun 23, 2024
1 parent 7359e5c commit 44147dc
Showing 1 changed file with 98 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
title: "Registers"
weight: 3
icon: "list_alt"
---

A registers interface allow the user to control a register map with write and read operations.

This document describes the specific attributes of registers interfaces.

Please refer to [API interface](../core.md) to get a generic description of the interface mechanism.

### `[PLATF_00015_00]` - Info

```json
{
"type": "registers",
"version": 0
}
```

## Commands

The command topic for this interface is as follow:

To write a register

```json
{
"cmd": "w",
"index": 0,
"value": 42
}
```

Index is the index of the register in its map, user will probably use address.
In that case, convertion between index and address must be done with settings.base_address and settings.register_size

```
address(index) = base_address + (index x register_size)
index(address) = (address - base_address) / register_size
```

To read 3 register from index 0

```json
{
"cmd": "r",
"index": 0,
"size": 3,
}
```

## Attributes

| Attribute name | Retain Topic |
| :------------- | :----------: |
| map | true |
| settings | true |
| commands | true |

### `[PLATF_00016_00]` - map

This attribute contains a 2 json array:

- 1 for the register map values
- 1 for their last reading millisecond timestamps (0 if never read)

```json
{
"values": [1,2,3],
"timestamps_ms": [0, 111111111, 0]
}
```

### `[PLATF_00017_00]` - settings

| Field name | Description |
| :----------------- | :---------------------------------------: |
| base_address | Base address of the map |
| register_size | size of a unique register (8, 16, 32, 64) |
| number_of_register | total number of register |

```json
{
"base_address": 0,
"register_size": 8,
"number_of_register": 10
}
```

## Changelog

### Version 0

- First Experimentations


0 comments on commit 44147dc

Please sign in to comment.