Skip to content

Commit f949904

Browse files
authored
translation(microbit): led roulette (#11)
2 parents 147ac25 + d704be2 commit f949904

File tree

10 files changed

+828
-263
lines changed

10 files changed

+828
-263
lines changed

microbit/src/05-led-roulette/Embed.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[default.general]
2-
# chip = "nrf52833_xxAA" # uncomment this line for micro:bit V2
3-
# chip = "nrf51822_xxAA" # uncomment this line for micro:bit V1
2+
# chip = "nrf52833_xxAA" # para micro:bit V2, descomente essa linha
3+
# chip = "nrf51822_xxAA" # para micro:bit V1, descomente essa linha
44

55
[default.reset]
66
halt_afterwards = true
+104-35
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,128 @@
1-
# LED roulette
1+
<!-- # LED roulette -->
22

3-
Alright, let's start by building the following application:
3+
# Roleta LED
4+
5+
<!-- Alright, let's start by building the following application: -->
6+
7+
Certo, vamos começar construindo a seguinte aplicação:
48

59
<p align="center">
610
<video src="../assets/roulette_fast.mp4" loop autoplay>
711
</p>
812

9-
I'm going to give you a high level API to implement this app but don't worry we'll do low level
10-
stuff later on. The main goal of this chapter is to get familiar with the *flashing* and debugging
11-
process.
13+
<!-- I'm going to give you a high level API to implement this app but don't worry
14+
we'll do low level stuff later on. The main goal of this chapter is to get
15+
familiar with the _flashing_ and debugging process. -->
16+
17+
Vou fornecer a você uma API de alto nível para implementar este aplicativo, mas
18+
não se preocupe, faremos coisas de baixo nível posteriormente. O objetivo
19+
principal deste capítulo é familiarizar-se com o processo de _flashing_ e
20+
depuração.
21+
22+
<!-- The starter code is in the `src` directory of the book repository. Inside that
23+
directory there are more directories named after each chapter of this book. Most
24+
of those directories are starter Cargo projects. -->
1225

13-
The starter code is in the `src` directory of the book repository. Inside that directory there are more
14-
directories named after each chapter of this book. Most of those directories are starter Cargo
15-
projects.
26+
O código inicial está no diretório `src` do repositório do livro. Dentro desse
27+
diretório, existem mais diretórios com nomes de cada capítulo deste livro. A
28+
maioria desses diretórios são projetos iniciais de Cargo.
1629

17-
Now, jump into the `src/05-led-roulette` directory. Check the `src/main.rs` file:
30+
<!-- Now, jump into the `src/05-led-roulette` directory. Check the `src/main.rs`
31+
file: -->
1832

19-
``` rust
33+
Agora, vá para o diretório `src/05-led-roulette`. Verifique o arquivo
34+
`src/main.rs`:
35+
36+
```rust
2037
{{#include src/main.rs}}
2138
```
2239

23-
Microcontroller programs are different from standard programs in two aspects: `#![no_std]` and
24-
`#![no_main]`.
40+
<!-- Microcontroller programs are different from standard programs in two aspects:
41+
`#![no_std]` and `#![no_main]`. -->
42+
43+
Programas para microcontroladores são diferentes de programas convencionais em
44+
dois aspectos: `#![no_std]` e `#![no_main]`.
45+
46+
<!-- The `no_std` attribute says that this program won't use the `std` crate, which
47+
assumes an underlying OS; the program will instead use the `core` crate, a
48+
subset of `std` that can run on bare metal systems (i.e., systems without OS
49+
abstractions like files and sockets). -->
50+
51+
O atributo `no_std` indica que este programa não usará o crate `std`, que
52+
pressupõe a existência de um sistema operacional subjacente. Em vez disso, o
53+
programa usará o crate `core`, que é um subconjunto do `std` que pode ser
54+
executado em sistemas bare metal (ou seja, sistemas sem abstrações de sistema
55+
operacional, como arquivos e sockets).
56+
57+
<!-- The `no_main` attribute says that this program won't use the standard `main`
58+
interface, which is tailored for command line applications that receive
59+
arguments. Instead of the standard `main` we'll use the `entry` attribute from
60+
the [`cortex-m-rt`] crate to define a custom entry point. In this program we
61+
have named the entry point "main", but any other name could have been used. The
62+
entry point function must have signature `fn() -> !`; this type indicates that
63+
the function can't return -- this means that the program never terminates. -->
64+
65+
O atributo `no_main` indica que este programa não usará a interface `main`
66+
padrão, que é adequada para aplicativos de linha de comando que recebem
67+
argumentos. Em vez do `main` padrão, utilizaremos o atributo `entry` do crate
68+
[cortex-m-rt] para definir um ponto de entrada customizado. Neste programa,
69+
nomeamos o ponto de entrada como "main", mas poderíamos ter usado qualquer outro
70+
nome. A função de ponto de entrada deve ter a assinatura `fn() -> !`, indicando
71+
que a função não pode retornar -- isso significa que o programa nunca termina.
2572

26-
The `no_std` attribute says that this program won't use the `std` crate, which assumes an underlying
27-
OS; the program will instead use the `core` crate, a subset of `std` that can run on bare metal
28-
systems (i.e., systems without OS abstractions like files and sockets).
73+
[`cortex-m-rt`]: https://crates.io/crates/cortex-m-rt
2974

30-
The `no_main` attribute says that this program won't use the standard `main` interface, which is
31-
tailored for command line applications that receive arguments. Instead of the standard `main` we'll
32-
use the `entry` attribute from the [`cortex-m-rt`] crate to define a custom entry point. In this
33-
program we have named the entry point "main", but any other name could have been used. The entry
34-
point function must have signature `fn() -> !`; this type indicates that the function can't return
35-
-- this means that the program never terminates.
75+
<!-- If you are a careful observer, you'll also notice there is a `.cargo` directory
76+
in the Cargo project as well. This directory contains a Cargo configuration file
77+
(`.cargo/config`) that tweaks the linking process to tailor the memory layout of
78+
the program to the requirements of the target device. This modified linking
79+
process is a requirement of the `cortex-m-rt` crate. -->
3680

37-
[`cortex-m-rt`]: https://crates.io/crates/cortex-m-rt
81+
Se você for um observador cuidadoso, também notará que existe um diretório
82+
`.cargo` no projeto Cargo. Esse diretório contém um arquivo de configuração do
83+
Cargo (`.cargo/config`) que ajusta o processo de linking para adaptar o layout
84+
de memória do programa aos requisitos do dispositivo alvo. Esse processo de
85+
linking modificado é um requisito do crate `cortex-m-rt`.
3886

39-
If you are a careful observer, you'll also notice there is a `.cargo` directory in the Cargo project
40-
as well. This directory contains a Cargo configuration file (`.cargo/config`) that tweaks the
41-
linking process to tailor the memory layout of the program to the requirements of the target device.
42-
This modified linking process is a requirement of the `cortex-m-rt` crate.
87+
<!-- Furthermore, there is also an `Embed.toml` file -->
4388

44-
Furthermore, there is also an `Embed.toml` file
89+
Além disso, há também um arquivo `Embed.toml`.
4590

4691
```toml
4792
{{#include Embed.toml}}
4893
```
4994

50-
This file tells `cargo-embed` that:
95+
<!-- This file tells `cargo-embed` that: -->
96+
97+
Este arquivo informa ao `cargo-embed` que:
98+
99+
<!-- - we are working with either a nrf52833 or nrf51822, you will again have to
100+
remove the comments from the chip you are using, just like you did in
101+
chapter 3. -->
102+
103+
- Estamos trabalhando com um nrf52833 ou nrf51822. Você terá que remover
104+
novamente os comentários do chip que estiver usando, assim como fez no
105+
capítulo 3.
106+
107+
<!-- - we want to halt the chip after we flashed it so our program does not instantly
108+
jump to the loop -->
109+
110+
- Desejamos interromper o chip depois de gravá-lo para que nosso programa não
111+
salte instantaneamente para o loop.
112+
113+
<!-- - we want to disable RTT, RTT being a protocol that allows the chip to send text
114+
to a debugger. You have in fact already seen RTT in action, it was the
115+
protocol that sent "Hello World" in chapter 3. -->
116+
117+
- Queremos desabilitar o RTT, que é um protocolo que permite ao chip enviar
118+
texto para um depurador. Na verdade, você já viu o RTT em ação: ele foi o
119+
protocolo que enviou "Hello World" no capítulo 3.
120+
121+
<!-- - we want to enable GDB, this will be required for the debugging procedure -->
122+
123+
- Desejamos habilitar o GDB, pois isso será necessário para o procedimento de
124+
depuração.
51125

52-
* we are working with either a nrf52833 or nrf51822, you will again have to remove the comments from the
53-
chip you are using, just like you did in chapter 3.
54-
* we want to halt the chip after we flashed it so our program does not instantly jump to the loop
55-
* we want to disable RTT, RTT being a protocol that allows the chip to send text to a debugger.
56-
You have in fact already seen RTT in action, it was the protocol that sent "Hello World" in chapter 3.
57-
* we want to enable GDB, this will be required for the debugging procedure
126+
<!-- Alright, let's start by building this program. -->
58127

59-
Alright, let's start by building this program.
128+
Certo, vamos começar construindo este programa.

0 commit comments

Comments
 (0)