-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Luos-io/feat/V3.0.0
Feat/v3.0.0
- Loading branch information
Showing
35 changed files
with
325 additions
and
190 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#!/usr/bin/env python | ||
from os.path import join, realpath, exists | ||
import os | ||
import subprocess | ||
import click | ||
import multiprocessing as mp | ||
import sys | ||
import time | ||
import argparse | ||
|
||
|
||
exampledir = '.' | ||
|
||
# Compute the number of examples | ||
nb_example = 0 | ||
compiled_example = None | ||
examples_success = None | ||
examples_failed = None | ||
|
||
if os.path.isdir(exampledir): | ||
for example in os.listdir(exampledir): | ||
example_path = join(realpath(exampledir), example) | ||
if (exists(join(example_path, "platformio.ini"))): | ||
# This is a valid example, count it | ||
nb_example += 1 | ||
|
||
|
||
def init(compiled, success, failed): | ||
''' store the counter for later use ''' | ||
global compiled_example | ||
global examples_success | ||
global examples_failed | ||
compiled_example = compiled | ||
examples_success = success | ||
examples_failed = failed | ||
|
||
|
||
# Example compilation task | ||
OKGREEN = '\r\033[92m' | ||
FAIL = '\r\033[91m' | ||
ENDC = '\033[0m' | ||
|
||
|
||
def compile_example(cmd, example, clean): | ||
global compiled_example | ||
if clean: | ||
subprocess.call(cmd + " --target clean", shell=True, | ||
stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb')) | ||
if subprocess.call(cmd, shell=True, stdout=open(os.devnull, 'wb'), stderr=open("err.log", 'wb')): | ||
with compiled_example.get_lock(): | ||
compiled_example.value += 1 | ||
value = FAIL+"FAILED " + str(example + ENDC) | ||
print(value, flush=True) | ||
with examples_failed.get_lock(): | ||
examples_failed.value += 1 | ||
else: | ||
with compiled_example.get_lock(): | ||
compiled_example.value += 1 | ||
value = OKGREEN + "SUCCESS " + \ | ||
str(example) + ENDC | ||
print(value, flush=True) | ||
with examples_success.get_lock(): | ||
examples_success.value += 1 | ||
return True | ||
|
||
|
||
if __name__ == '__main__': | ||
|
||
## Parse arguments ## | ||
parser = argparse.ArgumentParser(description='A command to build them all as fast as possible!\n', | ||
formatter_class=argparse.RawTextHelpFormatter) | ||
|
||
# General arguments | ||
parser.add_argument("--clean", action="store_true", | ||
help="Clean all examples before building them") | ||
args = parser.parse_args() | ||
|
||
start = time.time() | ||
# Create all example compilation tasks | ||
compiled_example = mp.Value('i', 0) | ||
examples_success = mp.Value('i', 0) | ||
examples_failed = mp.Value('i', 0) | ||
pool = mp.Pool(nb_example, initializer=init, initargs=(compiled_example, | ||
examples_success, | ||
examples_failed,)) | ||
click.secho( | ||
"\nBuild result Project name\n------------ ------------") | ||
for example in os.listdir(exampledir): | ||
example_path = join(exampledir, example) | ||
cmd = "platformio run -d " + example_path | ||
if (exists(join(example_path, "platformio.ini"))): | ||
pool.apply_async( | ||
compile_example, args=(cmd, example, args.clean)) | ||
|
||
pool.close() | ||
while compiled_example.value < nb_example: | ||
# Print a nice loading bar | ||
chars = "/—\|" | ||
for char in chars: | ||
sys.stdout.write( | ||
'\r'+'Building ' + char + ' (' + str(compiled_example.value) + "/" + str(nb_example) + ")") | ||
time.sleep(.1) | ||
sys.stdout.flush() | ||
|
||
pool.join() | ||
print("\r--------------------------------------------\nBuild summary\n--------------------------------------------") | ||
print("\t- Success\t\t\t" + str(examples_success.value) + "/" + str(nb_example)) | ||
print("\t- Failed\t\t\t" + str(examples_failed.value) + "/" + str(nb_example)) | ||
print("\t- Total compilation time\t" + str(time.time() - start) + "s") |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
#ifndef BOOTLOADER_H | ||
#define BOOTLOADER_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
#include "luos_engine.h" | ||
|
||
/******************************************************************************* | ||
* Definitions | ||
******************************************************************************/ | ||
/******************************************************************************* | ||
* Definitions | ||
******************************************************************************/ | ||
|
||
/******************************************************************************* | ||
* Variables | ||
******************************************************************************/ | ||
/******************************************************************************* | ||
* Variables | ||
******************************************************************************/ | ||
|
||
/******************************************************************************* | ||
* Function | ||
******************************************************************************/ | ||
void Blinker_Init(void); | ||
void Blinker_Loop(void); | ||
/******************************************************************************* | ||
* Function | ||
******************************************************************************/ | ||
void Blinker_Init(void); | ||
void Blinker_Loop(void); | ||
|
||
#endif /* LED_H */ | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif /* LED_H */ |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
set(srcs "led.c") | ||
set(srcs "led") | ||
|
||
set(inc ".") | ||
set(inc ".") | ||
|
||
idf_component_register( SRCS ${srcs} | ||
INCLUDE_DIRS ${inc} | ||
REQUIRES luos_engine led_strip) | ||
idf_component_register(SRCS ${srcs} | ||
INCLUDE_DIRS ${inc} | ||
REQUIRES luos_engine) |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"name": "led", | ||
"keywords": "robus,network,microservice,luos,operating system,os,embedded,communication,container,ST", | ||
"description": "a simple button driver", | ||
"keywords": "robus,network,microservice,luos,operating system,os,embedded,communication,service,ST", | ||
"description": "a simple led driver", | ||
"version": "1.0.0", | ||
"authors": { | ||
"name": "Luos", | ||
"url": "https://luos.io" | ||
}, | ||
"licence": "MIT", | ||
"dependencies": { | ||
"luos/luos_engine": "^2.9.0" | ||
"luos_engine": "^3.0.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.