libws libws
WSwan hardware library for the Wonderful toolchain
Loading...
Searching...
No Matches
Cartridge - RTC

Data Structures

struct  ws_cart_rtc_date_t
 Structure containing the date read from the RTC, BCD-encoded. More...
struct  ws_cart_rtc_time_t
 Structure containing the time read from the RTC, BCD-encoded. More...
struct  ws_cart_rtc_datetime_t

Macros

#define WS_CART_RTC_MONTH_AMPM   0x80
#define WS_CART_RTC_MONTH_AM   0x00
#define WS_CART_RTC_MONTH_PM   0x80
#define WS_CART_RTC_STATUS_POWER_LOST   0x80
#define WS_CART_RTC_STATUS_12_HOUR   0x00
#define WS_CART_RTC_STATUS_24_HOUR   0x40
#define WS_CART_RTC_STATUS_INTAE   0x20
#define WS_CART_RTC_STATUS_INTME   0x08
#define WS_CART_RTC_STATUS_INTFE   0x02
#define WS_CART_RTC_STATUS_INT_OFF   0
#define WS_CART_RTC_STATUS_INT_FREQ_STEADY   (WS_CART_RTC_STATUS_INTFE)
#define WS_CART_RTC_STATUS_INT_MINUTE_EDGE   (WS_CART_RTC_STATUS_INTME)
#define WS_CART_RTC_STATUS_INT_MINUTE_STEADY   (WS_CART_RTC_STATUS_INTME | WS_CART_RTC_STATUS_INTFE)
#define WS_CART_RTC_STATUS_INT_ALARM   (WS_CART_RTC_STATUS_INTAE)

Functions

bool ws_cart_rtc_wait_ready (void)
 Wait until the RTC is ready.
uint16_t ws_cart_rtc_read (uint8_t command, void __wf_cram *buffer, uint16_t length)
 Send command and read from RTC.
uint16_t ws_cart_rtc_write (uint8_t command, const void __wf_cram *buffer, uint16_t length)
 Send command and write to RTC.
static bool ws_cart_rtc_reset (void)
static bool ws_cart_rtc_read_status (uint8_t __wf_cram *result)
static bool ws_cart_rtc_write_status (uint8_t result)
static bool ws_cart_rtc_read_datetime (ws_cart_rtc_datetime_t __wf_cram *result)
static bool ws_cart_rtc_write_datetime (ws_cart_rtc_datetime_t __wf_cram *result)
static bool ws_cart_rtc_read_time (ws_cart_rtc_time_t __wf_cram *result)
static bool ws_cart_rtc_write_time (ws_cart_rtc_time_t __wf_cram *result)
static bool ws_cart_rtc_write_alarm (uint16_t alarm)

Detailed Description

Macro Definition Documentation

◆ WS_CART_RTC_MONTH_AM

#define WS_CART_RTC_MONTH_AM   0x00

Definition at line 38 of file rtc.h.

◆ WS_CART_RTC_MONTH_AMPM

#define WS_CART_RTC_MONTH_AMPM   0x80

Definition at line 37 of file rtc.h.

◆ WS_CART_RTC_MONTH_PM

#define WS_CART_RTC_MONTH_PM   0x80

Definition at line 39 of file rtc.h.

◆ WS_CART_RTC_STATUS_12_HOUR

#define WS_CART_RTC_STATUS_12_HOUR   0x00

Definition at line 42 of file rtc.h.

◆ WS_CART_RTC_STATUS_24_HOUR

#define WS_CART_RTC_STATUS_24_HOUR   0x40

Definition at line 43 of file rtc.h.

◆ WS_CART_RTC_STATUS_INT_ALARM

#define WS_CART_RTC_STATUS_INT_ALARM   (WS_CART_RTC_STATUS_INTAE)

Definition at line 51 of file rtc.h.

◆ WS_CART_RTC_STATUS_INT_FREQ_STEADY

#define WS_CART_RTC_STATUS_INT_FREQ_STEADY   (WS_CART_RTC_STATUS_INTFE)

Definition at line 48 of file rtc.h.

◆ WS_CART_RTC_STATUS_INT_MINUTE_EDGE

#define WS_CART_RTC_STATUS_INT_MINUTE_EDGE   (WS_CART_RTC_STATUS_INTME)

Definition at line 49 of file rtc.h.

◆ WS_CART_RTC_STATUS_INT_MINUTE_STEADY

#define WS_CART_RTC_STATUS_INT_MINUTE_STEADY   (WS_CART_RTC_STATUS_INTME | WS_CART_RTC_STATUS_INTFE)

Definition at line 50 of file rtc.h.

◆ WS_CART_RTC_STATUS_INT_OFF

#define WS_CART_RTC_STATUS_INT_OFF   0

Definition at line 47 of file rtc.h.

◆ WS_CART_RTC_STATUS_INTAE

#define WS_CART_RTC_STATUS_INTAE   0x20

Definition at line 44 of file rtc.h.

◆ WS_CART_RTC_STATUS_INTFE

#define WS_CART_RTC_STATUS_INTFE   0x02

Definition at line 46 of file rtc.h.

◆ WS_CART_RTC_STATUS_INTME

#define WS_CART_RTC_STATUS_INTME   0x08

Definition at line 45 of file rtc.h.

◆ WS_CART_RTC_STATUS_POWER_LOST

#define WS_CART_RTC_STATUS_POWER_LOST   0x80

Definition at line 41 of file rtc.h.

Function Documentation

◆ ws_cart_rtc_read()

uint16_t ws_cart_rtc_read ( uint8_t command,
void __wf_cram * buffer,
uint16_t length )

Send command and read from RTC.

Upon buffer overflow, any additional bytes read are ignored, but the transaction is completed.

Parameters
commandCommand
bufferBuffer to write to
lengthLength of buffer
Returns
uint16_t Number of bytes read (can be smaller than, equal, or larger than buffer)

◆ ws_cart_rtc_read_datetime()

bool ws_cart_rtc_read_datetime ( ws_cart_rtc_datetime_t __wf_cram * result)
inlinestatic

Definition at line 125 of file rtc.h.

◆ ws_cart_rtc_read_status()

bool ws_cart_rtc_read_status ( uint8_t __wf_cram * result)
inlinestatic

Definition at line 117 of file rtc.h.

◆ ws_cart_rtc_read_time()

bool ws_cart_rtc_read_time ( ws_cart_rtc_time_t __wf_cram * result)
inlinestatic

Definition at line 133 of file rtc.h.

◆ ws_cart_rtc_reset()

bool ws_cart_rtc_reset ( void )
inlinestatic

Definition at line 112 of file rtc.h.

◆ ws_cart_rtc_wait_ready()

bool ws_cart_rtc_wait_ready ( void )

Wait until the RTC is ready.

◆ ws_cart_rtc_write()

uint16_t ws_cart_rtc_write ( uint8_t command,
const void __wf_cram * buffer,
uint16_t length )

Send command and write to RTC.

Upon buffer overflow, the byte 0x00 is sent for all remaining bytes.

Parameters
commandCommand
bufferBuffer to read from
lengthLength of buffer
Returns
uint16_t Number of bytes written (can be smaller than, equal, or larger than buffer)

◆ ws_cart_rtc_write_alarm()

bool ws_cart_rtc_write_alarm ( uint16_t alarm)
inlinestatic

Definition at line 141 of file rtc.h.

◆ ws_cart_rtc_write_datetime()

bool ws_cart_rtc_write_datetime ( ws_cart_rtc_datetime_t __wf_cram * result)
inlinestatic

Definition at line 129 of file rtc.h.

◆ ws_cart_rtc_write_status()

bool ws_cart_rtc_write_status ( uint8_t result)
inlinestatic

Definition at line 121 of file rtc.h.

◆ ws_cart_rtc_write_time()

bool ws_cart_rtc_write_time ( ws_cart_rtc_time_t __wf_cram * result)
inlinestatic

Definition at line 137 of file rtc.h.