Add I2C Scan, Change DSP Meter I2C

This commit is contained in:
phdlee 2018-07-17 20:13:06 +09:00
parent 41548163cf
commit b984f62dfd
6 changed files with 45 additions and 8 deletions

View File

@ -252,12 +252,35 @@ void ReadEEPRom() //for remove warnings.
Serial.write(0x02); //STX
checkSum = 0x02;
for (uint16_t i = 0; i < eepromReadLength; i++)
//I2C Scanner
//Magic Key Start 59414, Length : 48583
//if (eepromStartIndex == 59414 && eepromReadLength == 48583)
if (CAT_BUFF[0] == 0x16 && CAT_BUFF[1] == 0xe8)
{
read1Byte = EEPROM.read(eepromStartIndex + i);
checkSum += read1Byte;
Serial.write(read1Byte);
for (uint8_t i = 1; i < 127; i++)
{
Wire.beginTransmission(i);
read1Byte = Wire.endTransmission();
if (read1Byte == 0)
{
Serial.write(i);
}
else
{
Serial.write(0);
}
}
}
else
{
for (uint16_t i = 0; i < eepromReadLength; i++)
{
read1Byte = EEPROM.read(eepromStartIndex + i);
checkSum += read1Byte;
Serial.write(read1Byte);
}
}
Serial.write(checkSum);
Serial.write(ACK);
}

View File

@ -30,7 +30,6 @@
//#define UBITX_DISPLAY_LCD2004P //24 x 04 LCD (Parallel)
//#define UBITX_DISPLAY_LCD2004I //I2C type 24 x 04 LCD
#define UBITX_DISPLAY_NEXTION //NEXTION LCD
//#define UBITX_CONTROL_MCU //CONTROL MCU
//#define UBITX_DISPLAY_NEXTION_SAFE //Only EEProm Write 770~775
#define I2C_LCD_MASTER_ADDRESS_DEFAULT 0x27 //0x27 //DEFAULT, if Set I2C Address by uBITX Manager, read from EEProm
@ -161,6 +160,8 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define FKEY_TYPE_MAX 0x1F
extern uint8_t SI5351BX_ADDR; //change typical -> variable at Version 1.097, address read from eeprom, default value is 0x60
//EEProm Address : 63
extern unsigned long frequency;
extern byte WsprMSGCount;
extern byte sMeterLevels[9];

View File

@ -958,6 +958,15 @@ void initSettings(){
if (EEPROM.read(VERSION_ADDRESS) != FIRMWARE_VERSION_NUM)
EEPROM.write(VERSION_ADDRESS, FIRMWARE_VERSION_NUM);
//SI5351 I2C Address
//I2C_ADDR_SI5351
SI5351BX_ADDR = EEPROM.read(I2C_ADDR_SI5351);
if (SI5351BX_ADDR < 0x10 || SI5351BX_ADDR > 0xF0)
{
SI5351BX_ADDR = 0x60;
}
//Backup Calibration Setting from Factory Setup
//Check Factory Setting Backup Y/N
if (EEPROM.read(FACTORY_BACKUP_YN) != 0x13) {

View File

@ -35,10 +35,13 @@
//==============================================================================
// The spare space available in the original firmware #1
// Address : 32 ~ 63
// Address : 32 ~ 62
//==============================================================================
#define RESERVE_FOR_FACTORY1 32
//SI5351 I2C Address (Version 1.097)
#define I2C_ADDR_SI5351 63
//==============================================================================
// The spare space available in the original firmware #2
// (Enabled if the EEProm address is insufficient)

View File

@ -63,7 +63,7 @@ void LCD_Init(void)
#define USE_I2CSMETER
//S-Meter Address
#define I2CMETER_ADDR 0x6A
#define I2CMETER_ADDR 0x58
//VALUE TYPE============================================
//Signal
#define I2CMETER_CALCS 0x59 //Calculated Signal Meter

View File

@ -47,7 +47,8 @@
#define BB1(x) ((uint8_t)(x>>8))
#define BB2(x) ((uint8_t)(x>>16))
#define SI5351BX_ADDR 0x60 // I2C address of Si5351 (typical)
//#define SI5351BX_ADDR 0x60 // I2C address of Si5351 (typical)
uint8_t SI5351BX_ADDR; // I2C address of Si5351 (variable from Version 1.097)
#define SI5351BX_XTALPF 2 // 1:6pf 2:8pf 3:10pf
// If using 27mhz crystal, set XTAL=27000000, MSA=33. Then vco=891mhz