# Path: CHIP_IO/Utilities.py
# def is_chip_pro():
#     isgr8 = False
#     if DEBUG:
#         print("Determining if computer is CHIP or CHIP Pro")
#     
#     # GET FIRST LINE FROM /proc/meminfo
#     f = open("/proc/meminfo","r")
#     fline = f.readline()
#     f.close()
#     
#     # FIGURE OUT OUR TOTAL MEMORY SIZE
#     parts = fline.split()
#     mem = float(parts[1]) / 1024
#     
#     if mem > 380:
#         isgr8 = False
#         if DEBUG:
#             print("found CHIP!")
#     else:
#         isgr8 = True
#         if DEBUG:
#             print("found CHIP Pro!")
#         
#     # Return isgr8
#     return isgr8


import os
import shutil
import time
import sys
from .Utilities import is_chip_pro
        else:
            opath = path
        if DEBUG:
            print("OVERLAY PATH: {0}".format(opath))

        if overlay.upper() == "PWM0" and _LOADED[overlay.upper()]:
            print("PWM0 Overlay already loaded")
            return 2

        if overlay.upper() == "SPI2" and _LOADED[overlay.upper()]:
            print("SPI2 Overlay already loaded")
            return 2

        # LOAD THE OVERLAY
        errc = _set_overlay_verify(overlay.upper(), opath, cpath)
        if DEBUG:
            print("_SET_OVERLAY_VERIFY ERRC: {0}".format(errc))
        if errc == 0:
            _LOADED[overlay.upper()] = True

    else:
        raise ValueError("Invalid Overlay name specified! Choose between: SPI2, PWM0, CUST")

def unload(overlay):
    global DEBUG
    global _LOADED
    if DEBUG:
        print("UNLOAD OVERLAY: {0}".format(overlay))
    
    # DETERMINE IF WE ARE A CHIP PRO AND WE ARE COMMANDED TO UNLOAD PWM0

# Path: CHIP_IO/Utilities.py
# def is_chip_pro():
#     isgr8 = False
#     if DEBUG:
#         print("Determining if computer is CHIP or CHIP Pro")
#     
#     # GET FIRST LINE FROM /proc/meminfo
#     f = open("/proc/meminfo","r")
#     fline = f.readline()
#     f.close()
#     
#     # FIGURE OUT OUR TOTAL MEMORY SIZE
#     parts = fline.split()
#     mem = float(parts[1]) / 1024
#     
#     if mem > 380:
#         isgr8 = False
#         if DEBUG:
#             print("found CHIP!")
#     else:
#         isgr8 = True
#         if DEBUG:
#             print("found CHIP Pro!")
#         
#     # Return isgr8
#     return isgr8


# Path: CHIP_IO/OverlayManager.py
import os
import shutil
import time
import sys
from .Utilities import is_chip_pro

        else:
            opath = path
        if DEBUG:
            print("OVERLAY PATH: {0}".format(opath))

        if overlay.upper() == "PWM0" and _LOADED[overlay.upper()]:
            print("PWM0 Overlay already loaded")
            return 2

        if overlay.upper() == "SPI2" and _LOADED[overlay.upper()]:
            print("SPI2 Overlay already loaded")
            return 2

        # LOAD THE OVERLAY
        errc = _set_overlay_verify(overlay.upper(), opath, cpath)
        if DEBUG:
            print("_SET_OVERLAY_VERIFY ERRC: {0}".format(errc))
        if errc == 0:
            _LOADED[overlay.upper()] = True

    else:
        raise ValueError("Invalid Overlay name specified! Choose between: SPI2, PWM0, CUST")

def unload(overlay):
    global DEBUG
    global _LOADED
    if DEBUG:
        print("UNLOAD OVERLAY: {0}".format(overlay))
    
    # DETERMINE IF WE ARE A CHIP PRO AND WE ARE COMMANDED TO UNLOAD PWM0

    if is_chip_pro() and overlay.upper() == "PWM0":