Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • flow3r/flow3r-firmware
  • Vespasian/flow3r-firmware
  • alxndr42/flow3r-firmware
  • pl/flow3r-firmware
  • Kari/flow3r-firmware
  • raimue/flow3r-firmware
  • grandchild/flow3r-firmware
  • mu5tach3/flow3r-firmware
  • Nervengift/flow3r-firmware
  • arachnist/flow3r-firmware
  • TheNewCivilian/flow3r-firmware
  • alibi/flow3r-firmware
  • manuel_v/flow3r-firmware
  • xeniter/flow3r-firmware
  • maxbachmann/flow3r-firmware
  • yGifoom/flow3r-firmware
  • istobic/flow3r-firmware
  • EiNSTeiN_/flow3r-firmware
  • gnudalf/flow3r-firmware
  • 999eagle/flow3r-firmware
  • toerb/flow3r-firmware
  • pandark/flow3r-firmware
  • teal/flow3r-firmware
  • x42/flow3r-firmware
  • alufers/flow3r-firmware
  • dos/flow3r-firmware
  • yrlf/flow3r-firmware
  • LuKaRo/flow3r-firmware
  • ThomasElRubio/flow3r-firmware
  • ai/flow3r-firmware
  • T_X/flow3r-firmware
  • highTower/flow3r-firmware
  • beanieboi/flow3r-firmware
  • Woazboat/flow3r-firmware
  • gooniesbro/flow3r-firmware
  • marvino/flow3r-firmware
  • kressnerd/flow3r-firmware
  • quazgar/flow3r-firmware
  • aoid/flow3r-firmware
  • jkj/flow3r-firmware
  • naomi/flow3r-firmware
41 results
Show changes
Commits on Source (4)
......@@ -30,6 +30,4 @@ idf_component_register(
plugins/bl00mbox
radspa
extern
REQUIRES
st3m
)
Hi! bl00mbox/radspa is an external project. To find out more or contribute check out https://gitlab.com/moon2embeddedaudio
......@@ -2,10 +2,8 @@
#include "bl00mbox.h"
#include "bl00mbox_plugin_registry.h"
#include "bl00mbox_audio.h"
#include "st3m_audio.h"
void bl00mbox_init(){
bl00mbox_plugin_registry_init();
st3m_audio_set_player_function(bl00mbox_audio_render);
bl00mbox_channels_init();
}
......@@ -246,14 +246,7 @@ void bl00mbox_audio_render(int16_t * rx, int16_t * tx, uint16_t len){
#endif
for(uint16_t i = 0; i < mono_len; i++){
st3m_scope_write((acc[i])>>4);
tx[2*i] = acc[i];
tx[2*i+1] = acc[i];
}
}
// TEMP
void bl00mbox_player_function(int16_t * rx, int16_t * tx, uint16_t len){
bl00mbox_audio_render(rx, tx, len);
}
//SPDX-License-Identifier: CC0-1.0
#pragma once
//TODO: move this to kconfig someday
#define BL00MBOX_MAX_BUFFER_LEN 256
#define BL00MBOX_DEFAULT_CHANNEL_VOLUME 3000
//TODO: move this to kconfig someday?
#define BL00MBOX_MAX_BUFFER_LEN 128
#define BL00MBOX_DEFAULT_CHANNEL_VOLUME 8000
#define BL00MBOX_CHANNELS 32
#define BL00MBOX_BACKGROUND_MUTE_OVERRIDE_ENABLE
//TODO: remove st3m scope dependency
#include "st3m_audio.h"
#include "st3m_scope.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
......
#include "st3m_audio.h"
#include "st3m_scope.h"
#include <math.h>
#include <stdio.h>
......@@ -320,6 +321,9 @@ static void _audio_player_task(void *data) {
UNLOCK;
(*function)(buffer_rx, buffer_tx, FLOW3R_BSP_AUDIO_DMA_BUFFER_SIZE * 2);
for (uint16_t i = 0; i < FLOW3R_BSP_AUDIO_DMA_BUFFER_SIZE; i++) {
st3m_scope_write(buffer_tx[2 * i] >> 2);
}
if (!hwmute && software_mute) {
// Software muting needed. Only used on P1.
......
......@@ -131,6 +131,7 @@ void flow3r_startup(void) {
st3m_scope_init();
st3m_audio_init();
bl00mbox_init();
st3m_audio_set_player_function(bl00mbox_audio_render);
st3m_badgenet_init();
st3m_mode_set(st3m_mode_kind_starting, "micropython");
......
......@@ -6,7 +6,8 @@ from ctx import Context
class Cloud:
def __init__(self, x: float, y: float, z: float) -> None:
def __init__(self, path: str, x: float, y: float, z: float) -> None:
self.path = path
self.x = x
self.y = y
self.z = z
......@@ -14,10 +15,10 @@ class Cloud:
def draw(self, ctx: Context) -> None:
x = self.x / self.z * 120
y = self.y / self.z * 120
width = 200.0 / self.z * 120
height = 100.0 / self.z * 120
width = 200.0 / self.z * 160
height = 100.0 / self.z * 160
ctx.image(
"/flash/sys/apps/clouds/cloud.png",
self.path,
x - width / 2,
y - height / 2,
width,
......@@ -29,11 +30,15 @@ class Clouds(Application):
def __init__(self, app_ctx: ApplicationContext) -> None:
super().__init__(app_ctx)
self.clouds = []
bundle_path = app_ctx.bundle_path
if bundle_path == "":
bundle_path = "/flash/sys/apps/clouds"
for i in range(10):
self.clouds.append(
Cloud(
bundle_path + "/cloud.png",
((random.getrandbits(16) - 32767) / 32767.0) * 200,
((random.getrandbits(16)) / 65535.0) * 50 - 5,
((random.getrandbits(16)) / 65535.0) * 60 - 10,
((random.getrandbits(16)) / 65535.0) * 200 + 5,
)
)
......@@ -41,9 +46,18 @@ class Clouds(Application):
def think(self, ins: InputState, delta_ms: int) -> None:
super().think(ins, delta_ms)
for c in self.clouds:
c.z -= 40 * delta_ms / 1000.0
c.x -= (delta_ms / 1000.0) * ins.imu.acc[1] * 10
c.z -= (delta_ms / 1000.0) * (ins.imu.acc[2] - 5) * 20
# wrap x and z coordinates around
if c.z < 10:
c.z = 300
elif c.z > 300:
c.z = 10
if c.x < -200:
c.x = 200
elif c.x > 200:
c.x = -200
self.clouds = sorted(self.clouds, key=lambda c: -c.z)
def draw(self, ctx: Context) -> None:
......
[app]
name = "Clouds"
menu = "Apps"
menu = "Badge"
[entry]
class = "Clouds"
......
......@@ -4,6 +4,7 @@ from st3m.ui import colours
from st3m.ui.view import BaseView, ViewManager
from st3m.ui.interactions import ScrollController
from ctx import Context
from math import sin
import urequests
import time
from .background import Flow3rView
......@@ -19,6 +20,7 @@ class ViewState(Enum):
class AppList(BaseView):
initial_ticks: int = 0
_scroll_pos: float = 0.0
_state: ViewState = ViewState.INITIAL
apps: list[Any] = []
......@@ -101,13 +103,17 @@ class AppList(BaseView):
ctx.move_to(0, 0)
for idx, app in enumerate(self.apps):
if idx == self._sc.target_position():
target = idx == self._sc.target_position()
if target:
ctx.gray(0.0)
else:
ctx.gray(1.0)
if abs(self._sc.current_position() - idx) <= 5:
ctx.move_to(0, offset)
xpos = 0.0
if target and (width := ctx.text_width(app["name"])) > 220:
xpos = sin(self._scroll_pos) * (width - 220) / 2
ctx.move_to(xpos, offset)
ctx.text(app["name"])
offset += 30
......@@ -147,11 +153,14 @@ class AppList(BaseView):
return
self.background.think(ins, delta_ms)
self._scroll_pos += delta_ms / 1000
if self.input.buttons.app.left.pressed:
self._sc.scroll_left()
self._scroll_pos = 0.0
elif self.input.buttons.app.right.pressed:
self._sc.scroll_right()
self._scroll_pos = 0.0
elif self.input.buttons.app.middle.pressed:
if self.vm is None:
raise RuntimeError("vm is None")
......
from st3m.goose import Optional
from st3m.goose import Optional, Tuple, List, Any
from typing import overload
STA_IF: int
......@@ -8,3 +9,33 @@ class WLAN:
def connect(self, ssid: bytes, key: Optional[bytes] = None) -> None: ...
def isconnected(self) -> bool: ...
def status(self, s: str) -> float: ...
def scan(self) -> List[Tuple[bytes, bytes, int, int, int, bool]]: ...
@overload
def ifconfig(self) -> Tuple[str, str, str, str]: ...
@overload
def ifconfig(self, cfg: Optional[Tuple[str, str, str, str]]) -> None: ...
@overload
def config(self, setting: str) -> Any: ...
@overload
def config(
self,
*,
mac: bytes = b"",
ssid: str = "",
channel: int = 0,
hidden: bool = False,
security: int = 0,
key: str = "",
reconnects: int = 0,
txpower: float = 0.0,
pm: int = 0,
) -> None: ...
@overload
def country() -> str: ...
@overload
def country(country_code: str) -> None: ...
@overload
def hostname() -> str: ...
@overload
def hostname(hostname: str) -> None: ...
from typing import Any
from typing import Any, Dict, Optional
class Response:
text: str
content: bytes
status_code: int
headers: Dict[str, str]
def close(self) -> None: ...
def json(self) -> Any: ...
def request(
method: str, url: str, data: Any, json: Any, headers: dict[str, str]
method: str,
url: str,
data: Any = None,
json: Any = None,
headers: Optional[Dict[str, str]] = None,
) -> Response: ...
def head(
url: str,
data: Any = None,
json: Any = None,
headers: Optional[Dict[str, str]] = None,
) -> Response: ...
def get(
url: str,
data: Any = None,
json: Any = None,
headers: Optional[Dict[str, str]] = None,
) -> Response: ...
def post(
url: str,
data: Any = None,
json: Any = None,
headers: Optional[Dict[str, str]] = None,
) -> Response: ...
def put(
url: str,
data: Any = None,
json: Any = None,
headers: Optional[Dict[str, str]] = None,
) -> Response: ...
def patch(
url: str,
data: Any = None,
json: Any = None,
headers: Optional[Dict[str, str]] = None,
) -> Response: ...
def delete(
url: str,
data: Any = None,
json: Any = None,
headers: Optional[Dict[str, str]] = None,
) -> Response: ...
def head(url: str, **kw: Any) -> Response: ...
def get(url: str, **kw: Any) -> Response: ...
def post(url: str, **kw: Any) -> Response: ...
def put(url: str, **kw: Any) -> Response: ...
def patch(url: str, **kw: Any) -> Response: ...
def delete(url: str, **kw: Any) -> Response: ...