Skip to content

Commit

Permalink
board_hw_rev_ver: Support EEPROM-only HW IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
davids5 authored and dagar committed Aug 19, 2024
1 parent 07734c2 commit c60b1d1
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static char hw_base_info[HW_INFO_SIZE] = {0};
/****************************************************************************
* Protected Functions
****************************************************************************/

#if !defined(BOARD_HAS_ONLY_EEPROM_VERSIONING)
static int dn_to_ordinal(uint16_t dn)
{
/* Table is scaled for 12, so if ADC is in 16 bit mode
Expand Down Expand Up @@ -111,6 +111,7 @@ static int dn_to_ordinal(uint16_t dn)

return -1;
}
#endif /* BOARD_HAS_ONLY_EEPROM_VERSIONING */

/************************************************************************************
* Name: read_id_dn
Expand Down Expand Up @@ -143,7 +144,7 @@ static int dn_to_ordinal(uint16_t dn)
* -EIO - FAiled to init or read the ADC
*
************************************************************************************/

#if !defined(BOARD_HAS_ONLY_EEPROM_VERSIONING)
static int read_id_dn(int *id, uint32_t gpio_drive, uint32_t gpio_sense, int adc_channel)
{
int rv = -EIO;
Expand Down Expand Up @@ -328,9 +329,15 @@ static int read_id_dn(int *id, uint32_t gpio_drive, uint32_t gpio_sense, int adc
stm32_configgpio(gpio_drive);
return rv;
}
#endif /* BOARD_HAS_ONLY_EEPROM_VERSIONING */

static int determine_hw_info(int *revision, int *version)
{
#if defined(BOARD_HAS_ONLY_EEPROM_VERSIONING)
*revision = HW_ID_EEPROM;
*version = HW_ID_EEPROM;
return OK;
#else
int dn;
int rv = read_id_dn(&dn, GPIO_HW_REV_DRIVE, GPIO_HW_REV_SENSE, ADC_HW_REV_SENSE_CHANNEL);

Expand All @@ -344,6 +351,7 @@ static int determine_hw_info(int *revision, int *version)
}

return rv;
#endif
}

/****************************************************************************
Expand Down

0 comments on commit c60b1d1

Please sign in to comment.