-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added v1.0.1
- Loading branch information
Showing
10 changed files
with
97 additions
and
53 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
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,21 @@ | ||
# crc.py - Functions for CRC | ||
# | ||
# Copyright (C) Simon Schäfer <[email protected]> | ||
# | ||
# Released under GNU GPL v3 or later | ||
|
||
|
||
import crc | ||
|
||
|
||
# Create a crc calculator | ||
def crc_create_calculator(self, width, polynomial, init_value, final_xor_value, reverse_input, reverse_output): | ||
configuration = crc.Configuration( | ||
width=width, | ||
polynomial=polynomial, | ||
init_value=init_value, | ||
final_xor_value=final_xor_value, | ||
reverse_input=reverse_input, | ||
reverse_output=reverse_output, | ||
) | ||
self.crc_calculator = crc.Calculator(configuration) |
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,4 +1,4 @@ | ||
# logging.py - Functions for logger configuration | ||
# logging.py - Functions for logger creation | ||
# | ||
# Copyright (C) Simon Schäfer <[email protected]> | ||
# | ||
|
@@ -10,7 +10,10 @@ | |
|
||
|
||
# Configure logger | ||
def configure_logger(self, logger, loglevelp, loglevelw, savel): | ||
def create_logger(self, loglevelp, loglevelw, savel): | ||
# Define a logger | ||
self.loggerObj = logging.getLogger('logger') | ||
|
||
# Add a custom logging level for detailed debugging | ||
add_logging_level('DEBUG_DETAIL', self.shuConfig.loglevel[5]) | ||
|
||
|
@@ -19,16 +22,16 @@ def configure_logger(self, logger, loglevelp, loglevelw, savel): | |
c_handler = logging.StreamHandler() | ||
c_handler.setFormatter(c_format) | ||
c_handler.setLevel(self.shuConfig.loglevel[loglevelp]) | ||
logger.addHandler(c_handler) | ||
self.loggerObj.addHandler(c_handler) | ||
# A optional 'FileHandler' might be added to the logger | ||
if savel: | ||
f_format = logging.Formatter('[%(asctime)s - %(levelname)s] %(message)s') | ||
f_handler = logging.FileHandler(self.filepath + '/' + 'log.log') | ||
f_handler.setFormatter(f_format) | ||
f_handler.setLevel(self.shuConfig.loglevel[loglevelw]) | ||
logger.addHandler(f_handler) | ||
self.loggerObj.addHandler(f_handler) | ||
# A level must also be set for the logger itself, not only for the handlers | ||
logger.setLevel(self.shuConfig.loglevel[5]) | ||
self.loggerObj.setLevel(self.shuConfig.loglevel[5]) | ||
|
||
|
||
# Add a custom logging level | ||
|
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
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