Charles Young's development fork. Going forward I only want to push mature code to main repository.

Dependencies:   mbed

Fork of GEO_COUNTER_L432KC by Geo Electronics "Geo Counter"

Committer:
Charles David Young
Date:
Thu Sep 06 05:37:59 2018 -0700
Revision:
34:10550b327e3d
Parent:
29:3a2152a3a9d1
Child:
35:63e6c6fe6eec
Implemented modes switch

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Charles David Young 25:0161bf1adc81 1 /**
Charles David Young 25:0161bf1adc81 2 * @author Charles Young
Charles David Young 25:0161bf1adc81 3 * This class encapsulates the behavior of the 7-seg 8 digit LED display
Charles David Young 25:0161bf1adc81 4 */
Charles David Young 25:0161bf1adc81 5
Charles David Young 25:0161bf1adc81 6 #ifndef LED7segDisplay_H
Charles David Young 25:0161bf1adc81 7 #define LED7segDisplay_H
Charles David Young 25:0161bf1adc81 8
Charles David Young 25:0161bf1adc81 9 /**
Charles David Young 25:0161bf1adc81 10 * Includes
Charles David Young 25:0161bf1adc81 11 */
Charles David Young 25:0161bf1adc81 12 #include "mbed.h"
Charles David Young 25:0161bf1adc81 13 #include "HwRegisters.hpp"
Charles David Young 25:0161bf1adc81 14
Charles David Young 25:0161bf1adc81 15 #define DEC_MODE 0x09FF // BCD decoding on all digits
Charles David Young 25:0161bf1adc81 16 #define SCAN_LIM 0x0B07 // use all 8 digits
Charles David Young 25:0161bf1adc81 17 #define TURN_ON 0x0C01 // no shutdown (operating)
Charles David Young 25:0161bf1adc81 18 #define SHUTDOWN 0x0C00 // shutdown
Charles David Young 25:0161bf1adc81 19 #define TEST 0x0F00 // no test
Charles David Young 25:0161bf1adc81 20 #define DT 1 // delay time in us for SPI emulation
Charles David Young 25:0161bf1adc81 21
Charles David Young 25:0161bf1adc81 22 #define BRIGHTNESS_MIN 0x0A00 // brightness in 16 steps - min to max is 0x0A00 to 0x0A0F
Charles David Young 25:0161bf1adc81 23 #define BRIGHTNESS_MAX 0x0A0F // brightness in 16 steps - min to max is 0x0A00 to 0x0A0F
Charles David Young 25:0161bf1adc81 24
Charles David Young 25:0161bf1adc81 25 /**
Charles David Young 25:0161bf1adc81 26 * Code associated with rotary switch.
Charles David Young 25:0161bf1adc81 27 */
Charles David Young 25:0161bf1adc81 28 class LED7segDisplay {
Charles David Young 25:0161bf1adc81 29
Charles David Young 25:0161bf1adc81 30 public:
Charles David Young 25:0161bf1adc81 31
Charles David Young 25:0161bf1adc81 32 /**
Charles David Young 25:0161bf1adc81 33 * Constructor.
Charles David Young 25:0161bf1adc81 34 *
Charles David Young 25:0161bf1adc81 35 * @param channelA mbed pin for channel A input.
Charles David Young 25:0161bf1adc81 36 * @param channelB mbed pin for channel B input.
Charles David Young 25:0161bf1adc81 37 */
Charles David Young 25:0161bf1adc81 38 LED7segDisplay();
Charles David Young 25:0161bf1adc81 39
Charles David Young 29:3a2152a3a9d1 40 void Display_6D_write(uint32_t); // write to MAX7219 (Main 6-digits display)
Charles David Young 25:0161bf1adc81 41 void Display_2D_write(unsigned short); // write to MAX7219 (Gate 2-digits display)
Charles David Young 25:0161bf1adc81 42 void Display_brightness_up();
Charles David Young 25:0161bf1adc81 43 void Display_brightness_down();
Charles David Young 34:10550b327e3d 44 uint16_t GetBrightness(return brightness;);
Charles David Young 25:0161bf1adc81 45
Charles David Young 25:0161bf1adc81 46 private:
charlesdavidyoung 26:166dbe6022e8 47 uint16_t brightness;
Charles David Young 25:0161bf1adc81 48 uint8_t Disp_Digit[8]; // used to manage 8-digits through MAX7219
Charles David Young 25:0161bf1adc81 49 uint16_t Stream; // used to stream out serial data to MAX7219
Charles David Young 25:0161bf1adc81 50
Charles David Young 25:0161bf1adc81 51 void Display_init(void); // initialize MAX7219
Charles David Young 25:0161bf1adc81 52 void sendDataToDisplay(uint16_t data_to_send);
Charles David Young 25:0161bf1adc81 53 void Display_brightness(uint16_t brightness);
Charles David Young 25:0161bf1adc81 54 };
Charles David Young 25:0161bf1adc81 55
Charles David Young 25:0161bf1adc81 56 #endif /* LED7segDisplay_H */