-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.py
58 lines (50 loc) · 1.94 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
###################################################################################
# @file config.py
###################################################################################
# _ _____ ____ ____ _____
# | |/ /_ _/ ___|| _ \| ____|
# | ' / | |\___ \| |_) | _|
# | . \ | |___ ) | __/| |___
# |_|\_\___|____/|_| |_____|
###################################################################################
# Copyright (c) 2020 KISPE Space Systems Ltd.
#
# Please follow the following link for the license agreement for this code:
# www.kispe.co.uk/projectlicenses/RA2001001003
###################################################################################
# Created on: 06-May-2021
# Mercury GS Global Variables
# @author: Jamie Bayley ([email protected])
###################################################################################
import platform
# Try to import RaspberryPi GPIO library, this is to use the RF69 radio module on a Raspberry Pi.
try:
import RPi.GPIO as GPIO
RaspberryPi = True
except(ImportError, RuntimeError):
RaspberryPi = False
# Initialise Global Variables
OS = platform.system()
BAUD_RATE = 9600
COM_PORT = "COM1"
COMMS = "SERIAL"
TC_TLM_RATE = 1
TIMEOUT = float(1000) / 1000
def config_register_callback(exception_handler_function_ptr):
""" Registers the callbacks for this module to pass data back to previous modules. """
global callback_exception_handler
# Register exception handler callback
callback_exception_handler = exception_handler_function_ptr
def change_timeout(timeout):
""" Change the global TIMEOUT value as a float. """
global TIMEOUT
try:
TIMEOUT = float(timeout) / 1000
except ValueError as err:
print("ERROR: ", err)
print("INFO: Invalid Timeout Value")
callback_exception_handler("ERROR: Invalid Timeout Value")
# Function Pointers
global ptr_unpacketise
global ptr_telemetry_update
global ptr_telecommand_response_update