1 /**************************************************************************/
4 @author K. Townsend (microBuilder.eu)
8 Software License Agreement (BSD License)
10 Copyright (c) 2010, microBuilder SARL
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 1. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 3. Neither the name of the copyright holders nor the
21 names of its contributors may be used to endorse or promote products
22 derived from this software without specific prior written permission.
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /**************************************************************************/
39 #include "projectconfig.h"
41 #include "drivers/displays/smallfonts.h"
44 #define ST7565_A0_PORT (2) // Register Select Pin (A0)
45 #define ST7565_A0_PIN (1)
46 #define ST7565_RST_PORT (2) // Reset
47 #define ST7565_RST_PIN (2)
48 #define ST7565_CS_PORT (2) // Select
49 #define ST7565_CS_PIN (3)
50 #define ST7565_BL_PORT (2) // Backlight
51 #define ST7565_BL_PIN (4)
52 #define ST7565_SCLK_PORT (2) // Serial Clock
53 #define ST7565_SCLK_PIN (5)
54 #define ST7565_SDAT_PORT (2) // Serial Data
55 #define ST7565_SDAT_PIN (6)
58 #define ST7565_CMD_DISPLAY_OFF 0xAE
59 #define ST7565_CMD_DISPLAY_ON 0xAF
60 #define ST7565_CMD_SET_DISP_START_LINE 0x40
61 #define ST7565_CMD_SET_PAGE 0xB0
62 #define ST7565_CMD_SET_COLUMN_UPPER 0x10
63 #define ST7565_CMD_SET_COLUMN_LOWER 0x00
64 #define ST7565_CMD_SET_ADC_NORMAL 0xA0
65 #define ST7565_CMD_SET_ADC_REVERSE 0xA1
66 #define ST7565_CMD_SET_DISP_NORMAL 0xA6
67 #define ST7565_CMD_SET_DISP_REVERSE 0xA7
68 #define ST7565_CMD_SET_ALLPTS_NORMAL 0xA4
69 #define ST7565_CMD_SET_ALLPTS_ON 0xA5
70 #define ST7565_CMD_SET_BIAS_9 0xA2
71 #define ST7565_CMD_SET_BIAS_7 0xA3
72 #define ST7565_CMD_RMW 0xE0
73 #define ST7565_CMD_RMW_CLEAR 0xEE
74 #define ST7565_CMD_INTERNAL_RESET 0xE2
75 #define ST7565_CMD_SET_COM_NORMAL 0xC0
76 #define ST7565_CMD_SET_COM_REVERSE 0xC8
77 #define ST7565_CMD_SET_POWER_CONTROL 0x28
78 #define ST7565_CMD_SET_RESISTOR_RATIO 0x20
79 #define ST7565_CMD_SET_VOLUME_FIRST 0x81
80 #define ST7565_CMD_SET_VOLUME_SECOND 0
81 #define ST7565_CMD_SET_STATIC_OFF 0xAC
82 #define ST7565_CMD_SET_STATIC_ON 0xAD
83 #define ST7565_CMD_SET_STATIC_REG 0x0
84 #define ST7565_CMD_SET_BOOSTER_FIRST 0xF8
85 #define ST7565_CMD_SET_BOOSTER_234 0
86 #define ST7565_CMD_SET_BOOSTER_5 1
87 #define ST7565_CMD_SET_BOOSTER_6 3
88 #define ST7565_CMD_NOP 0xE3
89 #define ST7565_CMD_TEST 0xF0
91 // Initialisation/Config Prototypes
92 void st7565Init( void );
93 void st7565Command( uint8_t c
);
94 void st7565Data( uint8_t d
);
95 void st7565SetBrightness( uint8_t val
);
97 // Backlight Prototypes
98 void st7565Backlight(bool state
);
100 // Drawing Prototypes
101 void st7565ClearScreen( void );
102 void st7565Refresh( void );
103 void st7565DrawPixel( uint8_t x
, uint8_t y
);
104 void st7565ClearPixel( uint8_t x
, uint8_t y
);
105 uint8_t st7565GetPixel( uint8_t x
, uint8_t y
);
106 void st7565DrawString( uint16_t x
, uint16_t y
, char* text
, struct FONT_DEF font
);
107 void st7565ShiftFrameBuffer( uint8_t pixels
);
This page took 0.044375 seconds and 5 git commands to generate.