mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-26 21:42:11 +00:00
Started working on PCSpeaker api docs
This commit is contained in:
parent
8295dcef12
commit
c9d82b5eef
1 changed files with 19 additions and 0 deletions
|
|
@ -22,16 +22,27 @@ namespace Cosmos.HAL
|
||||||
protected static Core.IOGroup.PCSpeaker IO = BaseIOGroups.PCSpeaker;
|
protected static Core.IOGroup.PCSpeaker IO = BaseIOGroups.PCSpeaker;
|
||||||
private static PIT SpeakerPIT = new PIT();
|
private static PIT SpeakerPIT = new PIT();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enable sound.
|
||||||
|
/// </summary>
|
||||||
private static void EnableSound()
|
private static void EnableSound()
|
||||||
{
|
{
|
||||||
IO.Gate.Byte = (byte)(IO.Gate.Byte | 0x03);
|
IO.Gate.Byte = (byte)(IO.Gate.Byte | 0x03);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Disable sound.
|
||||||
|
/// </summary>
|
||||||
private static void DisableSound()
|
private static void DisableSound()
|
||||||
{
|
{
|
||||||
IO.Gate.Byte = (byte)(IO.Gate.Byte & ~3);
|
IO.Gate.Byte = (byte)(IO.Gate.Byte & ~3);
|
||||||
//IO.Port61.Byte = (byte)(IO.Port61.Byte | 0xFC);
|
//IO.Port61.Byte = (byte)(IO.Port61.Byte | 0xFC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Play beep sound, at a specified frequency for a specified duration.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="frequency">Audio frequency in Hz, must be between 37 and 32767Hz.</param>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException">Thrown if frequency is invalid.</exception>
|
||||||
public static void Beep(uint frequency)
|
public static void Beep(uint frequency)
|
||||||
{
|
{
|
||||||
if (frequency < 37 || frequency > 32767)
|
if (frequency < 37 || frequency > 32767)
|
||||||
|
|
@ -51,6 +62,14 @@ namespace Cosmos.HAL
|
||||||
}
|
}
|
||||||
EnableSound();
|
EnableSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: continue exception list, once HAL is documented.
|
||||||
|
/// <summary>
|
||||||
|
/// Play beep sound, at a specified frequency for a specified duration.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="frequency">Audio frequency in Hz, must be between 37 and 32767Hz.</param>
|
||||||
|
/// <param name="duration">Beep duration, must be > 0.</param>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException">Thrown if duration or frequency invalid.</exception>
|
||||||
public static void Beep(uint frequency, uint duration)
|
public static void Beep(uint frequency, uint duration)
|
||||||
{
|
{
|
||||||
if (duration <= 0)
|
if (duration <= 0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue