Skip to content

Commit

Permalink
avm: Add CEC functions
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryOderNichts committed Aug 25, 2024
1 parent bbcf70d commit 34ad457
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
92 changes: 92 additions & 0 deletions include/avm/cec.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#pragma once
#include <wut.h>
#include <tve/cec.h>

/**
* \defgroup avm_cec AVM HDMI CEC
* \ingroup avm
* @{
*/

#ifdef __cplusplus
extern "C" {
#endif

/**
* Initializes CEC.
*
* \return
* \c TRUE on success.
*/
BOOL
AVMCECInit(void);

/**
* Enable CEC.
*/
void
AVMEnableCEC(void);

/**
* Disable CEC.
*/
void
AVMDisableCEC(void);

/**
* Sends a CEC command.
*
* \param destination
* Logical address of the device where the command should be sent to.
*
* \param opCode
* The op code of the command to send.
*
* \param parameters
* Pointer to optional command parameters.
*
* \param numParameters
* The amount of additional parameters.
*
* \return
* \c TRUE on success.
*/
BOOL
AVMCECSendCommand(TVECECLogicalAddress destination,
TVECECOpCode opCode,
uint8_t *parameters,
uint8_t numParameters);

/**
* Get the last receieved CEC command.
*
* \param outInitiator
* Pointer to store the logical address of the initiator of the command to.
*
* \param outOpCode
* Pointer to store the op code of the command to.
*
* \param outParameters
* Pointer to store additional parameters to.
*
* \param numParameters
* Pointer to store the amount of additional parameters to.
*
* \return
* \c TRUE on success.
*
* \warning
* This will return success even if no new command has been receieved.
* The caller should check that the parameters were actually written to.
*/
BOOL
AVMCECReceiveCommand(TVECECLogicalAddress *outInitiator,
TVECECOpCode *outOpCode,
uint8_t *outParameters,
uint8_t *outNumParameters);

#ifdef __cplusplus
}
#endif

/** @} */
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <avm/cec.h>
#include <avm/config.h>
#include <avm/drc.h>
#include <avm/tv.h>
Expand Down

0 comments on commit 34ad457

Please sign in to comment.