Marine Electricals / MAX7219

Fork of MAX7219 by Maxim Integrated

Files at this revision

API Documentation at this revision

Comitter:
viewdeep51
Date:
Thu Sep 28 05:06:39 2017 +0000
Parent:
4:b5e4379a3d90
Child:
6:7e3d1bcc15df
Commit message:
28/09/2017

Changed in this revision

max7219.cpp Show annotated file Show diff for this revision Revisions of this file
max7219.h Show annotated file Show diff for this revision Revisions of this file
--- a/max7219.cpp	Thu May 12 20:06:28 2016 +0000
+++ b/max7219.cpp	Thu Sep 28 05:06:39 2017 +0000
@@ -234,6 +234,31 @@
     wait_us(1);
 }
 
+//*************************************************************
+void Max7219::set_intensity(max7219_configuration_t config)
+{
+   uint8_t idx = 0;
+   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); 
+}
 
 //*********************************************************************
 int32_t Max7219::enable_device(uint8_t device_number)
--- a/max7219.h	Thu May 12 20:06:28 2016 +0000
+++ b/max7219.h	Thu Sep 28 05:06:39 2017 +0000
@@ -299,7 +299,6 @@
     **************************************************************/
     void init_display(max7219_configuration_t config);
     
-    
     /**********************************************************//**
     * @brief Enables specific device in display
     *
@@ -360,6 +359,18 @@
     **************************************************************/
     void disable_display(void);
     
+    /***********************************************************//**
+    * @brief set brightness of all devices in display
+    *
+    * @details
+    *
+    * On Entry : max7219_configuration_t
+    *
+    * On Exit :
+    *
+    * return NONE
+    ***************************************************************/
+    void set_intensity(max7219_configuration_t config);
     
     /**********************************************************//**
     * @brief Writes digit of given device with given data, user