Skip to content

Commit

Permalink
Add yotta config section to pxt.json doc page (#9637)
Browse files Browse the repository at this point in the history
* add yotta config subsection to pxt.json page

* restate no platform reference

* wrong place for this subsection

* add link to config examples

* help that last sentence some
  • Loading branch information
ganicke authored Aug 11, 2023
1 parent dee839c commit 20e0eaa
Showing 1 changed file with 48 additions and 2 deletions.
50 changes: 48 additions & 2 deletions docs/extensions/pxt-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ is described by the `pxt.json` file. To show a real example, here is the [pxt.js

The `pxt.json` is described by the interface `PackageConfig` in [pxtpackage.d.ts](https://github.com/microsoft/pxt/blob/master/localtypings/pxtpackage.d.ts#L15-L43):

## ~ hint
### ~ hint

#### Package terminology

**Packages** are now referred to as **extensions**. The use of the _package_ name in identifiers implies _extension_.

## ~
### ~

```typescript-ignore
interface PackageConfig {
Expand Down Expand Up @@ -182,3 +184,47 @@ C++ code doesn't change and re-compilation (and thus cloud round-trip) is not re

[adafruit]: https://github.com/microsoft/pxt-adafruit
[common-packages]: https://github.com/microsoft/pxt-common-packages

## Setting C++ constants for DAL config - yotta

Constants defined to form part of the `config.h` file for the the DAL platform used in the build are set in the `"yotta"` section. The `config` type is either `codal` or `microbit-dal`:

CODAL example:

```json
"yotta": {
"config": {
"codal": {
"component_count": 64,
"dmesg_buffer_size": 1024
}
}
}
```

micro:bit DAL example:

```json
"yotta": {
"config": {
"microbit-dal": {
"bluetooth": {
"enabled": 1
}
}
}
}
```

If not referring to a specific DAL platform, define simple `cpp` constants like this:

```json
"yotta": {
"config": {
"DEVICE_USB": 1,
"DEVICE_MOUSE": 1
}
}
```

See this [sample repo](https://github.com/lancaster-university/microbit-samples) for `config.json` examples of setting various hardware device constants.

0 comments on commit 20e0eaa

Please sign in to comment.