|
|
|
@ -3,7 +3,6 @@
|
|
|
|
#include <util/delay.h>
|
|
|
|
#include <util/delay.h>
|
|
|
|
#include "avr-hd44780/lcd.h"
|
|
|
|
#include "avr-hd44780/lcd.h"
|
|
|
|
#include "i2c_peter/i2cmaster.h"
|
|
|
|
#include "i2c_peter/i2cmaster.h"
|
|
|
|
#include "sdi_shield.h"
|
|
|
|
|
|
|
|
#include <avr/eeprom.h>
|
|
|
|
#include <avr/eeprom.h>
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t pgm = 0;
|
|
|
|
uint8_t pgm = 0;
|
|
|
|
@ -124,13 +123,31 @@ int main(void){
|
|
|
|
sei();
|
|
|
|
sei();
|
|
|
|
|
|
|
|
|
|
|
|
while(1){
|
|
|
|
while(1){
|
|
|
|
shield_set_flags(0x5000, 0x01);
|
|
|
|
//shield_set_flags(0x5000, 0x01);
|
|
|
|
|
|
|
|
i2c_start_wait(SDI_SHIELD_ADDR + I2C_WRITE); // set device address and write mode
|
|
|
|
|
|
|
|
i2c_write(0x00);
|
|
|
|
|
|
|
|
i2c_write(0x50);
|
|
|
|
|
|
|
|
i2c_write(0x01);
|
|
|
|
|
|
|
|
i2c_stop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i2c_start_wait(SDI_SHIELD_ADDR + I2C_WRITE); // set device address and write mode
|
|
|
|
|
|
|
|
i2c_write(0x01);
|
|
|
|
|
|
|
|
i2c_write(0x50);
|
|
|
|
|
|
|
|
i2c_rep_start(SDI_SHIELD_ADDR + I2C_READ); // set device address and read mode
|
|
|
|
|
|
|
|
uint8_t data_length = i2c_readNak();
|
|
|
|
|
|
|
|
i2c_stop();
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t data_length;
|
|
|
|
//uint8_t data_length;
|
|
|
|
shield_read_uint8(0x5001, &data_length);
|
|
|
|
//shield_read_uint8(0x5001, &data_length);
|
|
|
|
if(data_length){
|
|
|
|
if(data_length){
|
|
|
|
uint8_t tally;
|
|
|
|
i2c_start_wait(SDI_SHIELD_ADDR + I2C_WRITE); // set device address and write mode
|
|
|
|
shield_read_uint8(0x5100+menu.settings.cam, &tally);
|
|
|
|
i2c_write(menu.settings.cam);
|
|
|
|
|
|
|
|
i2c_write(0x51);
|
|
|
|
|
|
|
|
i2c_rep_start(SDI_SHIELD_ADDR + I2C_READ); // set device address and read mode
|
|
|
|
|
|
|
|
uint8_t tally = i2c_readNak();
|
|
|
|
|
|
|
|
i2c_stop();
|
|
|
|
|
|
|
|
//uint8_t tally;
|
|
|
|
|
|
|
|
//shield_read_uint8(0x5100+menu.settings.cam, &tally);
|
|
|
|
pgm = !!(tally & (1<<0));
|
|
|
|
pgm = !!(tally & (1<<0));
|
|
|
|
pvw = !!(tally & (1<<1));
|
|
|
|
pvw = !!(tally & (1<<1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|