Skip to content

Commit

Permalink
精简
Browse files Browse the repository at this point in the history
  • Loading branch information
losehu committed Jun 28, 2024
1 parent 34558a4 commit 5ca8dfb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 39 deletions.
25 changes: 4 additions & 21 deletions driver/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,11 @@

void EEPROM_ReadBuffer(uint32_t Address, void *pBuffer, uint8_t Size) {

__disable_irq();
// __disable_irq();
I2C_Start();

uint8_t IIC_ADD = 0xA0 | ((Address / 0x10000) << 1);
#if ENABLE_EEPROM_TYPE == 1
if (Address >= 0x40000)
{IIC_ADD = 0xA8 | (((Address - 0x40000) / 0x10000) << 1);
Address-=0x40000;

}
#elif ENABLE_EEPROM_4M == 2
if (Address >= 0x20000)
{IIC_ADD = 0xA4 | (((Address - 0x20000) / 0x10000) << 1);
Address-=0x20000;
}
#endif

I2C_Write(IIC_ADD);
I2C_Write((Address >> 8) & 0xFF);
I2C_Write((Address >> 0) & 0xFF);
Expand All @@ -125,7 +114,7 @@ Address-=0x20000;
I2C_ReadBuffer(pBuffer, Size);

I2C_Stop();
__enable_irq();
// __enable_irq();

}

Expand All @@ -138,13 +127,7 @@ void EEPROM_WriteBuffer(uint32_t Address, const void *pBuffer, uint8_t WRITE_SIZ
if (memcmp(pBuffer, buffer, WRITE_SIZE) != 0) {
uint8_t IIC_ADD = 0xA0 | ((Address / 0x10000) << 1);
I2C_Start();
#if ENABLE_EEPROM_TYPE == 1
if(Address>=0x40000)
IIC_ADD = 0xA8 | (((Address - 0x40000) / 0x10000) << 1);
#elif ENABLE_EEPROM_TYPE == 2
if(Address>=0x20000)
IIC_ADD = 0xA4 | (((Address - 0x20000) / 0x10000) << 1);
#endif

I2C_Write(IIC_ADD);

I2C_Write((Address >> 8) & 0xFF);
Expand Down
16 changes: 2 additions & 14 deletions frequencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ int32_t TX_freq_check(const uint32_t Frequency)
break;

case F_LOCK_FCC:
if (Frequency >= 14400000 && Frequency < 14800000)
if (Frequency >= 14400000 && Frequency <= 14800000)
return 0;
if (Frequency >= 42000000 && Frequency < 45000000)
if (Frequency >= 42000000 && Frequency <= 45000000)
return 0;
break;

Expand All @@ -202,19 +202,7 @@ int32_t TX_freq_check(const uint32_t Frequency)
return 0;
break;

case F_LOCK_430:
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000)
return 0;
if (Frequency >= 40000000 && Frequency < 43000000)
return 0;
break;

case F_LOCK_438:
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000)
return 0;
if (Frequency >= 40000000 && Frequency < 43800000)
return 0;
break;

case F_LOCK_ALL:
break;
Expand Down
3 changes: 1 addition & 2 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ enum TxLockModes_t {
F_LOCK_FCC,
F_LOCK_CE,
F_LOCK_GB,
F_LOCK_430,
F_LOCK_438,

F_LOCK_ALL, // disable TX on all frequencies
F_LOCK_NONE, // enable TX on all frequencies
F_LOCK_LEN
Expand Down
3 changes: 1 addition & 2 deletions ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ const char *const gSubMenu_F_LOCK[] =
"FCC HAM\n144-148\n420-450",
"CE HAM\n144-146\n430-440",
"GB HAM\n144-148\n430-440",
"137-174\n400-430",
"137-174\n400-438",

// "DISABLE\nALL",
// "UNLOCK\nALL",
禁用全部,
Expand Down

0 comments on commit 5ca8dfb

Please sign in to comment.