Skip to content

Commit af25de2

Browse files
aykevldeadprogram
authored andcommitted
docs/reference: add CPUFrequency, GetRNG, ReadTemperature documentation
These functions are defined in the machine package and therefore should be documented.
1 parent 82d2093 commit af25de2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

content/docs/reference/machine.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,28 @@ func (uart *UART) WriteByte(c byte) error
218218
```
219219

220220
Write a single byte to the UART output.
221+
222+
223+
## Other
224+
225+
```go
226+
func CPUFrequency() uint32
227+
```
228+
229+
Return the current CPU frequency in hertz (for example, 16MHz equals 16_000_000). It is often a fixed value.
230+
231+
```go
232+
func GetRNG() uint32
233+
```
234+
235+
Return a 32-bit random number from a hardware random number generator. It is often (but not always) a cryptographic random number generator. Check the documentation of the chip to be sure.
236+
237+
Not all chips have a random number generator.
238+
239+
```go
240+
func ReadTemperature() int32
241+
```
242+
243+
Read the current die temperature of the chip. The return value is in milli-celsius: to convert to Celsius, divide the returned value by 1000.
244+
245+
Not all chips have a built-in temperature sensor.

0 commit comments

Comments
 (0)