This commit is contained in:
2024-08-23 00:23:25 +03:00
parent 2c2ebd7137
commit 55e8424f78
3 changed files with 326 additions and 194 deletions

View File

@ -50,7 +50,7 @@ void IR_handler() // SONY (SIRC) protocol 12 bit (7+5)
if ((currentIR_Pulse < 130000) && (currentIR_Pulse > 110000)) // 2,7 ms - 2,3 ms
{
IRStatus = STATUS_COMMAND; // 129600 - 110400
print("STATUS_COMMAND\n");
// print("STATUS_COMMAND\n");
}
else
{
@ -65,19 +65,19 @@ void IR_handler() // SONY (SIRC) protocol 12 bit (7+5)
if (currentIR_Pulse < 37440) // 0.78 ms 37440
{
IR_Command &= ~((1 << IR_IndexBitCommand) & 0xFF);
print("0");
// print("0");
}
else
{
IR_Command |= ((1 << IR_IndexBitCommand) & 0xFF);
print("1");
// print("1");
}
IR_IndexBitCommand++;
if (IR_IndexBitCommand == 7)
{
IRStatus = STATUS_ADDRESS;
print(" STATUS_ADDRESS ");
// print(" STATUS_ADDRESS ");
}
else
{
@ -93,19 +93,20 @@ void IR_handler() // SONY (SIRC) protocol 12 bit (7+5)
if (currentIR_Pulse < 37440) // 0.78 <20><>
{
IR_Address &= ~((1 << IR_IndexBitAddress) & 0xFF);
print("0");
// print("0");
}
else
{
IR_Address |= ((1 << IR_IndexBitAddress) & 0xFF);
print("1");
// print("1");
}
IR_IndexBitAddress++;
if (IR_IndexBitAddress == 5)
{
// printNumber(IR_Command);
IRStatus = STATUS_REPEAT;
print("\n\n\n");
// print("\n\n\n");
}
else
{
@ -118,7 +119,7 @@ void IR_handler() // SONY (SIRC) protocol 12 bit (7+5)
break;
case STATUS_ERROR:
print("STATUS_ERROR\n\n");
// print("STATUS_ERROR\n\n");
default:
ClearIRStatus();
@ -158,6 +159,11 @@ void ClearIR()
ClearIRStatus();
}
void SetShiftReg_inline(unsigned char b1, unsigned char b2, unsigned char b3){
unsigned char shiftreg[3] = {b1,b2,b3};
SetShiftReg(shiftreg);
}
void SetShiftReg(unsigned char shiftreg[3])
{
for (unsigned char i = 0; i < 3; i++)
@ -197,3 +203,4 @@ void SetShiftReg(unsigned char shiftreg[3])
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
}
}