Compare commits

..

6 commits

Author SHA1 Message Date
stephan
f1ed05ce38 avr/ads8688: fix adc_gain cmd endianess
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/arm/avr@8988 bc5caf13-1734-44f8-af43-603852e9ee25
2024-06-04 16:33:47 +00:00
stephan
3394f87f9d avr/chaos: "L" eeprom load conditional
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/arm/avr@8987 bc5caf13-1734-44f8-af43-603852e9ee25
2024-06-04 16:20:00 +00:00
stephan
817040e9df avr/ads8688: fix read_adc command endianness
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/arm/avr@8986 bc5caf13-1734-44f8-af43-603852e9ee25
2024-06-04 16:04:01 +00:00
stephan
724aac154d avr/ads8688: fix ads8688_read()
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/arm/avr@8985 bc5caf13-1734-44f8-af43-603852e9ee25
2024-06-04 15:14:13 +00:00
stephan
1c246f434b avr/chaos: fix ADS8868 SDO input s/PORT/PIN/
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/arm/avr@8984 bc5caf13-1734-44f8-af43-603852e9ee25
2024-06-04 11:54:10 +00:00
stephan
17b0f52835 avr/chaos: fix DDR
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/arm/avr@8983 bc5caf13-1734-44f8-af43-603852e9ee25
2024-06-04 09:32:12 +00:00
4 changed files with 15 additions and 8 deletions

View file

@ -5,7 +5,7 @@
#define ADC_SDO 1 #define ADC_SDO 1
#define ADC_RST 0 #define ADC_RST 0
#define ADC_PO PORTD #define ADC_PO PORTD
#define ADC_PI PORTD #define ADC_PI PIND
#define ADC_PO_IO _SFR_IO_ADDR(ADC_PO) #define ADC_PO_IO _SFR_IO_ADDR(ADC_PO)
#define ADC_PI_IO _SFR_IO_ADDR(ADC_PI) #define ADC_PI_IO _SFR_IO_ADDR(ADC_PI)
static inline void ads8688_init() static inline void ads8688_init()
@ -40,7 +40,7 @@ static inline void ads8688_read(unsigned char *r, unsigned char *rr, unsigned ch
__asm__("sbi %[pk], %[ck]" "\n\t" __asm__("sbi %[pk], %[ck]" "\n\t"
"sbic %[pd], %[d]" "\n\t" "sbic %[pd], %[d]" "\n\t"
"ori %[q], %[i]" "\n\t" "ori %[q], %[i]" "\n\t"
"sbic %[pd], %[d]" "\n\t" "sbis %[pd], %[d]" "\n\t"
"andi %[q], %[ii]" "\n\t" "andi %[q], %[ii]" "\n\t"
"cbi %[pk], %[ck]" "\n\t" "cbi %[pk], %[ck]" "\n\t"
"nop" "\n\t" "nop" "\n\t"

View file

@ -434,6 +434,12 @@ int main()
wdt_kick(); wdt_kick();
} }
break; break;
case 'm':
resp[2] = conf.flags2;
conf.flags2 &=~ cmd[2];
conf.flags2 |= cmd[1];
resp[1] = conf.flags2;
break;
case 'M': case 'M':
resp[2] = conf.flags; resp[2] = conf.flags;
conf.flags &=~ cmd[2]; conf.flags &=~ cmd[2];
@ -450,14 +456,15 @@ int main()
case 'L': case 'L':
resp[1] = cmd[1]; resp[1] = cmd[1];
resp[2] = sizeof(conf); resp[2] = sizeof(conf);
eeprom_load(cmd[1]); if ((cmd[1] | 0x20) == 'e')
eeprom_load(cmd[2]);
if (conf.magic != MAGIC || conf.version != VERSION) { if (conf.magic != MAGIC || conf.version != VERSION) {
resp[0] = 'E'; resp[0] = 'E';
resp[2] = conf.version; resp[2] = conf.version;
if (cmd[2] != 'F') if (cmd[2] != 'F')
break; break;
} }
if (cmd[2]) { if (cmd[1] && upcase(cmd[1])) {
enable_irq(sreg); enable_irq(sreg);
spi_slave_Tx(resp, 3); spi_slave_Tx(resp, 3);
conf_init(); conf_init();
@ -543,8 +550,8 @@ void ads8688_config()
ads8688_cmd(INT2FRAME(conf.adcconf), r); ads8688_cmd(INT2FRAME(conf.adcconf), r);
for (char i=0; i<8; i++) for (char i=0; i<8; i++)
ads8688_cmd((unsigned char []){ ads8688_cmd((unsigned char []){
2*i+11,
(conf.adcgain >> (4*i)) & 0xf, (conf.adcgain >> (4*i)) & 0xf,
2*i+11,
}, r); }, r);
} }
@ -560,7 +567,7 @@ unsigned char read_adc(unsigned char c, unsigned char n)
cc = 1<<c; cc = 1<<c;
spi_int_init(); spi_int_init();
unsigned char cmd[2] = {0xc0 | (c << 2), 0}; unsigned char cmd[2] = {0, 0xc0 | (c << 2)};
unsigned char resp[2]; unsigned char resp[2];
unsigned char i; unsigned char i;
for (i=0; i<3; i++) for (i=0; i<3; i++)

View file

@ -8,7 +8,7 @@
static inline void led_init() static inline void led_init()
{ {
DDRC |= LED_MASK; DDRB |= LED_MASK;
} }
static uint8_t led_status() static uint8_t led_status()

View file

@ -7,7 +7,7 @@
static inline void ltc1655_init() static inline void ltc1655_init()
{ {
DDRD |= 0x70; DDRD |= 0xe0;
} }
static inline void ltc1655_bit(unsigned char c, unsigned char i) static inline void ltc1655_bit(unsigned char c, unsigned char i)