245
void OLED_write(unsigned char value, unsigned char type);
void OLED_gotoxy(unsigned char x_pos, unsigned char y_pos);
void OLED_fill(unsigned char bmp_data);
void OLED_clear_screen(void);
void OLED_cursor(unsigned char x_pos, unsigned char y_pos);
void OLED_print_char(unsigned char x_pos, unsigned char y_pos, unsigned char ch);
void OLED_print_string(unsigned char x_pos, unsigned char y_pos, unsigned char
*ch);
void OLED_print_chr(unsigned char x_pos, unsigned char y_pos, signed int value);
void OLED_print_int(unsigned char x_pos, unsigned char y_pos, signed long value);
void OLED_print_decimal(unsigned char x_pos, unsigned char y_pos, unsigned int
value, unsigned char points);
void OLED_print_float(unsigned char x_pos, unsigned char y_pos, float value,
unsigned char points);
SSD1306.c
#include "SSD1306.h"
#include "fonts.h"
void setup_GPIOs(void)
{
OLED_PORT_OUT();
P1SEL2 = BIT5 | BIT7;
P1SEL = BIT5 | BIT7;
}
void OLED_init(void)
{
setup_GPIOs();
HW_SPI_init();
OLED_reset_sequence();
OLED_write((Set_Display_ON_or_OFF_CMD + Display_OFF), CMD);
OLED_write(Set_Display_Clock_CMD, CMD);
OLED_write(0x80, CMD);
OLED_write(Set_Multiplex_Ratio_CMD, CMD);
OLED_write(0x3F, CMD);
OLED_write(Set_Display_Offset_CMD, CMD);
OLED_write(0x00, CMD);
OLED_write((Set_Display_Start_Line_CMD | 0x00), CMD);
OLED_write(Set_Charge_Pump_CMD, CMD);
OLED_write((Set_Higher_Column_Start_Address_CMD | Enable_Charge_Pump), CMD);
OLED_write(Set_Memory_Addressing_Mode_CMD, CMD);
OLED_write(Page_Addressing_Mode, CMD);
OLED_write((Set_Segment_Remap_CMD | Column_Address_0_Mapped_to_SEG127), CMD);
OLED_write((Set_COM_Output_Scan_Direction_CMD | Scan_from_COM63_to_0), CMD);