ir.h
Go to the documentation of this file.
/**
* @file ir.h
* @brief IR service.
*/
#pragma once
/**
* @brief Initializes IRU.
* The permissions for the specified memory is set to RO. This memory must be already mapped.
* @param sharedmem_addr Address of the shared memory block to use.
* @param sharedmem_size Size of the shared memory block.
*/
Result iruInit(u32 *sharedmem_addr, u32 sharedmem_size);
/// Shuts down IRU.
void iruExit(void);
/**
* @brief Gets the IRU service handle.
* @return The IRU service handle.
*/
Handle iruGetServHandle(void);
/**
* @brief Sends IR data.
* @param buf Buffer to send data from.
* @param size Size of the buffer.
* @param wait Whether to wait for the data to be sent.
*/
Result iruSendData(u8 *buf, u32 size, bool wait);
/**
* @brief Receives IR data.
* @param buf Buffer to receive data to.
* @param size Size of the buffer.
* @param flag Flags to receive data with.
* @param transfercount Pointer to output the number of bytes read to.
* @param wait Whether to wait for the data to be received.
*/
Result iruRecvData(u8 *buf, u32 size, u8 flag, u32 *transfercount, bool wait);
/// Initializes the IR session.
Result IRU_Initialize(void);
/// Shuts down the IR session.
Result IRU_Shutdown(void);
/**
* @brief Begins sending data.
* @param buf Buffer to send.
* @param size Size of the buffer.
*/
Result IRU_StartSendTransfer(u8 *buf, u32 size);
/// Waits for a send operation to complete.
Result IRU_WaitSendTransfer(void);
/**
* @brief Begins receiving data.
* @param size Size of the data to receive.
* @param flag Flags to use when receiving.
*/
Result IRU_StartRecvTransfer(u32 size, u8 flag);
/**
* @brief Waits for a receive operation to complete.
* @param transfercount Pointer to output the number of bytes read to.
*/
Result IRU_WaitRecvTransfer(u32 *transfercount);
/**
* @brief Sets the IR bit rate.
* @param value Bit rate to set.
*/
Result IRU_SetBitRate(u8 value);
/**
* @brief Gets the IR bit rate.
* @param out Pointer to write the bit rate to.
*/
Result IRU_GetBitRate(u8 *out);
/**
* @brief Sets the IR LED state.
* @param value IR LED state to set.
*/
Result IRU_SetIRLEDState(u32 value);
/**
* @brief Gets the IR LED state.
* @param out Pointer to write the IR LED state to.
*/
Result IRU_GetIRLEDRecvState(u32 *out);
/**
* @brief Gets an event which is signaled once a send finishes.
* @param out Pointer to write the event handle to.
*/
Result IRU_GetSendFinishedEvent(Handle *out);
/**
* @brief Gets an event which is signaled once a receive finishes.
* @param out Pointer to write the event handle to.
*/
Result IRU_GetRecvFinishedEvent(Handle *out);
iruInit
Result iruInit(u32 *sharedmem_addr, u32 sharedmem_size)
Initializes IRU.
IRU_WaitSendTransfer
Result IRU_WaitSendTransfer(void)
Waits for a send operation to complete.
IRU_GetIRLEDRecvState
Result IRU_GetIRLEDRecvState(u32 *out)
Gets the IR LED state.
iruExit
void iruExit(void)
Shuts down IRU.
IRU_SetIRLEDState
Result IRU_SetIRLEDState(u32 value)
Sets the IR LED state.
IRU_GetSendFinishedEvent
Result IRU_GetSendFinishedEvent(Handle *out)
Gets an event which is signaled once a send finishes.
IRU_Shutdown
Result IRU_Shutdown(void)
Shuts down the IR session.
iruRecvData
Result iruRecvData(u8 *buf, u32 size, u8 flag, u32 *transfercount, bool wait)
Receives IR data.
iruGetServHandle
Handle iruGetServHandle(void)
Gets the IRU service handle.
IRU_Initialize
Result IRU_Initialize(void)
Initializes the IR session.
IRU_WaitRecvTransfer
Result IRU_WaitRecvTransfer(u32 *transfercount)
Waits for a receive operation to complete.
IRU_SetBitRate
Result IRU_SetBitRate(u8 value)
Sets the IR bit rate.
iruSendData
Result iruSendData(u8 *buf, u32 size, bool wait)
Sends IR data.
IRU_GetRecvFinishedEvent
Result IRU_GetRecvFinishedEvent(Handle *out)
Gets an event which is signaled once a receive finishes.
IRU_StartSendTransfer
Result IRU_StartSendTransfer(u8 *buf, u32 size)
Begins sending data.
IRU_StartRecvTransfer
Result IRU_StartRecvTransfer(u32 size, u8 flag)
Begins receiving data.
IRU_GetBitRate
Result IRU_GetBitRate(u8 *out)
Gets the IR bit rate.
u8
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
Handle
u32 Handle
Resource handle.
Definition: types.h:41
Result
s32 Result
Function result.
Definition: types.h:42
u32
uint32_t u32
32-bit unsigned integer
Definition: types.h:23