Created
October 2, 2022 11:53
-
-
Save ungeskriptet/881abd24c26382893909c94e0efbafb7 to your computer and use it in GitHub Desktop.
Generate the name of a regulator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
print('Input the first letter of your regulator type. E.g. "smpf1" has type "s"') | |
REG_TYPE = input('Regulator type: ') | |
print('\nInput your PMIC ID. The PMIC ID is the letter after "ldo". E.g. "ldoc5" has ID "c".') | |
PMIC_ID = input('PMIC ID: ') | |
print('\nNow input your regulator number and microvolt value. The script will run in a loop here.') | |
while True: | |
REG_NUMBER = input('Regulator number: ') | |
VOLT = int(input('Microvolt: ')) / 1000000 | |
if (VOLT < 1 and str(VOLT).endswith("8")) or str(VOLT).endswith("5"): | |
VOLT = round(VOLT, 2) | |
else: | |
VOLT = round(VOLT, 1) | |
REGULATOR = REG_TYPE + REG_NUMBER + PMIC_ID | |
VOLT_NAME = str(VOLT).replace(".", "p") | |
print(f"\n\033[1mvreg_{REGULATOR}_{VOLT_NAME}\033[0m\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment