Files
TX/source/pro_key.c
Brent Perteet 658cedfa3b Added software timers
Accessory state machine framework functional
2025-06-18 17:53:00 -05:00

97 lines
1.5 KiB
C

/*
* pro_key.c
*
* Created on: Jun 27, 2022
* Author: Keith.Lloyd
*/
#include "pro_key.h"
#include <stdbool.h>
#include <stdint.h>
#include "keys.h"
#include "frq.h"
#include "display.h"
#include "main.h"
#include "timer.h"
#include "pwr_level.h"
#include "mode.h"
#include "ports.h"
#include "utils.h"
extern uint8_t Task,Cur_Mode,Suspend_Step_Chk,step_count;
extern uint8_t frequency,old_freq,frq_chg_tmr;
extern uint32_t new_freq;
extern uint16_t Vchktmr,Key_Lock_Out_tmr;
uint8_t keyval;
extern uint8_t Port_State[];
#if 1
void pro_key(uint32_t pressed)
{
uint32_t tmp_frqx;
switch(pressed)//(key_bits)
{
//TODO: cases need to use the key #defines from keys.c and keys.h
case ON_OFF_KEY: // Begin Primary Key
Task = PWR_OFF_TASK;
break;
case KEY_POWER: // Long press power Key
Task = PWR_OFF_TASK;
break;
case FRQ_KEY:
freq_key_process();
break;
// case KEY_FREQ << KEY_LONG_PRESS: //Enable/Disable CD(LD).
// LD_key_process();
// break;
case PWR_UP_KEY:
if(Key_Lock_Out_tmr == 0)
{
Vchktmr = LOCK_OUT_DELAY;
inc_pwr();//increment the power output
Key_Lock_Out_tmr = KEY_LOCK_TIME;
Suspend_Step_Chk = false;
step_count = 0;
}
break;
case PWR_DN_KEY:
if(Key_Lock_Out_tmr == 0)
{
Vchktmr = LOCK_OUT_DELAY;
dec_pwr();// decrement the power output
Key_Lock_Out_tmr = KEY_LOCK_TIME;
Suspend_Step_Chk = false;
step_count = 0;
}
break;
case MODE_KEY: // End Primary Key
Task = MODE_TASK; // Display the Modes
break;
// break;
default:
break;
}
}
#endif