初始化提交
This commit is contained in:
85
arduino-cli/libraries/Bluebit/DuinoplusMax7219.h
Normal file
85
arduino-cli/libraries/Bluebit/DuinoplusMax7219.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Max7219.h - A library for controling Leds with a MAX7219/MAX7221
|
||||
* Copyright (c) 2007 Eberhard Fahle
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* 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 THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS 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.
|
||||
*/
|
||||
|
||||
#ifndef _DUINOPLUSMAX7219_H_
|
||||
#define _DUINOPLUSMAX7219_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#if (ARDUINO >= 100)
|
||||
#include <Arduino.h>
|
||||
#else
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>ֺ<EFBFBD><D6BA><EFBFBD>ĸ
|
||||
*/
|
||||
const static byte charTable [] PROGMEM = {
|
||||
B01111110,B00110000,B01101101,B01111001,B00110011,B01011011,B01011111,B01110000,
|
||||
B01111111,B01111011,B01110111,B00011111,B00001101,B00111101,B01001111,B01000111,
|
||||
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
|
||||
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
|
||||
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
|
||||
B00000000,B00000000,B00000000,B00000000,B10000000,B00000001,B10000000,B00000000,
|
||||
B01111110,B00110000,B01101101,B01111001,B00110011,B01011011,B01011111,B01110000,
|
||||
B01111111,B01111011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
|
||||
B00000000,B01110111,B00011111,B00001101,B00111101,B01001111,B01000111,B00000000,
|
||||
B00110111,B00000000,B00000000,B00000000,B00001110,B00000000,B00000000,B00000000,
|
||||
B01100111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
|
||||
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,
|
||||
B00000000,B01110111,B00011111,B00001101,B00111101,B01001111,B01000111,B00000000,
|
||||
B00110111,B00000000,B00000000,B00000000,B00001110,B00000000,B00010101,B00011101,
|
||||
B01100111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
|
||||
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
|
||||
};
|
||||
|
||||
class Max7219 {
|
||||
private :
|
||||
int SPI_MOSI;
|
||||
int SPI_CLK;
|
||||
int SPI_CS;
|
||||
byte status[64];
|
||||
byte spidata[16]; /*<2A><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SPI<50><49><EFBFBD><EFBFBD>*/
|
||||
void spiTransfer(int addr, byte opcode, byte data); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>*/
|
||||
|
||||
public:
|
||||
int maxDevices; /*<2A><>༶<EFBFBD><E0BCB6><EFBFBD>豸*/
|
||||
Max7219(int csPin, int dataPin, int clkPin, int numDevices=1); /* ȱʡ<C8B1><CAA1><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>Ϊ1 */
|
||||
int getDeviceCount(); /*<2A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8> */
|
||||
void shutdown(bool status); /*<2A><><EFBFBD><EFBFBD> */
|
||||
void setScanLimit(int limit); /* */
|
||||
void setIntensity(int intensity); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
void clearDisplay(void);
|
||||
void update(byte *buff); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>ѻ<EFBFBD><D1BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>оƬ*/
|
||||
void setDigit(int addr, int digit, byte value, boolean dp); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>*/
|
||||
void setChar(int addr, int digit, char value, boolean dp); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ַ<EFBFBD>*/
|
||||
};
|
||||
|
||||
#endif /*_MAX7219_H_*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user