mirror of
https://codeberg.org/mclemens/ubitxv6.git
synced 2025-02-21 06:57:27 -05:00
Remove function declarations from pin definition file
This commit is contained in:
parent
91776fdcc7
commit
5596c0c8ab
@ -1,5 +1,6 @@
|
||||
#include <Arduino.h>//tone
|
||||
|
||||
#include "encoder.h"
|
||||
#include "morse.h"
|
||||
#include "pin_definitions.h"
|
||||
#include "settings.h"
|
||||
|
@ -43,7 +43,3 @@ static const uint8_t PIN_CW_KEY = 2; // Pin goes high during CW keydow
|
||||
// ...key can be up within a tx period
|
||||
//1 is UART RX
|
||||
//0 is UART TX
|
||||
|
||||
int enc_read(void); // returns the number of ticks in a short interval, +ve in clockwise, -ve in anti-clockwise
|
||||
void enc_setup(void); // Setups up initial values and interrupts.
|
||||
int btnDown(); //returns true if the encoder button is pressed
|
||||
|
10
push_button.cpp
Normal file
10
push_button.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include <Arduino.h>
|
||||
#include "pin_definitions.h"
|
||||
#include "push_button.h"
|
||||
|
||||
bool IsButtonPressed()
|
||||
{
|
||||
//Button has a pullup, so it reads high normally,
|
||||
//and reads low when pressed down
|
||||
return !digitalRead(PIN_ENC_PUSH_BUTTON);
|
||||
}
|
3
push_button.h
Normal file
3
push_button.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
bool IsButtonPressed(); //returns true if the encoder button is pressed
|
@ -1,5 +1,6 @@
|
||||
#include <Arduino.h>
|
||||
#include "colors.h"
|
||||
#include "encoder.h"
|
||||
#include "menu.h"
|
||||
#include "morse.h"
|
||||
#include "nano_gui.h"
|
||||
|
9
tmp.cpp
9
tmp.cpp
@ -1,12 +1,3 @@
|
||||
#include <Arduino.h>
|
||||
#include "pin_definitions.h"
|
||||
|
||||
void updateDisplay() {}
|
||||
void redrawVFOs(){}
|
||||
void drawTx(){}
|
||||
int btnDown()
|
||||
{
|
||||
//Button has a pullup, so it reads high normally,
|
||||
//and reads low when pressed down
|
||||
return !digitalRead(PIN_ENC_PUSH_BUTTON);
|
||||
}
|
10
ubitxv6.ino
10
ubitxv6.ino
@ -31,10 +31,12 @@
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include "button_timing.h"
|
||||
#include "encoder.h"
|
||||
#include "menu.h"
|
||||
#include "menu_main.h"
|
||||
#include "morse.h"
|
||||
#include "pin_definitions.h"
|
||||
#include "push_button.h"
|
||||
#include "nano_gui.h"
|
||||
#include "settings.h"
|
||||
#include "setup.h"
|
||||
@ -86,16 +88,16 @@ void checkPTT(){
|
||||
|
||||
//check if the encoder button was pressed
|
||||
ButtonPress_e checkButton(){
|
||||
if (!btnDown()){
|
||||
if (!IsButtonPressed()){
|
||||
return ButtonPress_e::NotPressed;
|
||||
}
|
||||
delay(DEBOUNCE_DELAY_MS);
|
||||
if (!btnDown()){//debounce
|
||||
if (!IsButtonPressed()){//debounce
|
||||
return ButtonPress_e::NotPressed;
|
||||
}
|
||||
|
||||
uint16_t down_time = 0;
|
||||
while(btnDown() && (down_time < LONG_PRESS_TIME_MS)){
|
||||
while(IsButtonPressed() && (down_time < LONG_PRESS_TIME_MS)){
|
||||
delay(LONG_PRESS_POLL_TIME_MS);
|
||||
down_time += LONG_PRESS_POLL_TIME_MS;
|
||||
}
|
||||
@ -165,7 +167,7 @@ void setup()
|
||||
setFrequency(globalSettings.vfoA.frequency);
|
||||
|
||||
//Run initial calibration routine if button is pressed during power up
|
||||
if(btnDown()){
|
||||
if(IsButtonPressed()){
|
||||
LoadDefaultSettings();
|
||||
setupTouch();
|
||||
SetActiveVfoMode(VfoMode_e::VFO_MODE_USB);
|
||||
|
Loading…
x
Reference in New Issue
Block a user