Add base and display snippets, initial generation works
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
import re
|
||||
from typing import List
|
||||
|
||||
|
||||
def slugify(input : str) -> str:
|
||||
@@ -12,4 +13,19 @@ def slugify(input : str) -> str:
|
||||
s = 'buttonplus'
|
||||
while len(s) > 1 and s[0].isdigit():
|
||||
s = s[1:]
|
||||
return s
|
||||
return s
|
||||
|
||||
def array_to_cpp_vector(string_array : List[str]) -> str:
|
||||
return "{" + ', '.join(f'"{entry}"' for entry in string_array) + "}"
|
||||
|
||||
def get_display_id(num_bars : int) -> str:
|
||||
if(num_bars < 1 or num_bars > 3):
|
||||
raise ValueError("Can't have a display with this number of bars")
|
||||
|
||||
return "base_J" + str(3 - num_bars)
|
||||
|
||||
def get_display_address(num_bars : int) -> str:
|
||||
if(num_bars < 1 or num_bars > 3):
|
||||
raise ValueError("Can't have a display with this number of bars")
|
||||
|
||||
return 0x23 - num_bars
|
||||
|
||||
Reference in New Issue
Block a user