commit
7691f08ff0
10
src/boards.c
10
src/boards.c
@ -42,16 +42,20 @@
|
||||
//------------- IMPLEMENTATION -------------//
|
||||
void button_init(uint32_t pin)
|
||||
{
|
||||
if (BUTTON_PULL == NRF_GPIO_PIN_PULLDOWN) {
|
||||
if ( BUTTON_PULL == NRF_GPIO_PIN_PULLDOWN )
|
||||
{
|
||||
nrf_gpio_cfg_sense_input(pin, BUTTON_PULL, NRF_GPIO_PIN_SENSE_HIGH);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
nrf_gpio_cfg_sense_input(pin, BUTTON_PULL, NRF_GPIO_PIN_SENSE_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
bool button_pressed(uint32_t pin)
|
||||
{
|
||||
return (nrf_gpio_pin_read(pin) == BUTTON_DIR) ? true : false;
|
||||
uint32_t const active_state = (BUTTON_PULL == NRF_GPIO_PIN_PULLDOWN ? 1 : 0);
|
||||
return nrf_gpio_pin_read(pin) == active_state;
|
||||
}
|
||||
|
||||
void board_init(void)
|
||||
|
@ -35,16 +35,10 @@
|
||||
#ifndef BUTTON_DFU
|
||||
#define BUTTON_DFU BUTTON_1
|
||||
#endif
|
||||
|
||||
#ifndef BUTTON_FRESET
|
||||
#define BUTTON_FRESET BUTTON_2
|
||||
#endif
|
||||
#ifndef BUTTON_DIR
|
||||
#if BUTTON_PULL == NRF_GPIO_PIN_PULLDOWN
|
||||
#define BUTTON_DIR 1
|
||||
#elif BUTTON_PULL == NRF_GPIO_PIN_PULLUP
|
||||
#define BUTTON_DIR 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// The primary LED is usually Red but not in all cases.
|
||||
#define LED_PRIMARY 0
|
||||
|
@ -11,8 +11,13 @@ travis = False
|
||||
if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
|
||||
travis = True
|
||||
|
||||
success_count = 0
|
||||
fail_count = 0
|
||||
exit_status = 0
|
||||
|
||||
build_format = '| {:30} | {:9} '
|
||||
build_separator = '-' * 54
|
||||
|
||||
all_boards = []
|
||||
for entry in os.scandir("src/boards"):
|
||||
all_boards.append(entry.name)
|
||||
@ -21,6 +26,10 @@ for entry in os.scandir("src/boards"):
|
||||
|
||||
total_time = time.monotonic()
|
||||
|
||||
print(build_separator)
|
||||
print((build_format + '| {:5} |').format('Board', 'Result', 'Time'))
|
||||
print(build_separator)
|
||||
|
||||
for board in all_boards:
|
||||
bin_directory = "bin/{}/".format(board)
|
||||
os.makedirs(bin_directory, exist_ok=True)
|
||||
@ -28,10 +37,14 @@ for board in all_boards:
|
||||
start_time = time.monotonic()
|
||||
make_result = subprocess.run("make -j 4 BOARD={} combinehex genpkg".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
build_duration = time.monotonic() - start_time
|
||||
success = "\033[32msucceeded\033[0m"
|
||||
if make_result.returncode != 0:
|
||||
|
||||
if make_result.returncode == 0:
|
||||
success = "\033[32msucceeded\033[0m"
|
||||
success_count += 1
|
||||
else:
|
||||
exit_status = make_result.returncode
|
||||
success = "\033[31mfailed\033[0m"
|
||||
success = "\033[31mfailed\033[0m "
|
||||
fail_count += 1
|
||||
|
||||
for entry in os.scandir("_build-{}".format(board)):
|
||||
for extension in ["zip", "hex"]:
|
||||
@ -40,15 +53,18 @@ for board in all_boards:
|
||||
|
||||
if travis:
|
||||
print('travis_fold:start:build-{}\\r'.format(board))
|
||||
print("Build {} took {:.2f}s and {}".format(board, build_duration, success))
|
||||
|
||||
print((build_format + '| {:.2f}s |').format(board, success, build_duration))
|
||||
|
||||
if make_result.returncode != 0:
|
||||
print(make_result.stdout.decode("utf-8"))
|
||||
if travis:
|
||||
print('travis_fold:end:build-{}\\r'.format(board))
|
||||
|
||||
print()
|
||||
|
||||
# Build Summary
|
||||
total_time = time.monotonic() - total_time
|
||||
print("Total build time took {:.2f}s".format(total_time))
|
||||
print(build_separator)
|
||||
print("Build Sumamary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m and took {:.2f}s".format(success_count, fail_count, total_time))
|
||||
print(build_separator)
|
||||
|
||||
sys.exit(exit_status)
|
||||
|
Loading…
Reference in New Issue
Block a user