Lazuli
Functions | Variables
clock_24.c File Reference

24-Hour clock kernel implementation. More...

#include <stdint.h>
#include <Lazuli/clock_24.h>
#include <Lazuli/common.h>
#include <Lazuli/config.h>
#include <Lazuli/sys/clock_24.h>
#include <Lazuli/sys/memory.h>

Go to the source code of this file.

Functions

static bool IncrementUntil (volatile uint8_t *const value, const uint8_t comparator)
 Increment an uint8_t value, and reset it if it reaches the value in comparator. More...
 
static bool IncrementSeconds (void)
 Increment the seconds of the system 24-Hour clock. More...
 
static bool IncrementMinutes (void)
 Increment the minutes of the system 24-Hour clock. More...
 
static void IncrementHours (void)
 Increment the hours of the system 24-Hour clock.
 
void Clock24_Increment (void)
 Increment the 24-Hour clock, taking into the account the resolution of the system clock.
 
void Lz_Clock24_Get (Clock24 *const userClock24)
 Get the time on a 24-Hour clock. More...
 

Variables

static volatile Clock24 clock24 = {0}
 The system Clock24.
 
static volatile u_read_write_atomic_t clockVersion = 0
 The clock version value.
 

Detailed Description

24-Hour clock kernel implementation.

This file describes the implementation of the kernel 24-Hour clock.

Definition in file clock_24.c.

Function Documentation

◆ IncrementUntil()

static bool IncrementUntil ( volatile uint8_t *const  value,
const uint8_t  comparator 
)
static

Increment an uint8_t value, and reset it if it reaches the value in comparator.

Parameters
valueA valid pointer to the value to increment.
comparatorThe value used for comparison.
Returns
true if:
  • The value was reset false if:
  • The value was incremented without resetting

Definition at line 46 of file clock_24.c.

◆ IncrementSeconds()

static bool IncrementSeconds ( void  )
static

Increment the seconds of the system 24-Hour clock.

Returns
true if the minutes need to be incremented, else false.

Definition at line 65 of file clock_24.c.

◆ IncrementMinutes()

static bool IncrementMinutes ( void  )
static

Increment the minutes of the system 24-Hour clock.

Returns
true if the hours need to be incremented, else false.

Definition at line 78 of file clock_24.c.

◆ Lz_Clock24_Get()

void Lz_Clock24_Get ( Clock24 *const  userClock24)

Get the time on a 24-Hour clock.

Parameters
userClock24A pointer to an allocated Clock24.
Warning
This function may spin if the kernel updates the time while this functions reads it.

Definition at line 146 of file clock_24.c.