Skip to main content

RtcControllerApiWrapper Class

NuGet: GHIElectronics.TinyCLR.Devices.Rtc
Assembly: GHIElectronics.TinyCLR.Devices.Rtc
Namespace: GHIElectronics.TinyCLR.Devices.Rtc.Provider

Concrete IRtcControllerProvider backed by the native TinyCLR RTC HAL.

public sealed class RtcControllerApiWrapper : IRtcControllerProvider

Constructors

RtcControllerApiWrapper(NativeApi api)

public RtcControllerApiWrapper(NativeApi api)

Wraps the given native API as a provider.

ParameterTypeDescription
apiNativeApiThe native RTC API to bind to.

Properties

Api

public NativeApi Api { get; }

The underlying native API descriptor.

IsValid

public extern bool IsValid { get; }

True when the RTC has been initialized with a valid time at least once. (inherited)

InternalRC

public extern bool InternalRC { get; }

True when clocked from the internal RC oscillator. (inherited)

BackupMemorySize

public extern uint BackupMemorySize { get; }

Size in bytes of the battery-backed memory region. (inherited)

Methods

Dispose()

public void Dispose()

Releases the native controller.

GetTime()

public extern RtcDateTime GetTime()

Reads the current calendar time. (inherited)

Returns RtcDateTime

SetTime(RtcDateTime value)

public extern void SetTime(RtcDateTime value)

Sets the RTC time. (inherited)

ParameterTypeDescription
valueRtcDateTimeCalendar time to write.

WriteBackupMemory(byte[] sourceData, uint sourceOffset, uint destinationOffset, int count)

public extern void WriteBackupMemory(byte[] sourceData, uint sourceOffset, uint destinationOffset, int count)

Writes a slice of bytes to backup memory. (inherited)

ParameterTypeDescription
sourceDatabyte[]Source buffer.
sourceOffsetuintStarting offset within sourceData.
destinationOffsetuintStarting offset in backup memory.
countintNumber of bytes to write.

ReadBackupMemory(byte[] destinationData, uint destinationOffset, uint sourceOffset, int count)

public extern int ReadBackupMemory(byte[] destinationData, uint destinationOffset, uint sourceOffset, int count)

Reads a slice from backup memory. (inherited)

ParameterTypeDescription
destinationDatabyte[]Destination buffer.
destinationOffsetuintStarting offset within destinationData.
sourceOffsetuintStarting offset in backup memory.
countintNumber of bytes to read.

Returns int — Number of bytes read.

SetChargeMode(BatteryChargeMode chargeMode)

public extern void SetChargeMode(BatteryChargeMode chargeMode)

Configures the backup-battery trickle charger. (inherited)

ParameterTypeDescription
chargeModeBatteryChargeModeCharging policy.

Calibrate(int pulse)

public extern void Calibrate(int pulse)

Applies a frequency calibration pulse. (inherited)

ParameterTypeDescription
pulseintPlatform-specific calibration value.