An open API service indexing awesome lists of open source software.

https://github.com/jotsr/pita-template

Template for Pita projects, simpliest way to develop secure and powerful webapps for redpitaya.
https://github.com/jotsr/pita-template

cargo deno redpitaya rust template typescript

Last synced: about 2 months ago
JSON representation

Template for Pita projects, simpliest way to develop secure and powerful webapps for redpitaya.

Awesome Lists containing this project

README

          


logo

Pita template


Simpliest way to develop secure and powerful webapps for redpitaya.


![GitHub](https://img.shields.io/github/license/JOTSR/pita-template?style=flat-square)
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/JOTSR/pita-template?style=flat-square)

Simpliest way to develop secure and powerful app for redpitaya.

Pita 🫓 template to scaffold and manage webapp for
[redpitaya](https://redpitaya.com/). Pita allows you to code, build and
implement your webapp with a robust and secure environement. It handle all your
workflow, from tooling installation to testing, benching and publishing.

Pita project resides in:
|[pita cli](https://deno.land/x/pita)|[pita api](https://deno.land/x/pita_api)|[pita template](https://github.com/JOTSR/pita-template)|
|:------:|:-----:|:-----:|
|[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/JOTSR/pita-cli?style=flat-square)](https://github.com/JOTSR/pita-cli)|[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/JOTSR/pita-api?style=flat-square)](https://github.com/JOTSR/pita-api)|[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/JOTSR/pita-template?style=flat-square)](https://github.com/JOTSR/pita-template)|
||[![deno doc](https://img.shields.io/static/v1?logo=deno&label=deno&message=doc&color=blue&style=flat-square)](https://deno.land/x/pita_api/mod.ts)||

Project are customizable, by default:

- frontend is in typescript/tsx
- backend is in rust
- fpga is in verilog

All app is builded in www/ and sended to repitaya board.

## Getting started

Use pita cli or tasks described in [deno.jsonc](./deno.jsonc)

### With [Pita cli](https://github.com/JOTSR/pita-cli):

1. Only once, ensure tools and workflow configuration.
```sh
pita requirements --check
```
2. Init a new project.
```sh
pita init
```
3. Build sources and implement it on the board.
```sh
pita run
```

### Without Pita cli

1. Check tools.
1. Required: deno, rustup, vivado, ssh, scp.
2. Recommanded: vscode, git.
2. Clone this repositor.
3. Edit [.pita/project.json](.pita/project.json) with your host configuration
and a new valid uuid.
4. Build sources.
```sh
deno task build
```
5. Connect to your board and enable write access.
```sh
root@rp-XXXX: rw
```
6. Optionnaly copy your ssh credentials to avoid password.
7. Implement build on board.
```sh
deno task implement
```
8. Open redpitaya app menu on your browser and test your webapp.

## Structure


.
├── 🔵 backend (interface between client and redpitaya fpga/cpu)
├── 🟡 deno.jsonc (tasks)
├── 🔵 fpga (???? bitstream - fpga project structure)
├── 🔵 frontend (client-size application)
│   ├── 🔴 app.tsx (app entry-point)
│   ├── 🔵 components (component lib for building your own panels)
│   └── 🔵 panels (control panels to monitor and pilot board IOs and state)
├── 🟡 import_map.json (js path resolution)
└── 🔵 www (dist app folder)
├── 🔵 bin (temp c++ backend interface)
├── 🟡 fpga.* (fpga bitstream loading)
├── 🔴 index.html (server-side app entry point)
├── 🔵 info
│   ├── 🟢 favicon.png (browser icon)
│   ├── 🟢 icon.png (redpitaya menu icon)
│   └── 🟡 info.json (app info, do not manually edit version and revision)
└── 🔵 src (build assets, do not edit)

🔵 directory
🔴 entrypoint
🟢 assets
🟡 config

## Operating diagrams

```mermaid
---
title: Client side web app structure links
---
flowchart TB
subgraph client [Client browser]
direction TB
api[Pita API]
subgraph panels [Panels/Workers]
direction LR
panel1[Panel example 1]
panel2[Panel example 2]
webwk1[Worker example - specific code]
end

api -- Readable stream --> panels
panels -- Writable stream --> api
end
subgraph rp [Redpitaya board]
direction TB
server[NGNIX Server]
end

api -- HTTP controller init request --> server
api <-- Websocket --> server
```

```mermaid
---
title: Server side web app structure links
---
flowchart TB
subgraph client [Client browser]
direction TB
api[Pita API]
end
subgraph rp [Redpitaya board]
direction TB
subgraph cpu [CPU]
server[NGNIX Server]
controller[Controller]
sdk[Redpitaya SDK]
subgraph workers [Workers]
wk1[Specific code - ex. Kalman]
wk2[Specific code - ex. langevin]
end

server -- Events --> controller
controller -- Messages --> server
controller <--> sdk
workers <-- Datas --> controller
end
subgraph fpga [FPGA]
fft[FFT IP CORE]
firmware[Redpitaya FPGA Firmware]
custom[Custom HDL]
end
subgraph IOs [IOs]
leds[Led 0:7]
digital[Digital 0:16]
analog[Analog 0:7]
dac[DAC 0:1]
adc[ADC 0:1]
end
ram[RAM]

sdk <--> ram
IOs <--> ram
fpga <--> ram
end

api -- HTTP controller init request --> server
api <-- Websocket --> server
```

```mermaid
---
title: Example of led switch panel communication
---
sequenceDiagram
participant Panel as Led 7 Switch Panel
participant Pita as Pita API
participant Server as NGNIX Server
participant Controller as Controller
participant Led as Led 7

Pita->>Server: HTTP request to register controller
note right of Pita: Websocket only below
loop
Server-)Pita: Signals and Parameters
end
Panel->>Panel: Switch On
Panel-)Pita: Write state on led 7
Pita-)Server: Parameters for led state
Server->>Controller: Trigger parameters event
Controller->>Led: Write hight state on led 7
```

## Contributing

Read [CONTRIBUTING](./CONTRIBUTING.md) and start a codespace or clone this
repository.

Folow conventionnal commit, document your code and, use deno or rust style
coventions on the corresponding directories.

Link your PR with the corresponding issue if it exists.