Skip to content

Commit

Permalink
notes
Browse files Browse the repository at this point in the history
  • Loading branch information
ImplFerris committed Oct 22, 2024
1 parent 007a556 commit 9ce7aa2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/blinky/pwm.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In PWM, a digital signal switches between **on** and **off** states at a high fr
- 50% duty cycle means the signal is on half the time and off half the time.
- 0% duty cycle means the signal is always off.

In the above example code, we use PWM to fade an LED.
In the previous example code, we use PWM to fade an LED.

### Fading Up
The first loop gradually increases the LED brightness from `LOW` (0) to `HIGH` (25,000). The `delay.delay_us(8)` creates a short pause between each increase, allowing the LED to visibly brighten.
Expand Down Expand Up @@ -38,17 +38,17 @@ Initialize the PWM slices by creating an instance using the PAC's PWM peripheral
let mut pwm_slices = hal::pwm::Slices::new(pac.PWM, &mut pac.RESETS);
```

// Retrieve a mutable reference to PWM4 from the initialized PWM slices for further configuration.
Retrieve a mutable reference to PWM4 from the initialized PWM slices for further configuration.
```rust
let pwm = &mut pwm_slices.pwm4;
```

// Configure PWM4 to operate in phase-correct mode for smoother output transitions. (You can refer the [secrets arudion PWM](https://docs.arduino.cc/tutorials/generic/secrets-of-arduino-pwm/) if you want to know what is phase-correct)
Configure PWM4 to operate in phase-correct mode for smoother output transitions. (You can refer the [secrets arudion PWM](https://docs.arduino.cc/tutorials/generic/secrets-of-arduino-pwm/) if you want to know what is phase-correct)
```rust
pwm.set_ph_correct();
```

// Get a mutable reference to channel B of PWM4 and direct its output to GPIO pin 25.
Get a mutable reference to channel B of PWM4 and direct its output to GPIO pin 25.
```rust
let channel = &mut pwm.channel_b;
channel.output_to(pins.gpio25);
Expand Down
4 changes: 2 additions & 2 deletions src/blinky/rp-hal.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Blink LED Program with RP HAL
# Blink (Dimming) LED Program with RP HAL

This example code is taken from rp235x-hal repo (It also includes additional examples beyond just the blink examples):

["https://github.com/rp-rs/rp-hal/tree/main/rp235x-hal-examples"](https://github.com/rp-rs/rp-hal/tree/main/rp235x-hal-examples)

It adjusts the LED's brightness by changing the duty cycle at regular intervals, creating a blinking effect.
It adjusts the LED's brightness by changing the duty cycle at regular intervals, creating a dimming effect.

## The main code
```rust
Expand Down
2 changes: 1 addition & 1 deletion src/running.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Running the program
Before we explore further examples, let’s cover the general steps to build and run any program on the Raspberry Pi Pico 2.

Note: These commands should be run from your project folder. This is included here as a general step to avoid repetition. If you haven't created a project yet, begin with the Blinking LED section.
Note: These commands should be run from your project folder. This is included here as a general step to avoid repetition. If you haven't created a project yet, begin with the Blink LED section.

## Build and Run for ARM
```sh
Expand Down

0 comments on commit 9ce7aa2

Please sign in to comment.