Skip to content

Commit 3237941

Browse files
Merge pull request #721 from andrewdavidmackenzie/prerequisites
Prerequisites
2 parents b6de264 + 348de0a commit 3237941

File tree

9 files changed

+67
-57
lines changed

9 files changed

+67
-57
lines changed

BUILDING.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Building Piggui and Piglet from source
22

3+
## Pre requisites
4+
- You'll need git to clone the repo (I chose `brew install git` so that needs `homebrew` first...). On a
5+
Mac, that will also install Xcode command line tools for you.
6+
- a rust toolchain, recommended to install with [rust](https://rustup.rs/)
7+
- `cargo binstall` is pretty handy to install pre-build binaries. You can use `cargo install` instead if you prefer.
8+
- `cross` for cross compiling to armv7 and aarch64 (install with `cargo binstall/install cross`)
9+
- `make` but you will probably have that installed already
10+
- `probe-rs`if you are working with the Pi Pico `porky`app (`cargo binstall probe-rs-tools`)
11+
12+
## General
313
NOTE: For details on building `porky` the embedded binary for Pi Pico W devices,
414
see [porky/BUILDING.md](porky/BUILDING.md)
515

@@ -21,7 +31,7 @@ below to build from source.
2131
make
2232
```
2333

24-
This will run clippy, build, and run tests, generating these binaries:
34+
This will run clip, build, and run tests, generating these binaries:
2535

2636
- `target/debug/piggui` - GUI with a GPIO backend and ability to connect to remote `piglet` and `porky` devices
2737
- `target/debug/piglet` - CLI with a GPIO backend
@@ -50,7 +60,7 @@ real GPIO hardware present.
5060
NOTE: For this option you will need a working rust toolchain installed on your Raspberry Pi. Also, these builds make
5161
take a very long time. Large intermediate files are also generated and can fill-up the storage of your Pi.
5262

53-
On your Raspberry Pi, use `make` to build and `make run` (etc) as above.
63+
On your Raspberry Pi, use `make` to build and `make run` as above.
5464

5565
## Building for Pi on another host
5666

porky/src/flash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn get_flash<'a>(flash_pin: FLASH) -> Flash<'a, FLASH, Blocking, FLASH_SIZE>
8989

9090
pub async fn db_init(
9191
flash: Flash<'static, FLASH, Blocking, FLASH_SIZE>,
92-
) -> Database<DbFlash<Flash<FLASH, Blocking, FLASH_SIZE>>, NoopRawMutex> {
92+
) -> Database<DbFlash<Flash<'static, FLASH, Blocking, FLASH_SIZE>>, NoopRawMutex> {
9393
let flash: DbFlash<Flash<_, _, FLASH_SIZE>> = DbFlash {
9494
flash,
9595
start: unsafe { &__config_start as *const u32 as usize },

porky/src/gpio.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::hw_definition::config::HardwareConfigMessage::{
55
use crate::hw_definition::config::InputPull;
66
use crate::hw_definition::config::{HardwareConfig, LevelChange};
77
use crate::hw_definition::pin_function::PinFunction;
8-
use crate::hw_definition::pin_function::PinFunction::Output;
8+
use crate::hw_definition::pin_function::PinFunction::{Input, Output};
99
use crate::hw_definition::{BCMPinNumber, PinLevel};
1010
use crate::HARDWARE_EVENT_CHANNEL;
1111
#[cfg(feature = "wifi")]
@@ -95,7 +95,7 @@ async fn set_output_level<'a>(
9595
bcm_pin_number, pin_level
9696
);
9797

98-
// GPIO 0 and 1 are connected via cyw43 wifi chip
98+
// GPIO 0 and 1 are connected via cyw43 Wi-Fi chip
9999
unsafe {
100100
match GPIO_PINS.get_mut(&bcm_pin_number) {
101101
#[cfg(feature = "wifi")]
@@ -148,7 +148,7 @@ async fn apply_pin_config<'a>(
148148
info!("Pin #{} - Set as Available", bcm_pin_number);
149149
}
150150

151-
PinFunction::Input(pull) => {
151+
Input(pull) => {
152152
info!("Setting new pin function to: Input");
153153
match flex_pin {
154154
Some(mut flex) => {
@@ -180,7 +180,7 @@ async fn apply_pin_config<'a>(
180180
None => {
181181
#[cfg(feature = "wifi")]
182182
{
183-
// Must be GPIO 2 is connected via cyw43 wifi chip
183+
// Must be GPIO 2 is connected via cyw43 Wi-Fi chip
184184
unsafe {
185185
let _ = GPIO_PINS.insert(bcm_pin_number, GPIOPin::CYW43Input);
186186
}
@@ -190,7 +190,7 @@ async fn apply_pin_config<'a>(
190190
}
191191
}
192192

193-
PinFunction::Output(pin_level) => {
193+
Output(pin_level) => {
194194
match flex_pin {
195195
Some(mut flex) => {
196196
if let Some(l) = pin_level {
@@ -208,7 +208,7 @@ async fn apply_pin_config<'a>(
208208
None => {
209209
#[cfg(feature = "wifi")]
210210
{
211-
// Must be GPIO 0 and 1 are connected via cyw43 wifi chip
211+
// Must be GPIO 0 and 1 are connected via cyw43 Wi-Fi chip
212212
info!("Pin #{} cyw43 pin used as Output ", bcm_pin_number);
213213

214214
if let Some(l) = pin_level {

src/hw/pin_descriptions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::borrow::Cow;
2323
/// each with two hardware chip selects. These extra SPI buses are available via alternate function
2424
/// assignments on certain GPIO pins. For more information, see the BCM2711 Arm peripherals
2525
/// datasheet."
26-
26+
/// Pin 1 is just a 3.3V power pin
2727
const PIN_1: PinDescription = PinDescription {
2828
bpn: 1,
2929
bcm: None,

src/widgets/circle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ where
6262
}
6363
}
6464

65-
impl<'a, Message, Theme, Renderer> From<Circle> for Element<'a, Message, Theme, Renderer>
65+
impl<Message, Theme, Renderer> From<Circle> for Element<'_, Message, Theme, Renderer>
6666
where
6767
Renderer: renderer::Renderer,
6868
{

src/widgets/led.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ where
7171
}
7272
}
7373

74-
impl<'a, Message, Theme, Renderer> From<Led> for Element<'a, Message, Theme, Renderer>
74+
impl<Message, Theme, Renderer> From<Led> for Element<'_, Message, Theme, Renderer>
7575
where
7676
Renderer: renderer::Renderer,
7777
{

src/widgets/line.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ where
5959
}
6060
}
6161

62-
impl<'a, Message, Theme, Renderer> From<Line> for Element<'a, Message, Theme, Renderer>
62+
impl<Message, Theme, Renderer> From<Line> for Element<'_, Message, Theme, Renderer>
6363
where
6464
Renderer: renderer::Renderer,
6565
{

src/widgets/spinner/circular.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ where
8686
}
8787
}
8888

89-
impl<'a, Theme> Default for Circular<'a, Theme>
89+
impl<Theme> Default for Circular<'_, Theme>
9090
where
9191
Theme: StyleSheet,
9292
{

src/widgets/toast.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ where
115115
}
116116
}
117117

118-
impl<'a, Message> Widget<Message, Theme, Renderer> for Manager<'a, Message> {
118+
impl<Message> Widget<Message, Theme, Renderer> for Manager<'_, Message> {
119119
fn size(&self) -> Size<Length> {
120120
self.content.as_widget().size()
121121
}
@@ -289,7 +289,7 @@ struct Overlay<'a, 'b, Message> {
289289
timeout_secs: u64,
290290
}
291291

292-
impl<'a, 'b, Message> overlay::Overlay<Message, Theme, Renderer> for Overlay<'a, 'b, Message> {
292+
impl<Message> overlay::Overlay<Message, Theme, Renderer> for Overlay<'_, '_, Message> {
293293
fn layout(&mut self, renderer: &Renderer, bounds: Size) -> layout::Node {
294294
let limits = layout::Limits::new(Size::ZERO, bounds);
295295

@@ -308,6 +308,47 @@ impl<'a, 'b, Message> overlay::Overlay<Message, Theme, Renderer> for Overlay<'a,
308308
.translate(Vector::new(self.position.x, self.position.y))
309309
}
310310

311+
fn draw(
312+
&self,
313+
renderer: &mut Renderer,
314+
theme: &Theme,
315+
style: &renderer::Style,
316+
layout: Layout<'_>,
317+
cursor: mouse::Cursor,
318+
) {
319+
let viewport = layout.bounds();
320+
321+
for ((child, state), layout) in self
322+
.toasts
323+
.iter()
324+
.zip(self.state.iter())
325+
.zip(layout.children())
326+
{
327+
child
328+
.as_widget()
329+
.draw(state, renderer, theme, style, layout, cursor, &viewport);
330+
}
331+
}
332+
333+
fn operate(
334+
&mut self,
335+
layout: Layout<'_>,
336+
renderer: &Renderer,
337+
operation: &mut dyn widget::Operation,
338+
) {
339+
operation.container(None, layout.bounds(), &mut |operation| {
340+
self.toasts
341+
.iter()
342+
.zip(self.state.iter_mut())
343+
.zip(layout.children())
344+
.for_each(|((child, state), layout)| {
345+
child
346+
.as_widget()
347+
.operate(state, layout, renderer, operation);
348+
});
349+
});
350+
}
351+
311352
fn on_event(
312353
&mut self,
313354
event: Event,
@@ -379,47 +420,6 @@ impl<'a, 'b, Message> overlay::Overlay<Message, Theme, Renderer> for Overlay<'a,
379420
.fold(event::Status::Ignored, event::Status::merge)
380421
}
381422

382-
fn draw(
383-
&self,
384-
renderer: &mut Renderer,
385-
theme: &Theme,
386-
style: &renderer::Style,
387-
layout: Layout<'_>,
388-
cursor: mouse::Cursor,
389-
) {
390-
let viewport = layout.bounds();
391-
392-
for ((child, state), layout) in self
393-
.toasts
394-
.iter()
395-
.zip(self.state.iter())
396-
.zip(layout.children())
397-
{
398-
child
399-
.as_widget()
400-
.draw(state, renderer, theme, style, layout, cursor, &viewport);
401-
}
402-
}
403-
404-
fn operate(
405-
&mut self,
406-
layout: Layout<'_>,
407-
renderer: &Renderer,
408-
operation: &mut dyn widget::Operation,
409-
) {
410-
operation.container(None, layout.bounds(), &mut |operation| {
411-
self.toasts
412-
.iter()
413-
.zip(self.state.iter_mut())
414-
.zip(layout.children())
415-
.for_each(|((child, state), layout)| {
416-
child
417-
.as_widget()
418-
.operate(state, layout, renderer, operation);
419-
});
420-
});
421-
}
422-
423423
fn mouse_interaction(
424424
&self,
425425
layout: Layout<'_>,

0 commit comments

Comments
 (0)