libws libws
WSwan hardware library for the Wonderful toolchain
Loading...
Searching...
No Matches
Utility/Misc.

Macros

#define WS_HZ_TO_DIVIDER(hz, clock_hz)
 Convert a frequency in Hertz to a clock divider value.

Functions

void ws_portcpy (uint16_t port, const void __far *src, uint16_t count)
 Copy memory data to I/O ports, in order.
void ws_delay_us (uint16_t us)
 Delay for a set number of microseconds.
void ws_delay_ms (uint16_t ms)
 Delay for a set number of milliseconds.

Detailed Description

Macro Definition Documentation

◆ WS_HZ_TO_DIVIDER

#define WS_HZ_TO_DIVIDER ( hz,
clock_hz )
Value:
(((clock_hz) + ((((hz) + 1)) >> 1)) / (hz))

Convert a frequency in Hertz to a clock divider value.

Definition at line 40 of file util.h.

Function Documentation

◆ ws_delay_ms()

void ws_delay_ms ( uint16_t ms)

Delay for a set number of milliseconds.

This is not recommended - use only when necessary! Not halting the CPU can lead to higher power consumption. The recommended approach is configuring an interrupt handler and using cpu_halt() - which will then sleep until any interrupt occurs.

Parameters
msApproximate number of milliseconds.

◆ ws_delay_us()

void ws_delay_us ( uint16_t us)

Delay for a set number of microseconds.

This is not recommended - use only when necessary! Not halting the CPU can lead to higher power consumption. The recommended approach is configuring an interrupt handler and using cpu_halt() - which will then sleep until any interrupt occurs.

Parameters
usApproximate number of microseconds.

◆ ws_portcpy()

void ws_portcpy ( uint16_t port,
const void __far * src,
uint16_t count )

Copy memory data to I/O ports, in order.

Parameters
portDestination port.
srcSource pointer.
countCount, in bytes.