Library for the MAX7219 LED display driver

Dependents:   MAXREFDES99_demo MAXREFDES99_RTC_Display nucleo_spi_max7219_led8x8 max7219 ... more

Revision:
2:9150a0dc77a3
Parent:
1:90a7cf4e7d26
Child:
3:c245060379b9
--- a/max7219.h	Tue Jan 26 02:17:20 2016 +0000
+++ b/max7219.h	Thu May 12 18:15:32 2016 +0000
@@ -1,16 +1,5 @@
 /******************************************************************//**
 * @file max7219.h
-*
-* @author Justin Jordan
-*
-* @version 0.0
-*
-* Started: 08JAN16
-*
-* Updated: 
-*
-* @brief Header file for Max7219 class
-***********************************************************************
 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -49,6 +38,19 @@
 #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;
@@ -58,10 +60,53 @@
 }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,
@@ -81,6 +126,12 @@
     }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,
@@ -102,6 +153,13 @@
     }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,