Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
arpruss committed May 1, 2021
1 parent c6de387 commit 9ec132c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/CEC/CEC.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CEC_LogicalDevice : public CEC_Electrical
CDT_TV,
CDT_RECORDING_DEVICE,
CDT_PLAYBACK_DEVICE,
CDT_TUNER,
CDT_TUNER,
CDT_AUDIO_SYSTEM,
CDT_OTHER, // Not a real CEC type..
} CEC_DEVICE_TYPE;
Expand Down
8 changes: 0 additions & 8 deletions src/CEC/CEC_Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ void CEC_Device::OnReceive(int source, int dest, unsigned char* buffer, int coun
for (int i = 0; i < count; i++)
DbgPrint(":%02X", buffer[i]);
DbgPrint("\n");
if (!MonitorMode && dest == _logicalAddress && count == 1 && buffer[0] == 0x83) {
uint8 buffer[4];
buffer[0] = 0x84;
buffer[1] = _physicalAddress >> 8;
buffer[2] = _physicalAddress;
buffer[3] = _deviceType;
TransmitFrame(0xF, buffer, 4);
}
}

bool CEC_Device::LineState()
Expand Down
11 changes: 0 additions & 11 deletions src/CEC/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ void DbgPrint(const char* fmt, ...);
#define NULL 0
#endif

/*
static const uint32_t cyclesPerUS = (SystemCoreClock / 1000000ul);
static inline unsigned long micros() {
bool ready = false;
if (!ready) {
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->CTRL |= 1;
ready = true;
}
return DWT->CYCCNT / cyclesPerUS; // TODO: handle wraparound
}*/
#else

#define ASSERT(x) ((void)0)
Expand Down
10 changes: 9 additions & 1 deletion src/CEClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,17 @@ void CEClient::OnReceive(int source, int dest, unsigned char* buffer, int count)

if(_onReceiveCallback)
_onReceiveCallback(source, dest, buffer, count);

else
CEC_Device::OnReceive(source, dest, buffer, count);

if (!MonitorMode && dest == _logicalAddress && count == 1 && buffer[0] == 0x83) {
unsigned char buffer[4];
buffer[0] = 0x84;
buffer[1] = _physicalAddress >> 8;
buffer[2] = _physicalAddress;
buffer[3] = _deviceType;
TransmitFrame(0xF, buffer, 4);
}
}

// OnReady redefinition, to save the current status
Expand Down
2 changes: 0 additions & 2 deletions src/CEClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ typedef void (*OnReceiveCallbackFunction)(int, int, unsigned char*, int);
typedef void (*OnTransmitCompleteCallbackFunction)(bool);

public:

CEClient(int physicalAddress, int inputPin, int outputPin=-1);
void begin(CEC_DEVICE_TYPE type = CEC_LogicalDevice::CDT_PLAYBACK_DEVICE);
bool isReady();
Expand All @@ -22,7 +21,6 @@ typedef void (*OnTransmitCompleteCallbackFunction)(bool);
void run();

private:

void OnTransmitComplete(bool);
void OnReceive(int source, int dest, unsigned char* buffer, int count);
void OnReady();
Expand Down

0 comments on commit 9ec132c

Please sign in to comment.