test

Files at this revision

API Documentation at this revision

Comitter:
williamweatherholtz
Date:
Mon Apr 16 13:15:07 2018 +0000
Child:
1:b686a4955357
Commit message:
test

Changed in this revision

as1115.cpp Show annotated file Show diff for this revision Revisions of this file
as1115.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/as1115.cpp	Mon Apr 16 13:15:07 2018 +0000
@@ -0,0 +1,541 @@
+/******************************************************************//**
+* @file max7219.cpp
+* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
+* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*
+* Except as contained in this notice, the name of Maxim Integrated
+* Products, Inc. shall not be used except as stated in the Maxim Integrated
+* Products, Inc. Branding Policy.
+*
+* The mere transfer of this software does not imply any licenses
+* of trade secrets, proprietary technology, copyrights, patents,
+* trademarks, maskwork rights, or any other form of intellectual
+* property whatsoever. Maxim Integrated Products, Inc. retains all
+* ownership rights.
+**********************************************************************/
+
+
+#include "max7219.h"
+
+
+//*********************************************************************
+Max7219::Max7219(SPI *spi_bus, PinName cs): _p_spi(spi_bus)
+{
+    _num_devices = 1;
+    
+    _p_cs = new DigitalOut(cs, 1);
+    _spi_owner = false;
+}
+
+
+//*********************************************************************
+Max7219::Max7219(PinName mosi, PinName miso, PinName sclk, PinName cs)
+{
+    _num_devices = 1;
+    
+    _p_spi = new SPI(mosi, miso, sclk);
+    _p_cs = new DigitalOut(cs, 1);
+    
+    _spi_owner = true;
+}
+
+
+//*********************************************************************
+Max7219::~Max7219()
+{
+    delete _p_cs;
+    
+    if(_spi_owner) 
+    {
+        delete _p_spi;
+    }
+}
+
+
+//*********************************************************************
+int32_t Max7219::set_num_devices(uint8_t num_devices)
+{
+    int32_t rtn_val = -1;
+    
+    if(num_devices > 0)
+    {
+        _num_devices = num_devices;
+        rtn_val = _num_devices;
+    }
+    
+    return(rtn_val);
+}
+
+
+//*********************************************************************
+void Max7219::set_display_test(void)
+{
+    uint8_t idx = 0;
+    
+    _p_cs->write(0); 
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        _p_spi->write(MAX7219_DISPLAY_TEST);
+        _p_spi->write(1);
+    }
+    _p_cs->write(1); 
+}
+
+
+//*********************************************************************
+void Max7219::clear_display_test(void)
+{
+    uint8_t idx = 0;
+    
+    _p_cs->write(0); 
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        _p_spi->write(MAX7219_DISPLAY_TEST);
+        _p_spi->write(0);
+    }
+    _p_cs->write(1); 
+}
+
+
+//*********************************************************************
+int32_t Max7219::init_device(max7219_configuration_t config)
+{
+    int32_t rtn_val = -1;
+    uint8_t idx = 0;
+    
+    if(config.device_number > _num_devices)
+    {
+        rtn_val = -1;
+    }
+    else if(config.device_number == 0)
+    {
+        //device numbering starts with index 1
+        rtn_val = -2;
+    }
+    else
+    {
+        //write DECODE_MODE register of device
+        _p_cs->write(0); 
+        for(idx = _num_devices; idx > 0; idx--)
+        {
+            if(config.device_number == idx)
+            {
+                _p_spi->write(MAX7219_DECODE_MODE);
+                _p_spi->write(config.decode_mode);
+            }
+            else
+            {
+                _p_spi->write(MAX7219_NO_OP);
+                _p_spi->write(0);
+            }
+        }
+        _p_cs->write(1); 
+        
+        wait_us(1);
+        
+        //write INTENSITY register of device
+        _p_cs->write(0); 
+        for(idx = _num_devices; idx > 0; idx--)
+        {
+            if(config.device_number == idx)
+            {
+                _p_spi->write(MAX7219_INTENSITY);
+                _p_spi->write(config.intensity);
+            }
+            else
+            {
+                _p_spi->write(MAX7219_NO_OP);
+                _p_spi->write(0);
+            }
+        }
+        _p_cs->write(1); 
+        
+        wait_us(1);
+        
+        //write SCAN_LIMT register of device
+        _p_cs->write(0); 
+        for(idx = _num_devices; idx > 0; idx--)
+        {
+            if(config.device_number == idx)
+            {
+                _p_spi->write(MAX7219_SCAN_LIMIT);
+                _p_spi->write(config.scan_limit);
+            }
+            else
+            {
+                _p_spi->write(MAX7219_NO_OP);
+                _p_spi->write(0);
+            }
+        }
+        _p_cs->write(1); 
+        
+        wait_us(1);
+        
+        rtn_val = 0;
+    }
+    
+    return(rtn_val);
+}
+
+
+//*********************************************************************
+void Max7219::init_display(max7219_configuration_t config)
+{
+    uint8_t idx = 0;
+    
+    //write DECODE_MODE register of all devices
+    _p_cs->write(0); 
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        _p_spi->write(MAX7219_DECODE_MODE);
+        _p_spi->write(config.decode_mode);
+    }
+    _p_cs->write(1); 
+    
+    wait_us(1);
+    
+    //write INTENSITY register of all devices
+    _p_cs->write(0); 
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        _p_spi->write(MAX7219_INTENSITY);
+        _p_spi->write(config.intensity);
+    }
+    _p_cs->write(1); 
+    
+    wait_us(1);
+    
+    //write SCAN_LIMT register of all devices
+    _p_cs->write(0); 
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        _p_spi->write(MAX7219_SCAN_LIMIT);
+        _p_spi->write(config.scan_limit);
+    }
+    _p_cs->write(1); 
+    
+    wait_us(1);
+}
+
+
+//*********************************************************************
+int32_t Max7219::enable_device(uint8_t device_number)
+{
+    int32_t rtn_val = -1;
+    uint8_t idx = 0;
+    
+    if(device_number > _num_devices)
+    {
+        rtn_val = -1;
+    }
+    else if(device_number == 0)
+    {
+        //device numbering starts with index 1
+        rtn_val = -2;
+    }
+    else
+    {
+        _p_cs->write(0); 
+        for(idx = _num_devices; idx > 0; idx--)
+        {
+            if(device_number == idx)
+            {
+                _p_spi->write(MAX7219_SHUTDOWN);
+                _p_spi->write(1);
+            }
+            else
+            {
+                _p_spi->write(MAX7219_NO_OP);
+                _p_spi->write(0);
+            }
+        }
+        _p_cs->write(1); 
+        
+        rtn_val = 0;
+    }
+    
+    return(rtn_val);
+}
+
+
+//*********************************************************************
+void Max7219::enable_display(void)
+{
+    uint8_t idx = 0;
+    
+    _p_cs->write(0); 
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        _p_spi->write(MAX7219_SHUTDOWN);
+        _p_spi->write(1);
+    }
+    _p_cs->write(1); 
+}
+    
+
+//*********************************************************************    
+int32_t Max7219::disable_device(uint8_t device_number)
+{
+    int32_t rtn_val = -1;
+    uint8_t idx = 0;
+    
+    if(device_number > _num_devices)
+    {
+        rtn_val = -1;
+    }
+    else if(device_number == 0)
+    {
+        //device numbering starts with index 1
+        rtn_val = -2;
+    }
+    else
+    {
+        _p_cs->write(0); 
+        for(idx = _num_devices; idx > 0; idx--)
+        {
+            if(device_number == idx)
+            {
+                _p_spi->write(MAX7219_SHUTDOWN);
+                _p_spi->write(0);
+            }
+            else
+            {
+                _p_spi->write(MAX7219_NO_OP);
+                _p_spi->write(0);
+            }
+        }
+        _p_cs->write(1); 
+        
+        rtn_val = 0;
+    }
+    
+    return(rtn_val);
+}
+
+
+//*********************************************************************    
+void Max7219::disable_display(void)
+{
+    uint8_t idx = 0;
+    
+    _p_cs->write(0); 
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        _p_spi->write(MAX7219_SHUTDOWN);
+        _p_spi->write(0);
+    }
+    _p_cs->write(1); 
+}
+
+
+
+//********************************************************************* 
+int32_t Max7219::write_digit(uint8_t device_number, uint8_t digit, uint8_t data)
+{
+    int32_t rtn_val = -1;
+    uint8_t idx = 0;
+    
+    if(digit > MAX7219_DIGIT_7)
+    {
+        rtn_val = -3;
+    }
+    else if(digit < MAX7219_DIGIT_0)
+    {
+        rtn_val = -4;
+    }
+    else
+    {
+        if(device_number > _num_devices)
+        {
+            rtn_val = -1;
+        }
+        else if(device_number == 0)
+        {
+            rtn_val = -2;
+        }
+        else
+        {
+            _p_cs->write(0); 
+            for(idx = _num_devices; idx > 0; idx--)
+            {
+                if(idx == device_number)
+                {
+                    _p_spi->write(digit);
+                    _p_spi->write(data);
+                }
+                else
+                {
+                    _p_spi->write(MAX7219_NO_OP);
+                    _p_spi->write(0);
+                }
+            }
+            _p_cs->write(1); 
+            
+            rtn_val = 0;
+        }
+    }
+    
+    return(rtn_val);
+}
+    
+
+//*********************************************************************     
+int32_t Max7219::clear_digit(uint8_t device_number, uint8_t digit)
+{
+    int32_t rtn_val = -1;
+    uint8_t idx = 0;
+    
+    if(digit > MAX7219_DIGIT_7)
+    {
+        rtn_val = -3;
+    }
+    else if(digit < MAX7219_DIGIT_0)
+    {
+        rtn_val = -4;
+    }
+    else
+    {
+        if(device_number > _num_devices)
+        {
+            rtn_val = -1;
+        }
+        else if(device_number == 0)
+        {
+            rtn_val = -2;
+        }
+        else
+        {
+            _p_cs->write(0); 
+            for(idx = _num_devices; idx > 0; idx--)
+            {
+                if(idx == device_number)
+                {
+                    _p_spi->write(digit);
+                    _p_spi->write(0);
+                }
+                else
+                {
+                    _p_spi->write(MAX7219_NO_OP);
+                    _p_spi->write(0);
+                }
+            }
+            _p_cs->write(1); 
+            
+            rtn_val = 0;
+        }
+    }
+    
+    return(rtn_val);
+}
+
+
+//********************************************************************* 
+int32_t Max7219::device_all_on(uint8_t device_number)
+{
+    int32_t rtn_val = -1;
+    uint8_t idx = 0;
+    
+    if(device_number > _num_devices)
+    {
+        rtn_val = -1;
+    }
+    else if(device_number == 0)
+    {
+        rtn_val = -2;
+    }
+    else
+    {
+        rtn_val = 0;
+        
+        //writes every digit of given device to 0xFF
+        for(idx = 0; idx < 8; idx++)
+        {
+            if(rtn_val == 0)
+            {
+                rtn_val = write_digit(device_number, (idx + 1), 0xFF);
+            }
+        }
+    }
+    
+    return(rtn_val);
+}
+
+
+//********************************************************************* 
+int32_t Max7219::device_all_off(uint8_t device_number)
+{
+    int32_t rtn_val = -1;
+    uint8_t idx = 0;
+    
+    if(device_number > _num_devices)
+    {
+        rtn_val = -1;
+    }
+    else if(device_number == 0)
+    {
+        rtn_val = -2;
+    }
+    else
+    {
+        rtn_val = 0;
+        
+        //writes every digit of given device to 0
+        for(idx = 0; idx < 8; idx++)
+        {
+            if(rtn_val == 0)
+            {
+                rtn_val = write_digit(device_number, (idx + 1), 0);
+            }
+        }
+    }
+    
+    return(rtn_val);
+}
+
+
+void Max7219::display_all_on(void)
+{
+    uint8_t idx, idy;
+    
+    //writes every digit of every device to 0xFF
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        for(idy = 0; idy < MAX7219_DIGIT_7; idy++)
+        {
+            write_digit((idx + 1), (idy + 1), 0xFF);
+        }
+    }
+}
+    
+    
+void Max7219::display_all_off(void)
+{
+    uint8_t idx, idy;
+    
+    //writes every digit of every device to 0
+    for(idx = 0; idx < _num_devices; idx++)
+    {
+        for(idy = 0; idy < MAX7219_DIGIT_7; idy++)
+        {
+            write_digit((idx + 1), (idy + 1), 0);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/as1115.h	Mon Apr 16 13:15:07 2018 +0000
@@ -0,0 +1,477 @@
+/******************************************************************//**
+* @file max7219.h
+* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
+* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*
+* Except as contained in this notice, the name of Maxim Integrated
+* Products, Inc. shall not be used except as stated in the Maxim Integrated
+* Products, Inc. Branding Policy.
+*
+* The mere transfer of this software does not imply any licenses
+* of trade secrets, proprietary technology, copyrights, patents,
+* trademarks, maskwork rights, or any other form of intellectual
+* property whatsoever. Maxim Integrated Products, Inc. retains all
+* ownership rights.
+**********************************************************************/
+
+
+#ifndef AS1115_H
+#define AS1115_H
+
+#include "mbed.h"
+
+
+/**
+* @brief Structure for device configuration
+* @code
+* #include "max7219.h"
+*
+* max7219_configuration_t cfg = {
+*     .device_number = 1,
+*     .decode_mode = 0,
+*     .intensity = Max7219::MAX7219_INTENSITY_8,
+*     .scan_limit = Max7219::MAX7219_SCAN_8
+* };
+* @endcode
+*/
+typedef struct
+{
+    uint8_t device_number;
+    uint8_t decode_mode;
+    uint8_t intensity;
+    uint8_t scan_limit;
+}max7219_configuration_t;
+
+
+/**
+* @brief   Serially Interfaced, 8-Digit, LED Display Driver
+*
+* @details The MAX7219/MAX7221 are compact, serial input/output common-cathode
+* display drivers that interface microprocessors (µPs) to 7-segment numeric
+* LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs.
+* Included on-chip are a BCD code-B decoder, multiplex scan circuitry, segment
+* and digit drivers, and an 8x8 static RAM that stores each digit. Only one
+* external resistor is required to set the segment current for all LEDs.
+* The MAX7221 is compatible with SPI™, QSPI™, and MICROWIRE™, and has
+* slew-rate-limited segment drivers to reduce EMI.
+*
+* @code
+* #include "mbed.h"
+* #include "max7219.h"
+*
+* Max7219 max7219(SPI0_MOSI, SPI0_MISO, SPI0_SCK, SPI0_SS);
+*
+* int main()
+* {
+*     max7219_configuration_t cfg = {
+*         .device_number = 1,
+*         .decode_mode = 0,
+*         .intensity = Max7219::MAX7219_INTENSITY_8,
+*         .scan_limit = Max7219::MAX7219_SCAN_8
+*     };
+*
+*     max7219.init_device(cfg);
+*     max7219.enable_device(1);
+*     max7219.set_display_test();
+*     wait(1);
+*     max7219.clear_display_test();
+*
+*     while (1) {
+*         max7219.write_digit(1, Max7219::MAX7219_DIGIT_0, ...
+*     }
+* }
+* @endcode
+*/
+class Max7219
+{
+    public:
+    
+    /**
+     * @brief   Digit and Control Registers
+     * @details The 14 addressable digit and control registers.
+     */
+    typedef enum
+    {
+        MAX7219_NO_OP = 0,
+        MAX7219_DIGIT_0,
+        MAX7219_DIGIT_1,
+        MAX7219_DIGIT_2,
+        MAX7219_DIGIT_3,
+        MAX7219_DIGIT_4,
+        MAX7219_DIGIT_5,
+        MAX7219_DIGIT_6,
+        MAX7219_DIGIT_7,
+        MAX7219_DECODE_MODE,
+        MAX7219_INTENSITY,
+        MAX7219_SCAN_LIMIT,
+        MAX7219_SHUTDOWN,
+        MAX7219_DISPLAY_TEST = 15
+    }max7219_register_e;
+    
+    
+    /**
+     * @brief   Intensity values
+     * @details Digital control of display brightness is provided by an
+     * internal pulse-width modulator, which is controlled by
+     * the lower nibble of the intensity register.
+     */
+    typedef enum
+    {
+        MAX7219_INTENSITY_0 = 0,
+        MAX7219_INTENSITY_1,
+        MAX7219_INTENSITY_2,
+        MAX7219_INTENSITY_3,
+        MAX7219_INTENSITY_4,
+        MAX7219_INTENSITY_5,
+        MAX7219_INTENSITY_6,
+        MAX7219_INTENSITY_7,
+        MAX7219_INTENSITY_8,
+        MAX7219_INTENSITY_9,
+        MAX7219_INTENSITY_A,
+        MAX7219_INTENSITY_B,
+        MAX7219_INTENSITY_C,
+        MAX7219_INTENSITY_D,
+        MAX7219_INTENSITY_E,
+        MAX7219_INTENSITY_F
+    }max7219_intensity_e;
+    
+    
+    /**
+     * @brief   Scan limit for mutiplexing digits
+     * @details The scan-limit register sets how many digits are 
+     * displayed, from 1 to 8. They are displayed in a multiplexed
+     * manner with a typical display scan rate of 800Hz with 8
+     * digits displayed.
+     */
+    typedef enum
+    {
+        MAX7219_SCAN_1 = 0,
+        MAX7219_SCAN_2,
+        MAX7219_SCAN_3,
+        MAX7219_SCAN_4,
+        MAX7219_SCAN_5,
+        MAX7219_SCAN_6,
+        MAX7219_SCAN_7,
+        MAX7219_SCAN_8
+    }max7219_scan_limit_e;
+        
+    
+    /**********************************************************//**
+    * @brief Constructor for Max7219 Class.  
+    * 
+    * @details Allows user to pass pointer to existing SPI bus
+    *
+    * On Entry:
+    *     @param[in] spi_bus - pointer to existing SPI object
+    *     @param[in] cs - pin to use for cs
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    Max7219(SPI *spi_bus, PinName cs);
+    
+    
+    /**********************************************************//**
+    * @brief Constructor for Max7219 Class.  
+    * 
+    * @details Allows user to specify SPI peripheral to use
+    *
+    * On Entry:
+    *     @param[in] mosi - pin to use for mosi
+    *     @param[in] miso - pin to use for miso
+    *     @param[in] sclk - pin to use for sclk
+    *     @param[in] cs - pin to use for cs
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    Max7219(PinName mosi, PinName miso, PinName sclk, PinName cs);
+    
+    
+    /**********************************************************//**
+    * @brief Default destructor for Max7219 Class.  
+    *
+    * @details Destroys SPI object if owner 
+    *
+    * On Entry:
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    ~Max7219();
+    
+    
+    /**********************************************************//**
+    * @brief Sets the number of MAX7219 devices being used.
+    *        Defaults to one
+    *
+    * @details 
+    *
+    * On Entry:
+    *     @param[in] num_devices - number of MAX7219 devices being
+    *                              used, max of 255 
+    *
+    * On Exit:
+    *
+    * @return Returns number of devices
+    **************************************************************/
+    int32_t set_num_devices(uint8_t num_devices);
+    
+    
+    /**********************************************************//**
+    * @brief Tests all devices being used 
+    *
+    * @details Sets bit0 of DISPLAY_TEST regiser in all devices
+    *
+    * On Entry:
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    void set_display_test(void);
+    
+    
+    /**********************************************************//**
+    * @brief Stops test
+    *
+    * @details Clear bit0 of DISPLAY_TEST regiser in all devices
+    *
+    * On Entry:
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    void clear_display_test(void);
+    
+    
+    /**********************************************************//**
+    * @brief Initializes specific device in display with given 
+    *        config data
+    *
+    * @details 
+    *
+    * On Entry:
+    *     @param[in] config - Structure containing configuration 
+    *                         data of device
+    *
+    * On Exit:
+    *
+    * @return  Returns  0 on success\n 
+    *          Returns -1 if device number is > _num_devices\n
+    *          Returns -2 if device number is 0\n
+    **************************************************************/
+    int32_t init_device(max7219_configuration_t config);
+    
+    
+    /**********************************************************//**
+    * @brief Initializes all devices with given config data
+    *
+    * @details All devices are configured with given data
+    *
+    * On Entry:
+    *     @param[in] config - Structure containing configuration 
+    *                         data
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    void init_display(max7219_configuration_t config);
+    
+    
+    /**********************************************************//**
+    * @brief Enables specific device in display
+    *
+    * @details 
+    *
+    * On Entry:
+    *     @param[in] device_number - device to enable
+    *
+    * On Exit:
+    *
+    * @return Returns  0 on success\n 
+    *         Returns -1 if device number is > _num_devices\n
+    *         Returns -2 if device number is 0\n
+    **************************************************************/
+    int32_t enable_device(uint8_t device_number);
+    
+    
+    /**********************************************************//**
+    * @brief Enables all device in display 
+    *
+    * @details 
+    *
+    * On Entry:
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    void enable_display(void);
+    
+    
+    /**********************************************************//**
+    * @brief Disables specific device in display
+    *
+    * @details 
+    *
+    * On Entry:
+    *     @param[in] device_number - device to disable
+    *
+    * On Exit:
+    *    @return Returns  0 on success\n 
+    *            Returns -1 if device number is > _num_devices\n
+    *            Returns -2 if device number is 0\n
+    **************************************************************/
+    int32_t disable_device(uint8_t device_number);
+    
+    
+    /**********************************************************//**
+    * @brief Disables all devices in display
+    *
+    * @details 
+    *
+    * On Entry:
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    void disable_display(void);
+    
+    
+    /**********************************************************//**
+    * @brief Writes digit of given device with given data, user
+    *        must enter correct data for decode_mode chosen
+    *
+    * @details 
+    *
+    * On Entry:
+    *     @param[in] device_number - device to write too
+    *     @param[in] digit - digit to write
+    *     @param[in] data - data to write
+    *
+    * On Exit:
+    *
+    * @return Returns  0 on success\n 
+    *         Returns -1 if device number is > _num_devices\n
+    *         Returns -2 if device number is 0\n
+    *         Returns -3 if digit > 8\n
+    *         Returns -4 if digit < 1\n
+    **************************************************************/
+    int32_t write_digit(uint8_t device_number, uint8_t digit, uint8_t data);
+    
+    
+    /**********************************************************//**
+    * @brief Clears digit of given device
+    *
+    * @details 
+    *
+    * On Entry:
+    *     @param[in] device_number - device to write too
+    *     @param[in] digit - digit to clear
+    *
+    * On Exit:
+    *
+    * @return Returns  0 on success\n 
+    *         Returns -1 if device number is > _num_devices\n
+    *         Returns -2 if device number is 0\n
+    *         Returns -3 if digit > 8\n
+    *         Returns -4 if digit < 1\n
+    **************************************************************/
+    int32_t clear_digit(uint8_t device_number, uint8_t digit);
+    
+    
+    /**********************************************************//**
+    * @brief Turns on all segments/digits of given device
+    *
+    * @details 
+    *
+    * On Entry:
+    *     @param[in] device_number - device to write too
+    *
+    * On Exit:
+    *
+    * @return Returns  0 on success\n 
+    *         Returns -1 if device number is > _num_devices\n
+    *         Returns -2 if device number is 0\n
+    **************************************************************/
+    int32_t device_all_on(uint8_t device_number);
+    
+    
+    /**********************************************************//**
+    * @brief Turns off all segments/digits of given device
+    *
+    * @details 
+    *
+    * On Entry:
+    *     @param[in] device_number - device to write too
+    *
+    * On Exit:
+    *
+    * @return Returns 0 on success\n 
+    *         Returns -1 if device number is > _num_devices\n
+    *         Returns -2 if device number is 0\n
+    **************************************************************/
+    int32_t device_all_off(uint8_t device_number);
+    
+    
+    /**********************************************************//**
+    * @brief Turns on all segments/digits of display
+    *
+    * @details 
+    *
+    * On Entry:
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    void display_all_on(void);
+    
+    
+    /**********************************************************//**
+    * @brief Turns off all segments/digits of display
+    *
+    * @details 
+    *
+    * On Entry:
+    *
+    * On Exit:
+    *
+    * @return None
+    **************************************************************/
+    void display_all_off(void);
+    
+      
+    private:
+    
+    SPI *_p_spi;
+    DigitalOut *_p_cs;
+    bool _spi_owner;
+    
+    uint8_t _num_devices;
+    
+};
+#endif /* AS1115_H*/
\ No newline at end of file