mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-06-28 05:09:32 +00:00
IR_CMD_Handler
This commit is contained in:
@ -11,13 +11,7 @@ unsigned char IR_IndexBitAddress;
|
||||
unsigned int IR_Pulse;
|
||||
unsigned int currentIR_Pulse;
|
||||
|
||||
unsigned char IR_CommandNumber[3];
|
||||
unsigned char IRStatus;
|
||||
unsigned char NumberMacroProgramShot;
|
||||
unsigned char NumberShot;
|
||||
unsigned char NumberProgram;
|
||||
unsigned char NumberMacro;
|
||||
unsigned char CommandMacroProgramShot;
|
||||
|
||||
void IR_handler() // SONY (SIRC) protocol 12 bit (7+5)
|
||||
{
|
||||
@ -136,71 +130,13 @@ void ClearIRStatus()
|
||||
IRStatus = STATUS_START;
|
||||
}
|
||||
|
||||
void ClearIRCommand()
|
||||
{
|
||||
IR_CommandNumber[0] = 0xFF;
|
||||
IR_CommandNumber[1] = 0xFF;
|
||||
IR_CommandNumber[2] = 0xFF;
|
||||
IRData getIRData(){
|
||||
NVIC_DisableIRQ(EXTI1_IRQn);
|
||||
IRData ret = {IR_Address, IR_Command};
|
||||
NVIC_EnableIRQ(EXTI1_IRQn);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ClearIR()
|
||||
{
|
||||
IR_Command = 0x7F;
|
||||
IR_Address = 0x1F;
|
||||
IR_OptionsProgram = 0x00;
|
||||
|
||||
NumberMacroProgramShot = 0xFF;
|
||||
NumberShot = 0xFF;
|
||||
NumberProgram = 0xFF;
|
||||
NumberMacro = 0xFF;
|
||||
|
||||
CommandMacroProgramShot = 0x00;
|
||||
|
||||
ClearIRStatus();
|
||||
unsigned char IR_Available(){
|
||||
return IRStatus == STATUS_REPEAT;
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
for (unsigned char j = 0; j < 8; j++)
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
|
||||
if (((shiftreg[i] >> j) & 0x01) == 0x01)
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);
|
||||
}
|
||||
else
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
}
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user