|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
API for features of the Clock Maple Function More...
Topics | |
| VMU Buttons | |
| VMU button masks | |
Buzzer | |
Methods for tone generation. | |
| int | vmu_beep_raw (maple_device_t *dev, uint32_t beep) |
| Make a VMU beep (low-level). | |
| int | vmu_beep_waveform (maple_device_t *dev, uint8_t period1, uint8_t duty_cycle1, uint8_t period2, uint8_t duty_cycle2) |
| Play VMU Buzzer tone. | |
Date/Time | |
Methods for managing date and time. | |
| int | vmu_set_datetime (maple_device_t *dev, time_t unix) |
| Set the date and time on the VMU. | |
| int | vmu_get_datetime (maple_device_t *dev, time_t *unix) |
| Get the date and time on the VMU. | |
Input | |
Methods for polling button states. | |
| void | vmu_set_buttons_enabled (int enable) |
| Enable/Disable polling for VMU input. | |
| int | vmu_get_buttons_enabled (void) |
| Check whether polling for VMU input has been enabled. | |
API for features of the Clock Maple Function
The Clock Maple function provides a high-level API for the following functionality:
| int vmu_beep_raw | ( | maple_device_t * | dev, |
| uint32_t | beep ) |
Make a VMU beep (low-level).
This function sends a raw beep to a VMU, causing the speaker to emit a tone noise.
| dev | The device to attempt to beep. |
| beep | The tone to generate. Byte values are as follows:
|
| MAPLE_EOK | On success. |
| MAPLE_EAGAIN | If the command couldn't be sent. Try again later. |
| MAPLE_ETIMEOUT | If the command timed out while blocking. |
| int vmu_beep_waveform | ( | maple_device_t * | dev, |
| uint8_t | period1, | ||
| uint8_t | duty_cycle1, | ||
| uint8_t | period2, | ||
| uint8_t | duty_cycle2 ) |
Play VMU Buzzer tone.
Sends two different square waves to generate tone(s) on the VMU. Each waveform is configured as shown by the following diagram. On a standard VMU, there is only one piezoelectric buzzer, so waveform 2 is ignored; however, the parameters do support dual-channel stereo in case such a VMU ever does come along.
Period
+---------------------+
| |
HIGH __________ __________
| | | |
| | | |
|__________| |__________|
LOW
| |
+----------+
Duty Cycle
WAVEFORM
To stop an active tone, one can simply generate a flat wave, such as by submitting both values as 0s.
/examples/dreamcast/vmu/beep.| dev | The VMU device to play the tone on |
| period1 | The period or total interval of the first waveform |
| duty_cycle1 | The duty cycle or active interval of the first waveform |
| period2 | The period or total interval of the second waveform (ignored by standard first-party VMUs). |
| duty_cycle2 | The duty cycle or active interval of the second waveform (ignored by standard first-party VMUs). |
| MAPLE_EOK | On success. |
| MAPLE_EAGAIN | If the command couldn't be sent. Try again later. |
| MAPLE_ETIMEOUT | If the command timed out while blocking. |
| int vmu_get_buttons_enabled | ( | void | ) |
Check whether polling for VMU input has been enabled.
This function is used to check whether per-frame polling of the VMU's button states has been enabled in the driver.
| int vmu_get_datetime | ( | maple_device_t * | dev, |
| time_t * | unix ) |
Get the date and time on the VMU.
This function gets the VMU's date and time values as a single standard C Unix timestamp.
time(unix).| dev | The device to write to. |
| unix | Seconds since Unix epoch (set to -1 upon failure) |
| MAPLE_EOK | On success. |
| MAPLE_ETIMEOUT | If the command timed out while blocking. |
| MAPLE_EFAIL | On errors other than timeout. |
| void vmu_set_buttons_enabled | ( | int | enable | ) |
Enable/Disable polling for VMU input.
This function is used to either enable or disable polling the VMU buttons' states for input each frame.
| int vmu_set_datetime | ( | maple_device_t * | dev, |
| time_t | unix ) |
Set the date and time on the VMU.
This function sets the VMU's date and time values to the given standard C Unix timestamp.
| dev | The device to write to. |
| unix | Seconds since Unix epoch |
| MAPLE_EOK | On success. |
| MAPLE_ETIMEOUT | If the command timed out while blocking. |
| MAPLE_EFAIL | On errors other than timeout. |