Compare commits
4 commits
f0182fdb20
...
4e5d4fa092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e5d4fa092 | ||
|
|
e1cdb1b2f5 | ||
|
|
049f835ce8 | ||
|
|
477e1a1f6d |
5 changed files with 18 additions and 10 deletions
4
Makefile
4
Makefile
|
|
@ -85,3 +85,7 @@ lcd.o: lcd.c spi_slave.h lcd_routines.h lcd_routines.c uart_atmega16.c
|
|||
$(AD) -U eeprom:r:$@
|
||||
%.eeprom.burn: %.eeprom
|
||||
$(AD) -U eeprom:v:$< || $(AD) -U eeprom:w:$<
|
||||
|
||||
%.ad:
|
||||
$(AD) -v -t
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#include "avr/io.h"
|
||||
#define ADC_SDI 4
|
||||
#define ADC_SDI 7
|
||||
#define ADC_SCK 5
|
||||
#define ADC_CE 7
|
||||
#define ADC_CE 4
|
||||
#define ADC_SDO 1
|
||||
#define ADC_RST 0
|
||||
#define ADC_PO PORTD
|
||||
#define ADC_PI PORTD
|
||||
#define ADC_PO_IO _SFR_IO_ADDR(ADC_PO)
|
||||
|
|
|
|||
|
|
@ -252,8 +252,8 @@ unsigned int adc_hv;
|
|||
int hv_is_safe()
|
||||
{
|
||||
return !hvosc_is_on()
|
||||
&& conf.dac == conf.dac_off
|
||||
&& adc_hv < conf.hvadc_safe
|
||||
&& conf.dac <= conf.dac_off
|
||||
&& adc_hv <= conf.hvadc_safe
|
||||
;
|
||||
}
|
||||
|
||||
|
|
@ -277,9 +277,12 @@ void hv_safe()
|
|||
unsigned char sreg = disable_irq();
|
||||
ltc1655_cmd(INT2FRAME(conf.dac_off));
|
||||
conf.dac = conf.dac_off;
|
||||
while (!read_hvadc())
|
||||
if (adc_hv < conf.hvadc_safe)
|
||||
unsigned int adc_last = 0xffff;
|
||||
while (!read_hvadc()) {
|
||||
if (adc_hv < conf.hvadc_safe || adc_hv >= adc_last)
|
||||
break;
|
||||
adc_last = adc_hv;
|
||||
}
|
||||
enable_irq(sreg);
|
||||
toggle_hv_led();
|
||||
}
|
||||
|
|
@ -295,7 +298,7 @@ int main()
|
|||
ltc1655_init();
|
||||
hv_safe();
|
||||
eeprom_load(0);
|
||||
if (conf.magic == MAGIC || conf.version == VERSION)
|
||||
if (conf.magic == MAGIC && conf.version == VERSION)
|
||||
conf_init();
|
||||
while (1) {
|
||||
unsigned char cmd[3];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "avr/io.h"
|
||||
#define LED1 2
|
||||
#define LED1 4
|
||||
#define LED2 3
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PORT PORTB
|
||||
#define LED_GREEN (1<<LED1)
|
||||
#define LED_RED (1<<LED2)
|
||||
#define LED_MASK (LED_GREEN | LED_RED)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "avr/io.h"
|
||||
#define DAC_SDI 4
|
||||
#define DAC_SDI 7
|
||||
#define DAC_SCK 5
|
||||
#define DAC_CE 6
|
||||
#define DAC_PORT PORTD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue