Other devices

This section covers some device driver classes, which do not belong to other groups of devices. These classes have their own interface and are not derived from the class CDevice.

CBcmRandomNumberGenerator

#include <circle/bcmrandom.h>
class CBcmRandomNumberGenerator

This class is a driver for the built-in hardware random number generator.

u32 CBcmRandomNumberGenerator::GetNumber(void)

Returns a 32-bit random number.

Note

Generating a random number takes a short while. For generating a large number of random numbers, you should use a polynomial random number generator, and seed it using this hardware random number generator.

CBcmWatchdog

#include <circle/bcmwatchdog.h>
class CBcmWatchdog

This class is a driver for the built-in watchdog device. It can be used to automatically restart a Raspberry Pi computer after program failure, or to restart it immediately from a specific partition.

void CBcmWatchdog::Start(unsigned nTimeoutSeconds = MaxTimeoutSeconds)

Starts the watchdog, to elapse after nTimeoutSeconds seconds. The system restarts after this timeout, if the watchdog is not re-triggered before.

const unsigned CBcmWatchdog::MaxTimeoutSeconds = 15

Is the maximum timeout in seconds.

void CBcmWatchdog::Stop(void)

Stops the watchdog. It will not elapse any more.

void CBcmWatchdog::Restart(unsigned nPartition = PartitionDefault)

Immediately restarts the system from the SD card partition with the number nPartition, with these special values:

const unsigned CBcmWatchdog::PartitionDefault = 0
const unsigned CBcmWatchdog::PartitionHalt = 63

PartitionHalt halts the system, instead of restarting it.

boolean CBcmWatchdog::IsRunning(void) const

Returns TRUE, if the watchdog is currently running.

unsigned CBcmWatchdog::GetTimeLeft(void) const

Returns the number of seconds left, until a restart will triggered.