Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement wrappers for GUI APIs #29

Draft
wants to merge 60 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c4f990b
feat: implement wrapper for `ViewPort` API
JarvisCraft Dec 31, 2022
ebf0cb1
feat: implement basic APIs of `canvas` and `gui`
JarvisCraft Jan 1, 2023
1bb29b7
Merge remote-tracking branch 'upstream/main' into gui-bindings
JarvisCraft Jan 1, 2023
1d087b3
fix: revert changes to `bindings.rs`
JarvisCraft Jan 1, 2023
38a04c0
fix: resolve issues with `canvas.rs`
JarvisCraft Jan 1, 2023
164eb82
feat: implement test callback support
JarvisCraft Jan 2, 2023
3f4c26b
feat: no vcall callbacks
JarvisCraft Jan 2, 2023
aaa4eb0
feat: implement effective callback API
JarvisCraft Jan 2, 2023
3783da9
refactor: make `as_raw` safe
JarvisCraft Jan 3, 2023
a7beba0
feat: make `gui` example fully safe
JarvisCraft Jan 3, 2023
7a9f9e9
feat: add `icon` and `icon_animation`
JarvisCraft Jan 4, 2023
fd16159
feat: add more drawing methods to `canvas`
JarvisCraft Jan 5, 2023
49ea98c
feat: add `xbm!` macro
JarvisCraft Jan 5, 2023
4008c30
fix: use correct XBM endianness
JarvisCraft Jan 5, 2023
79a0c9e
refactor: make XbmImage generic
JarvisCraft Jan 5, 2023
e248c56
chore: use `XbmImage::new_from_array` where possible
JarvisCraft Jan 5, 2023
c903808
chore: minor cleanups in core APIs
JarvisCraft Jan 14, 2023
2c392bb
Merge remote-tracking branch 'upstream/main' into gui-bindings
JarvisCraft Jan 14, 2023
da0e7c2
refactor: move gui APIs to `flipperzero`
JarvisCraft Jan 14, 2023
0898485
chore: make `dialogs` service depend on `gui` service
JarvisCraft Jan 14, 2023
cc85081
chore: resolve most TODOs in `IconAnimation`
JarvisCraft Jan 14, 2023
6ece5f2
chore: cleanup `canvas.rs`
JarvisCraft Jan 21, 2023
b95c981
Merge remote-tracking branch 'origin/main' into gui-bindings
JarvisCraft Feb 16, 2023
012101f
Merge remote-tracking branch 'upstream/main' into gui-bindings
JarvisCraft Feb 16, 2023
902ea0a
feat: add `is_irq_or_masked()`
JarvisCraft Feb 17, 2023
9171372
chore: enhance callbacks implementation
JarvisCraft Feb 23, 2023
3a37055
Merge remote-tracking branch 'origin/main' into gui-bindings
JarvisCraft Mar 11, 2023
2d289a0
chore: remove `.idea` directory
JarvisCraft Mar 11, 2023
4670f74
chore: cleanup macros and internals
JarvisCraft Mar 11, 2023
1dea65d
Merge branch 'main' into gui-bindings
JarvisCraft Mar 18, 2023
7b504d6
docs: enhance exammples of `UnsendUnsync` and `Unsend`
JarvisCraft Jun 3, 2023
097ebca
Merge branch 'main' into gui-bindings
JarvisCraft Jun 3, 2023
f28c4a7
feat: add ident-checks to `xbm` macro
JarvisCraft Jun 3, 2023
b166c5e
fix: correctly set XBM image dimensions
JarvisCraft Jun 3, 2023
045b72f
chore: fix remaining compilation errors
JarvisCraft Jun 3, 2023
3af3d7e
chore: bring back `.vscode`
JarvisCraft Jun 3, 2023
46b7003
docs: enhance alignment of doc attribute in `kernel::LockGuard`
JarvisCraft Jun 3, 2023
2b138c5
chore(gui): flatten module structure
JarvisCraft Jun 3, 2023
b48da0a
test(gui): remove `xbm` tests from `tests_runner` since they require …
JarvisCraft Jun 3, 2023
09d70ed
docs: enable automatic cfg documentation
JarvisCraft Jun 3, 2023
8d689b9
build: specify required example features
JarvisCraft Jun 3, 2023
5de6811
chore: start using `gui` features in `view_dispatcher`
JarvisCraft Jun 3, 2023
1329195
feat: make `images` example almost safe
JarvisCraft Jun 4, 2023
feed3e9
chore: change XMB coordinate formulas
JarvisCraft Jun 4, 2023
025b7f8
fix: resolve math errors in `xbm.rs`
JarvisCraft Jun 4, 2023
e0a0391
docs: fix docs for unstable features
JarvisCraft Jun 4, 2023
5ed96dc
docs: disable scrape examples
JarvisCraft Jun 4, 2023
e8f7708
docs: configure docs.rs metadata in crate root
JarvisCraft Jun 8, 2023
64cf882
Merge branch 'main' into gui-bindings
JarvisCraft Jun 12, 2023
2035e06
chore: move error types to separate files
JarvisCraft Jun 12, 2023
6b48e68
docs: add documentation to error types
JarvisCraft Jun 12, 2023
c06ac5a
fix: do not store `Box`es when their pointers are shared
JarvisCraft Jun 13, 2023
20a6d0e
chore(#29): address initial PR review by @dcoles
JarvisCraft Jun 23, 2023
d587aec
feat: start implementing sound `ViewDispatcher`
JarvisCraft Jun 24, 2023
0a5822f
chore: fix invalid mentions of `ViewPort` with `ViewDispatcher`
JarvisCraft Jul 15, 2023
9ede8a9
chore: continue experimenting with `ViewDispatcher` APIs
JarvisCraft Jul 16, 2023
6a1c1c7
chore: simplify `div_ceil_u8`
JarvisCraft Jul 16, 2023
d8e2db7
Merge branch 'main' into gui-bindings
JarvisCraft Aug 27, 2023
c4d4571
Merge branch 'main' into gui-bindings
JarvisCraft Oct 2, 2023
90eb38b
Merge remote-tracking branch 'upstream/main' into gui-bindings
JarvisCraft Dec 21, 2023
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
6 changes: 6 additions & 0 deletions crates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ repository = "https://github.com/dcoles/flipperzero-rs"
readme = "../README.md"
license = "MIT"

[workspace.metadata.docs.rs]
default-target = "thumbv7em-none-eabihf"
targets = []
all-features = true

[workspace.dependencies]
flipperzero-sys = { path = "sys", version = "0.10.0" }
flipperzero-rt = { path = "rt", version = "0.10.0" }
flipperzero-alloc = { path = "alloc", version = "0.10.0" }
flipperzero-test = { path = "test", version = "0.10.0" }
ufmt = "0.2.0"
document-features = { version = "0.2.0" }

[profile.dev]
opt-level = "z"
Expand Down
5 changes: 0 additions & 5 deletions crates/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ autoexamples = false
autotests = false
autobenches = false

[package.metadata.docs.rs]
default-target = "thumbv7em-none-eabihf"
targets = []
all-features = true

[lib]
bench = false
test = false
Expand Down
4 changes: 4 additions & 0 deletions crates/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
use core::alloc::{GlobalAlloc, Layout};
use core::ffi::c_void;

extern crate alloc;
// re-export all items from `alloc` so that the API user can only extern this crate
pub use alloc::*;

use flipperzero_sys as sys;

pub struct FuriAlloc;
Expand Down
13 changes: 10 additions & 3 deletions crates/build-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
PYTHON = 'python'
TOOLS_PATH = '../tools'
INSTALL_PATH = PurePosixPath('/ext/apps/Examples')
EXAMPLES = ["dialog", "example_images", "gpio", "gui", "hello-rust", "notification", "storage"]
EXAMPLES = ["dialog", "images", "gpio", "gui", "hello-rust", "notification", "storage"]


def parse_args():
Expand All @@ -27,15 +27,22 @@ def main():

for example in EXAMPLES:
logging.info('Building %s', example)
run(['cargo', 'build', '--package', 'flipperzero', '--example', example, '--all-features', '--release'], check=True)
run(
['cargo', 'build', '--package', 'flipperzero', '--example', example, '--all-features', '--release'],
check=True
)

if args.install:
# Assume that the binary has the name as the
binary = Path.cwd() / 'target' / 'thumbv7em-none-eabihf' / 'release' / 'examples' / example
target = INSTALL_PATH / f'{example}.fap'

logging.info('Copying %s to %s', binary, target)
run(['cargo', 'run', '--release', '--bin', 'storage', '--', 'send', os.fspath(binary), os.fspath(target)], cwd=TOOLS_PATH, check=True)
run(
['cargo', 'run', '--release', '--bin', 'storage', '--', 'send', os.fspath(binary), os.fspath(target)],
cwd=TOOLS_PATH,
check=True
)


if __name__ == '__main__':
Expand Down
94 changes: 86 additions & 8 deletions crates/flipperzero/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ license.workspace = true
edition.workspace = true
rust-version.workspace = true
autobins = false
autotests = false
autobenches = false

[package.metadata.docs.rs]
default-target = "thumbv7em-none-eabihf"
targets = []
all-features = true

[lib]
bench = false
harness = false
Expand All @@ -35,6 +29,9 @@ lock_api = "0.4"
digest = "0.10"
bitflags = "1.0"

# Docs
document-features = { workspace = true, optional = true }

[dev-dependencies]
flipperzero-alloc.workspace = true
flipperzero-rt.workspace = true
Expand All @@ -45,20 +42,101 @@ md-5 = { version = "0.10", default-features = false }
sha2 = { version = "0.10", default-features = false }

[features]
# enables features requiring an allocator

## Default features.
default = []

## Enables features requiring an allocator.
##
## This will require you to set up an allocator such as by the following:
##
## ```
## extern crate flipperzero_alloc as alloc;
## ```
##
## Note that the `as alloc` part is optional but is helpful
## if you want to reference items from `alloc` crate all of which are re-exported by `flipperzero_alloc`
## such as `alloc::string::ToString` instead of `flipperzero_alloc::string::ToString`.
alloc = []

#! ## Service features.
#!
#! These enables specific Flipper Service APIs.

## enables all Service APIs
all-services = [
"service-storage",
"service-notification",
"service-input",
"service-toolbox",
JarvisCraft marked this conversation as resolved.
Show resolved Hide resolved
"service-gui",
"service-dialogs",
"service-dolphin",
]
## Enables Storage Service APIs.
service-storage = []
## Enables Notification Service APIs.
service-notification = []
## Enables Input Service APIs.
service-input = []
## Enables Toolbox APIs.
service-toolbox = []
## Enables GUI APIs of Flipper.
service-gui = ["alloc", "service-input"]
## Enables Dialogs APIs of Flipper.
service-dialogs = ["service-gui"]
## Enables Dolphin APIs of Flipper.
service-dolphin = []

#! ## Unstable features
#!
#! This features are unstable and are yet a subject to drastic changes.
#! They may provide experimental APIs, nightly-only features and optimizations etc.

## Enables unstable Rust intrinsics. This requires `nightly` compiler version.
unstable_intrinsics = []
## Enables unstable Rust lints on types provided by this crate.
## This requires `nightly` compiler version.
unstable_lints = []

# Internal features.

# Enables unstable documentation features.
# This is only intended to be used by `cargo doc`.
unstable_docs = []

[[test]]
name = "dolphin"
required-features = ["service-dolphin"]
harness = false

[[test]]
name = "string"
harness = false

[[example]]
name = "storage"
required-features = ["service-storage"]

[[example]]
name = "notification"
required-features = ["service-notification"]

[[example]]
name = "gui"
required-features = ["service-gui"]

[[example]]
name = "images"
required-features = ["service-gui"]

[[example]]
name = "view_dispatcher"
required-features = ["service-gui"]

[[example]]
name = "dialog"
required-features = ["alloc"]
required-features = ["service-dialogs", "service-input"]

[[example]]
name = "threads"
Expand Down
126 changes: 0 additions & 126 deletions crates/flipperzero/examples/example_images.rs

This file was deleted.

Loading