Files
TX/source/pro_key.c

117 lines
2.0 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 MENU_KEY:
// Task = MENU_TASK; // display the menus
// break;
case MODE_KEY: // End Primary Key
// Task = MODE_TASK; // Display the Modes
#if 0 //Use mode key to toggle current gain
if(Port_State[MID_SR] & I_GAIN)
{
Port_State[MID_SR] &= ~I_GAIN;
}
else
{
Port_State[MID_SR] |= I_GAIN;
}
SPI0_SendBytes(Port_State, 3, EXPANDER);
//Sys_Chk_tmr = DELAY_1S;
#else
Task = MODE_TASK; // Display the Modes
#endif
break;
// break;
default:
break;
}
}
#endif