Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MAX7456.h Source File

MAX7456.h

00001 #ifndef MAX7456_H
00002 #define MAX7456_H
00003  
00004 #include "mbed.h"
00005 #include "Stream.h"
00006 
00007 
00008 #define VM0 0x00
00009 #define VM1 0x01
00010 #define HOS 0x02
00011 #define VOS 0x03
00012 #define DMM 0x04
00013 #define DMAH 0x05
00014 #define DMAL 0x06
00015 #define DMDI 0x07
00016 #define CMM 0x08
00017 #define CMAH 0x09
00018 #define CMAL 0x0A
00019 #define CMDI 0x0B
00020 #define OSDM 0x0C
00021 #define OSDBL 0x6C
00022 #define STAT 0xA0
00023 
00024 namespace mbed {
00025 
00026 class MAX7456 : public Stream {    
00027     // Public
00028     public:        
00029  
00030         MAX7456(PinName mosi, PinName miso, PinName clk, PinName ncs, PinName nrst, const char* name=NULL); 
00031   
00032         void cls (void);
00033         void locate (int x, int y);
00034         //int _putc (int c);
00035         void test(void);
00036         void vtrim (char way,int v); // remember to pass parametres
00037         void htrim (char way,int h);
00038         void format (char c);
00039         void invert(int bit);
00040         void setdarkness (void);
00041         void initaddress (void);
00042         int _increment(int x, int y);
00043         void xyincrement();
00044         //void show (void);
00045            
00046     // Private
00047     private:
00048 
00049         SPI _spi;
00050         DigitalOut _ncs;    
00051         DigitalOut _nrst;  
00052         
00053         // register access functions
00054         int _read (int addrress);
00055         void _write (int address, int data);
00056     
00057         // putc method used by printf
00058         virtual int _putc(int c);
00059         virtual int _getc();
00060   
00061 };
00062 
00063 }
00064 
00065 #endif