update
This commit is contained in:
6
Makefile
6
Makefile
@@ -7,12 +7,12 @@ F_CPU = 16000000UL
|
|||||||
MCU = atmega328p
|
MCU = atmega328p
|
||||||
|
|
||||||
CFLAGS += -DF_CPU=$(F_CPU) -mmcu=$(MCU)
|
CFLAGS += -DF_CPU=$(F_CPU) -mmcu=$(MCU)
|
||||||
CFLAGS += -I. -O2 --std=c11
|
CFLAGS += -I. -Os --std=c11
|
||||||
CFLAGS += -ffunction-sections -fdata-sections
|
CFLAGS += -ffunction-sections -fdata-sections
|
||||||
|
|
||||||
LDFLAGS += -s -mmcu=$(MCU)
|
LDFLAGS += -s -mmcu=$(MCU)
|
||||||
LDFLAGS += -Wl,--gc-sections
|
LDFLAGS += -Wl,--gc-sections
|
||||||
LDFLAGS += -Wl,-u,vfprintf -lprintf_flt
|
LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -lm
|
||||||
|
|
||||||
MAIN_OBJS += main.o
|
MAIN_OBJS += main.o
|
||||||
MAIN_OBJS += adc.o
|
MAIN_OBJS += adc.o
|
||||||
@@ -54,7 +54,7 @@ TTY_SPEED = 115200
|
|||||||
BACKUP = $(MAIN_HEX).bak
|
BACKUP = $(MAIN_HEX).bak
|
||||||
|
|
||||||
upload: $(MAIN_HEX)
|
upload: $(MAIN_HEX)
|
||||||
$(AVRDUDE) -qq -c arduino -p ATMEGA328P -P $(TTY_PORT) -b $(TTY_SPEED) -U flash:w:$<
|
$(AVRDUDE) -qq -c arduino -p m328p -P $(TTY_PORT) -b $(TTY_SPEED) -U flash:w:$<
|
||||||
|
|
||||||
download:
|
download:
|
||||||
$(AVRDUDE) -F -V -c arduino -p m328p -P $(TTY_PORT) -b $(TTY_SPEED) -U flash:r:$(BACKUP):i
|
$(AVRDUDE) -F -V -c arduino -p m328p -P $(TTY_PORT) -b $(TTY_SPEED) -U flash:r:$(BACKUP):i
|
||||||
|
|||||||
36
README.md
36
README.md
@@ -1,19 +1,41 @@
|
|||||||
# Micro PA50 controller
|
# Micro PA50 controller
|
||||||
|
|
||||||
|
|
||||||
set tx off;
|
|
||||||
while (ptt is on || have input power ) {
|
|
||||||
check freq;
|
```
|
||||||
|
set amp off;
|
||||||
|
while () {
|
||||||
|
if (ptt is on || have input power) {
|
||||||
|
check temp;
|
||||||
|
if (temp is more min) {
|
||||||
|
set fan on;
|
||||||
|
} else {
|
||||||
|
set fan off;
|
||||||
|
}
|
||||||
|
if (temp is over) {
|
||||||
|
show temp warning;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
check freq; // if auto?
|
||||||
if freq in {
|
if freq in {
|
||||||
set lpf for the freq if need;
|
set lpf for the freq if need;
|
||||||
calc vswr;
|
calc power and vswr;
|
||||||
if (swr is good) {
|
if (vswr is good) {
|
||||||
set tx on;
|
set amp on;
|
||||||
} else {
|
} else {
|
||||||
|
set amp off;
|
||||||
show wrong swr;
|
show wrong swr;
|
||||||
}
|
}
|
||||||
|
if (power too hight) {
|
||||||
|
set amp off immed;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
show wron freq;
|
show wron freq;
|
||||||
set tx off;
|
set amp off;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
wait 100ms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|||||||
2
adc.c
2
adc.c
@@ -37,7 +37,7 @@ uint16_t adc_read(uint8_t channel) {
|
|||||||
uint16_t hval = (uint16_t)ADCH;
|
uint16_t hval = (uint16_t)ADCH;
|
||||||
hval = (hval << 8) & 0xFF00;
|
hval = (hval << 8) & 0xFF00;
|
||||||
lval = lval & 0x00FF;
|
lval = lval & 0x00FF;
|
||||||
return hval | lval;
|
return (hval | lval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
199
contr.c
199
contr.c
@@ -7,6 +7,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
@@ -29,11 +30,31 @@
|
|||||||
#define CONTR_BAND_40M 0x04
|
#define CONTR_BAND_40M 0x04
|
||||||
#define CONTR_BAND_80M 0x05
|
#define CONTR_BAND_80M 0x05
|
||||||
|
|
||||||
|
#define CONR_VCCARR_SIZE 4
|
||||||
|
#define CONR_PWRARR_SIZE 16
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t band;
|
uint8_t band;
|
||||||
uint16_t vcc;
|
|
||||||
uint16_t cnt;
|
|
||||||
uint16_t freq;
|
uint16_t freq;
|
||||||
|
uint16_t cnt;
|
||||||
|
|
||||||
|
uint16_t vccs[CONR_VCCARR_SIZE];
|
||||||
|
size_t vccp;
|
||||||
|
float vcc;
|
||||||
|
uint16_t vccr;
|
||||||
|
|
||||||
|
uint16_t fwd1s[CONR_PWRARR_SIZE];
|
||||||
|
uint16_t fwd2s[CONR_PWRARR_SIZE];
|
||||||
|
size_t fwd1p;
|
||||||
|
size_t fwd2p;
|
||||||
|
uint16_t fwd;
|
||||||
|
|
||||||
|
uint16_t rev1s[CONR_PWRARR_SIZE];
|
||||||
|
uint16_t rev2s[CONR_PWRARR_SIZE];
|
||||||
|
size_t rev1p;
|
||||||
|
size_t rev2p;
|
||||||
|
uint16_t rev;
|
||||||
|
|
||||||
} contr_t;
|
} contr_t;
|
||||||
|
|
||||||
contr_t contr;
|
contr_t contr;
|
||||||
@@ -45,21 +66,99 @@ void contr_read_band(void);
|
|||||||
|
|
||||||
void contr_init(void) {
|
void contr_init(void) {
|
||||||
contr.band = CONTR_BAND_OFF;
|
contr.band = CONTR_BAND_OFF;
|
||||||
|
contr.vccp = 0;
|
||||||
|
for (size_t i = 0; i < CONR_VCCARR_SIZE; i++) contr.vccs[i] = 0;
|
||||||
|
|
||||||
|
contr.fwd1p = 0;
|
||||||
|
contr.fwd2p = 0;
|
||||||
|
contr.fwd2p = 0;
|
||||||
|
for (size_t i = 0; i < CONR_PWRARR_SIZE; i++) contr.fwd1s[i] = 0;
|
||||||
|
for (size_t i = 0; i < CONR_PWRARR_SIZE; i++) contr.fwd2s[i] = 0;
|
||||||
|
contr.fwd = 0;
|
||||||
|
|
||||||
|
contr.rev1p = 0;
|
||||||
|
contr.rev2p = 0;
|
||||||
|
contr.rev2p = 0;
|
||||||
|
for (size_t i = 0; i < CONR_PWRARR_SIZE; i++) contr.rev1s[i] = 0;
|
||||||
|
for (size_t i = 0; i < CONR_PWRARR_SIZE; i++) contr.rev2s[i] = 0;
|
||||||
|
contr.rev = 0;
|
||||||
}
|
}
|
||||||
void contr_setup(void) {
|
void contr_setup(void) {
|
||||||
contr_read_band();
|
contr_read_band();
|
||||||
}
|
}
|
||||||
|
|
||||||
void contr_measure_vcc() {
|
#define CONTR_VCC_SCALE 270.0F
|
||||||
contr.vcc = adc_read(ACD_CHANELL3);
|
void contr_measure_vcc(void) {
|
||||||
|
contr.vccr = adc_read(ACD_CHANELL3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void contr_calc_vcc(void) {
|
||||||
#define CONTR_VCC_SCALE 2700.0F
|
contr.vcc = lroundf((float)contr.vccr / CONTR_VCC_SCALE) / 10.0F;
|
||||||
float contr_get_vcc() {
|
|
||||||
return (float)contr.vcc / CONTR_VCC_SCALE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float contr_get_vcc(void) {
|
||||||
|
return contr.vcc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CONTR_FWD_SCALE 370
|
||||||
|
void contr_measure_fwd(void) {
|
||||||
|
contr.fwd1s[contr.fwd1p] = adc_read(ACD_CHANELL1);
|
||||||
|
contr.fwd1p++;
|
||||||
|
if ((contr.fwd1p) > CONR_PWRARR_SIZE) {
|
||||||
|
contr.fwd1p = 0;
|
||||||
|
if ((++(contr.fwd2p)) > CONR_PWRARR_SIZE) {
|
||||||
|
contr.fwd2p = 0;
|
||||||
|
}
|
||||||
|
uint32_t summ = 0;
|
||||||
|
for (size_t i = 0; i < CONR_PWRARR_SIZE; i++) {
|
||||||
|
summ += contr.fwd1s[i];
|
||||||
|
}
|
||||||
|
contr.fwd2s[contr.fwd2p] = (uint16_t)(summ / CONR_PWRARR_SIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void contr_calc_fwd(void) {
|
||||||
|
uint32_t summ = 0;
|
||||||
|
for (size_t i = 0; i < CONR_PWRARR_SIZE; i++) {
|
||||||
|
summ += contr.fwd2s[i];
|
||||||
|
}
|
||||||
|
summ /= CONR_PWRARR_SIZE;
|
||||||
|
contr.fwd = summ / CONTR_FWD_SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t contr_get_fwd(void) {
|
||||||
|
return contr.fwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CONTR_REV_SCALE 28
|
||||||
|
void contr_measure_rev(void) {
|
||||||
|
contr.rev1s[contr.rev1p] = adc_read(ACD_CHANELL0);
|
||||||
|
contr.rev1p++;
|
||||||
|
if ((contr.rev1p) > CONR_PWRARR_SIZE) {
|
||||||
|
contr.rev1p = 0;
|
||||||
|
if ((++(contr.rev2p)) > CONR_PWRARR_SIZE) {
|
||||||
|
contr.rev2p = 0;
|
||||||
|
}
|
||||||
|
uint32_t summ = 0;
|
||||||
|
for (size_t i = 0; i < CONR_PWRARR_SIZE; i++) {
|
||||||
|
summ += contr.rev1s[i];
|
||||||
|
}
|
||||||
|
contr.rev2s[contr.rev2p] = (summ / CONR_PWRARR_SIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void contr_calc_rev(void) {
|
||||||
|
uint32_t summ = 0;
|
||||||
|
for (size_t i = 0; i < CONR_PWRARR_SIZE; i++) {
|
||||||
|
summ += contr.rev2s[i];
|
||||||
|
}
|
||||||
|
summ /= CONR_PWRARR_SIZE;
|
||||||
|
contr.rev = summ / CONTR_REV_SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t contr_get_rev(void) {
|
||||||
|
return contr.rev;
|
||||||
|
}
|
||||||
|
|
||||||
void contr_switch_band(void) {
|
void contr_switch_band(void) {
|
||||||
switch (contr.band) {
|
switch (contr.band) {
|
||||||
@@ -81,26 +180,33 @@ void contr_switch_band(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void contr_set_band(uint8_t band) {
|
void contr_set_band(uint8_t band) {
|
||||||
relaytx_off();
|
ampl_off();
|
||||||
contr.band = band;
|
contr.band = band;
|
||||||
|
|
||||||
relay80m_off();
|
|
||||||
relay40m_off();
|
|
||||||
relay20m_off();
|
|
||||||
relay10m_off();
|
|
||||||
|
|
||||||
switch (contr.band) {
|
switch (contr.band) {
|
||||||
case CONTR_BAND_10M:
|
case CONTR_BAND_10M:
|
||||||
relay10m_on();
|
filter80m_off();
|
||||||
|
filter40m_off();
|
||||||
|
filter20m_off();
|
||||||
|
filter10m_on();
|
||||||
break;
|
break;
|
||||||
case CONTR_BAND_20M:
|
case CONTR_BAND_20M:
|
||||||
relay20m_on();
|
filter80m_off();
|
||||||
|
filter40m_off();
|
||||||
|
filter10m_off();
|
||||||
|
filter20m_on();
|
||||||
break;
|
break;
|
||||||
case CONTR_BAND_40M:
|
case CONTR_BAND_40M:
|
||||||
relay40m_on();
|
filter80m_off();
|
||||||
|
filter20m_off();
|
||||||
|
filter10m_off();
|
||||||
|
filter40m_on();
|
||||||
break;
|
break;
|
||||||
case CONTR_BAND_80M:
|
case CONTR_BAND_80M:
|
||||||
relay80m_on();
|
filter40m_off();
|
||||||
|
filter20m_off();
|
||||||
|
filter10m_off();
|
||||||
|
filter80m_on();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -158,12 +264,12 @@ void contr_show_logo(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void contr_show_band(void) {
|
void contr_show_band(void) {
|
||||||
disp_string(0, 13, contr_get_bandname(contr.band));
|
disp_string(0, 13, contr_get_bandname());
|
||||||
}
|
}
|
||||||
|
|
||||||
void contr_show_vcc(void) {
|
void contr_show_vcc(void) {
|
||||||
char buffer[12] = { '\0' };
|
char buffer[12] = { '\0' };
|
||||||
sprintf(buffer, "%03.1fv", contr_get_vcc());
|
sprintf(buffer, "%4.1fv", contr_get_vcc());
|
||||||
disp_string(3, 11, buffer);
|
disp_string(3, 11, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,10 +282,15 @@ void contr_show_ptt(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ISR(TIMER0_OVF_vect) {
|
ISR(TIMER0_OVF_vect) {
|
||||||
|
contr_measure_vcc();
|
||||||
|
contr_measure_fwd();
|
||||||
|
contr_measure_rev();
|
||||||
contr.freq = contr.cnt;
|
contr.freq = contr.cnt;
|
||||||
contr.cnt = 0;
|
contr.cnt = 0;
|
||||||
button_handle();
|
button_handle();
|
||||||
uart_handle();
|
uart_handle();
|
||||||
|
contr_calc_fwd();
|
||||||
|
contr_calc_rev();
|
||||||
}
|
}
|
||||||
|
|
||||||
ISR(TIMER1_OVF_vect) {
|
ISR(TIMER1_OVF_vect) {
|
||||||
@@ -187,10 +298,43 @@ ISR(TIMER1_OVF_vect) {
|
|||||||
REG_SETUP(TCNT1, TIMER1_PRESIZE);
|
REG_SETUP(TCNT1, TIMER1_PRESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CONTR_FREQ_SCALE 2
|
||||||
|
uint16_t contr_get_freq(void) {
|
||||||
|
return contr.freq / CONTR_FREQ_SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
void contr_show_freq(void) {
|
void contr_show_freq(void) {
|
||||||
char buffer[12] = { '\0' };
|
char buffer[12] = { '\0' };
|
||||||
sprintf(buffer, "%2.0fM", (float)contr.freq / 16.05F);
|
uint16_t freq = contr_get_freq();
|
||||||
disp_string(0, 0, buffer);
|
|
||||||
|
sprintf(buffer, "%5uM", freq);
|
||||||
|
disp_string(0, 0, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void contr_show_fwd(void) {
|
||||||
|
char buffer[12] = { '\0' };
|
||||||
|
sprintf(buffer, "F %7uw", contr_get_fwd());
|
||||||
|
disp_string(1, 2, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void contr_show_rev(void) {
|
||||||
|
char buffer[12] = { '\0' };
|
||||||
|
sprintf(buffer, "R %7uw", contr_get_rev());
|
||||||
|
disp_string(2, 2, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void contr_show_swr(void) {
|
||||||
|
char buffer[12] = { '\0' };
|
||||||
|
uint16_t fwd = contr_get_fwd();
|
||||||
|
uint16_t rev = contr_get_rev();
|
||||||
|
uint16_t diff = (fwd - rev);
|
||||||
|
|
||||||
|
uint16_t swr = 0;
|
||||||
|
if (diff != 0) {
|
||||||
|
swr =((fwd + rev) * 100) / diff;
|
||||||
|
}
|
||||||
|
sprintf(buffer, " %u", swr);
|
||||||
|
disp_string(2, 2, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void contr_main(void) {
|
void contr_main(void) {
|
||||||
@@ -199,7 +343,10 @@ void contr_main(void) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
contr_show_ptt();
|
contr_show_ptt();
|
||||||
contr_button_eval();
|
contr_button_eval();
|
||||||
contr_measure_vcc();
|
//contr_calc_vcc();
|
||||||
|
//contr_show_fwd();
|
||||||
|
//contr_show_rev();
|
||||||
|
contr_show_swr();
|
||||||
contr_show_vcc();
|
contr_show_vcc();
|
||||||
contr_show_band();
|
contr_show_band();
|
||||||
contr_show_freq();
|
contr_show_freq();
|
||||||
@@ -208,11 +355,13 @@ void contr_main(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CONTR_BAND_EEPROM_ADDR 0x00
|
||||||
|
|
||||||
void contr_write_band(void) {
|
void contr_write_band(void) {
|
||||||
eeprom_write_bytes(0x00, &contr.band, sizeof(contr.band));
|
eeprom_write_bytes(CONTR_BAND_EEPROM_ADDR, &contr.band, sizeof(contr.band));
|
||||||
}
|
}
|
||||||
|
|
||||||
void contr_read_band(void) {
|
void contr_read_band(void) {
|
||||||
eeprom_read_bytes(0x00, &contr.band, sizeof(contr.band));
|
eeprom_read_bytes(CONTR_BAND_EEPROM_ADDR, &contr.band, sizeof(contr.band));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
main.c
20
main.c
@@ -31,11 +31,11 @@ int main(void) {
|
|||||||
timer1_init();
|
timer1_init();
|
||||||
|
|
||||||
atten_init();
|
atten_init();
|
||||||
relaytx_init();
|
ampl_init();
|
||||||
relay10m_init();
|
filter10m_init();
|
||||||
relay20m_init();
|
filter20m_init();
|
||||||
relay40m_init();
|
filter40m_init();
|
||||||
relay80m_init();
|
filter80m_init();
|
||||||
buzzer_init();
|
buzzer_init();
|
||||||
fan_init();
|
fan_init();
|
||||||
ptt_init();
|
ptt_init();
|
||||||
@@ -43,12 +43,12 @@ int main(void) {
|
|||||||
button_init();
|
button_init();
|
||||||
button_reset();
|
button_reset();
|
||||||
|
|
||||||
relaytx_off();
|
ampl_off();
|
||||||
atten_off();
|
atten_off();
|
||||||
relay10m_off();
|
filter10m_off();
|
||||||
relay20m_off();
|
filter20m_off();
|
||||||
relay40m_off();
|
filter40m_off();
|
||||||
relay80m_off();
|
filter80m_off();
|
||||||
buzzer_off();
|
buzzer_off();
|
||||||
fan_off();
|
fan_off();
|
||||||
|
|
||||||
|
|||||||
48
relay.c
48
relay.c
@@ -25,64 +25,64 @@ bool ptt_is_pressed(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* D4 PD4: Set input relay 5 output */
|
/* D4 PD4: Set input filter 5 output */
|
||||||
void relaytx_init(void) {
|
void ampl_init(void) {
|
||||||
REG_SETUP_BIT(DDRD, PD4);
|
REG_SETUP_BIT(DDRD, PD4);
|
||||||
}
|
}
|
||||||
void relaytx_on(void) {
|
void ampl_on(void) {
|
||||||
REG_SETUP_BIT(PORTD, PD4);
|
REG_SETUP_BIT(PORTD, PD4);
|
||||||
}
|
}
|
||||||
void relaytx_off(void) {
|
void ampl_off(void) {
|
||||||
REG_SETDOWN_BIT(PORTD, PD4);
|
REG_SETDOWN_BIT(PORTD, PD4);
|
||||||
}
|
}
|
||||||
void relaytx_onoff(void) {
|
void ampl_onoff(void) {
|
||||||
if (REG_BIT_VALUE(PIND, PD4)) {
|
if (REG_BIT_VALUE(PIND, PD4)) {
|
||||||
relaytx_off();
|
ampl_off();
|
||||||
} else {
|
} else {
|
||||||
relaytx_on();
|
ampl_on();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* D6 PD6: Set 10M relay 1 output */
|
/* D6 PD6: Set 10M filter 1 output */
|
||||||
void relay10m_init(void) {
|
void filter10m_init(void) {
|
||||||
REG_SETUP_BIT(DDRD, PD6);
|
REG_SETUP_BIT(DDRD, PD6);
|
||||||
}
|
}
|
||||||
void relay10m_on(void) {
|
void filter10m_on(void) {
|
||||||
REG_SETUP_BIT(PORTD, PD6);
|
REG_SETUP_BIT(PORTD, PD6);
|
||||||
}
|
}
|
||||||
void relay10m_off(void) {
|
void filter10m_off(void) {
|
||||||
REG_SETDOWN_BIT(PORTD, PD6);
|
REG_SETDOWN_BIT(PORTD, PD6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* D7 PD7: Set 20M relay 2 output */
|
/* D7 PD7: Set 20M filter 2 output */
|
||||||
void relay20m_init(void) {
|
void filter20m_init(void) {
|
||||||
REG_SETUP_BIT(DDRD, PD7);
|
REG_SETUP_BIT(DDRD, PD7);
|
||||||
}
|
}
|
||||||
void relay20m_on(void) {
|
void filter20m_on(void) {
|
||||||
REG_SETUP_BIT(PORTD, PD7);
|
REG_SETUP_BIT(PORTD, PD7);
|
||||||
}
|
}
|
||||||
void relay20m_off(void) {
|
void filter20m_off(void) {
|
||||||
REG_SETDOWN_BIT(PORTD, PD7);
|
REG_SETDOWN_BIT(PORTD, PD7);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* D8 PB0: Set 40M relay 3 output */
|
/* D8 PB0: Set 40M filter 3 output */
|
||||||
void relay40m_init(void) {
|
void filter40m_init(void) {
|
||||||
REG_SETUP_BIT(DDRB, PB0);
|
REG_SETUP_BIT(DDRB, PB0);
|
||||||
}
|
}
|
||||||
void relay40m_on(void) {
|
void filter40m_on(void) {
|
||||||
REG_SETUP_BIT(PORTB, PB0);
|
REG_SETUP_BIT(PORTB, PB0);
|
||||||
}
|
}
|
||||||
void relay40m_off(void) {
|
void filter40m_off(void) {
|
||||||
REG_SETDOWN_BIT(PORTB, PB0);
|
REG_SETDOWN_BIT(PORTB, PB0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* D9 PB1: Set 80M relay 4 output */
|
/* D9 PB1: Set 80M filter 4 output */
|
||||||
void relay80m_init(void) {
|
void filter80m_init(void) {
|
||||||
REG_SETUP_BIT(DDRB, PB1);
|
REG_SETUP_BIT(DDRB, PB1);
|
||||||
}
|
}
|
||||||
void relay80m_on(void) {
|
void filter80m_on(void) {
|
||||||
REG_SETUP_BIT(PORTB, PB1);
|
REG_SETUP_BIT(PORTB, PB1);
|
||||||
}
|
}
|
||||||
void relay80m_off(void) {
|
void filter80m_off(void) {
|
||||||
REG_SETDOWN_BIT(PORTB, PB1);
|
REG_SETDOWN_BIT(PORTB, PB1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ bool fan_is_on(void) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* D13 PB5: Set attenuator relay output */
|
/* D13 PB5: Set attenuator filter output */
|
||||||
void atten_init(void) {
|
void atten_init(void) {
|
||||||
REG_SETUP_BIT(DDRB, PB5);
|
REG_SETUP_BIT(DDRB, PB5);
|
||||||
}
|
}
|
||||||
|
|||||||
32
relay.h
32
relay.h
@@ -5,26 +5,26 @@
|
|||||||
void ptt_init(void);
|
void ptt_init(void);
|
||||||
bool ptt_is_pressed(void);
|
bool ptt_is_pressed(void);
|
||||||
|
|
||||||
void relaytx_init(void);
|
void ampl_init(void);
|
||||||
void relaytx_on(void);
|
void ampl_on(void);
|
||||||
void relaytx_off(void);
|
void ampl_off(void);
|
||||||
void relaytx_onoff(void);
|
void ampl_onoff(void);
|
||||||
|
|
||||||
void relay10m_init(void);
|
void filter10m_init(void);
|
||||||
void relay10m_on(void);
|
void filter10m_on(void);
|
||||||
void relay10m_off(void);
|
void filter10m_off(void);
|
||||||
|
|
||||||
void relay20m_init(void);
|
void filter20m_init(void);
|
||||||
void relay20m_on(void);
|
void filter20m_on(void);
|
||||||
void relay20m_off(void);
|
void filter20m_off(void);
|
||||||
|
|
||||||
void relay40m_init(void);
|
void filter40m_init(void);
|
||||||
void relay40m_on(void);
|
void filter40m_on(void);
|
||||||
void relay40m_off(void);
|
void filter40m_off(void);
|
||||||
|
|
||||||
void relay80m_init(void);
|
void filter80m_init(void);
|
||||||
void relay80m_on(void);
|
void filter80m_on(void);
|
||||||
void relay80m_off(void);
|
void filter80m_off(void);
|
||||||
|
|
||||||
void buzzer_init(void);
|
void buzzer_init(void);
|
||||||
void buzzer_on(void);
|
void buzzer_on(void);
|
||||||
|
|||||||
7
timer.c
7
timer.c
@@ -22,10 +22,11 @@ void timer0_init(void) {
|
|||||||
|
|
||||||
/* TCCR0B */
|
/* TCCR0B */
|
||||||
/* Set clock to 1/64 */
|
/* Set clock to 1/64 */
|
||||||
REG_SETDOWN_BIT(TCCR0B, CS02);
|
REG_SETUP_BIT(TCCR0B, CS02);
|
||||||
REG_SETUP_BIT(TCCR0B, CS01);
|
REG_SETDOWN_BIT(TCCR0B, CS01);
|
||||||
REG_SETUP_BIT(TCCR0B, CS00);
|
REG_SETDOWN_BIT(TCCR0B, CS00);
|
||||||
|
|
||||||
|
//REG_SETUP(TCNT0, TIMER0_PRESIZE);
|
||||||
/* TIMSK0 */
|
/* TIMSK0 */
|
||||||
/* Enable timer interrupt */
|
/* Enable timer interrupt */
|
||||||
REG_SETUP_BIT(TIMSK0, TOIE0);
|
REG_SETUP_BIT(TIMSK0, TOIE0);
|
||||||
|
|||||||
3
timer.h
3
timer.h
@@ -1,7 +1,8 @@
|
|||||||
#ifndef CONTR_INIT_H_QWERTY
|
#ifndef CONTR_INIT_H_QWERTY
|
||||||
#define CONTR_INIT_H_QWERTY
|
#define CONTR_INIT_H_QWERTY
|
||||||
|
|
||||||
#define TIMER1_PRESIZE 65532 // 65536
|
//#define TIMER0_PRESIZE 128
|
||||||
|
#define TIMER1_PRESIZE 65500 //65532 // 65536
|
||||||
|
|
||||||
void timer0_init(void);
|
void timer0_init(void);
|
||||||
void timer1_init(void);
|
void timer1_init(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user