no-OS
Macros | Functions | Variables
ssd_1306.c File Reference

Implementation of ssd_1306 Driver. More...

#include <stdbool.h>
#include "ssd_1306.h"
#include "no_os_error.h"
#include "no_os_spi.h"
#include "no_os_delay.h"
#include <string.h>
Include dependency graph for ssd_1306.c:

Macros

#define SSD1306_RST_ON   0U
 
#define SSD1306_RST_OFF   1U
 
#define SSD1306_DC_DATA   1U
 
#define SSD1306_DC_CMD   0U
 
#define SSD1306_DISP_ON   0xAFU
 
#define SSD1306_DISP_OFF   0xAEU
 
#define SSD1306_CHARSZ   8U
 

Functions

int32_t ssd_1306_init (struct display_dev *device)
 Initializes ssd_1306 for display screening. More...
 
int32_t ssd_1306_display_on_off (struct display_dev *device, uint8_t on_off)
 ssd_1306 turns display on/off. More...
 
int32_t ssd_1306_move_cursor (struct display_dev *device, uint8_t row, uint8_t column)
 Moves cursor to desired row/column. More...
 
int32_t ssd_1306_print_ascii (struct display_dev *device, uint8_t ascii, uint8_t row, uint8_t column)
 Prints character at selected position. More...
 
int32_t ssd_1306_remove (struct display_dev *device)
 Removes resources allocated by device. More...
 

Variables

const struct display_controller_ops ssd1306_ops
 
const uint8_t no_os_chr_8x8 [128][8]
 

Detailed Description

Implementation of ssd_1306 Driver.

Author
Andrei Porumb (andre.nosp@m.i.po.nosp@m.rumb@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2021(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ SSD1306_CHARSZ

#define SSD1306_CHARSZ   8U

◆ SSD1306_DC_CMD

#define SSD1306_DC_CMD   0U

◆ SSD1306_DC_DATA

#define SSD1306_DC_DATA   1U

◆ SSD1306_DISP_OFF

#define SSD1306_DISP_OFF   0xAEU

◆ SSD1306_DISP_ON

#define SSD1306_DISP_ON   0xAFU

◆ SSD1306_RST_OFF

#define SSD1306_RST_OFF   1U

◆ SSD1306_RST_ON

#define SSD1306_RST_ON   0U

Function Documentation

◆ ssd_1306_display_on_off()

int32_t ssd_1306_display_on_off ( struct display_dev device,
uint8_t  on_off 
)

ssd_1306 turns display on/off.

Parameters
device- The device structure
on_off- Display state
Returns
Returns 0 in case of success or negative error code otherwise.

◆ ssd_1306_init()

int32_t ssd_1306_init ( struct display_dev device)

Initializes ssd_1306 for display screening.

Parameters
device- The device structure.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ ssd_1306_move_cursor()

int32_t ssd_1306_move_cursor ( struct display_dev device,
uint8_t  row,
uint8_t  column 
)

Moves cursor to desired row/column.

Parameters
device- The device structure
row- row
column- column
Returns
Returns 0 in case of success or negative error code otherwise.
Here is the caller graph for this function:

◆ ssd_1306_print_ascii()

int32_t ssd_1306_print_ascii ( struct display_dev device,
uint8_t  ascii,
uint8_t  row,
uint8_t  column 
)

Prints character at selected position.

Parameters
device- The device structure.
ascii- corresponding number to ascii table
row- row
column- column
Returns
Returns 0 in case of success or negative error code otherwise.

◆ ssd_1306_remove()

int32_t ssd_1306_remove ( struct display_dev device)

Removes resources allocated by device.

Parameters
device- The device structure.
Returns
Returns 0 in case of success or negative error code otherwise.

Variable Documentation

◆ no_os_chr_8x8

const uint8_t no_os_chr_8x8[128][8]

◆ ssd1306_ops

const struct display_controller_ops ssd1306_ops
Initial value:
= {
.init = &ssd_1306_init,
.display_on_off = &ssd_1306_display_on_off,
.move_cursor = &ssd_1306_move_cursor,
.print_char = &ssd_1306_print_ascii,
.remove = &ssd_1306_remove
}
ssd_1306_init
int32_t ssd_1306_init(struct display_dev *device)
Initializes ssd_1306 for display screening.
Definition: ssd_1306.c:82
ssd_1306_display_on_off
int32_t ssd_1306_display_on_off(struct display_dev *device, uint8_t on_off)
ssd_1306 turns display on/off.
Definition: ssd_1306.c:170
ssd_1306_remove
int32_t ssd_1306_remove(struct display_dev *device)
Removes resources allocated by device.
Definition: ssd_1306.c:248
ssd_1306_move_cursor
int32_t ssd_1306_move_cursor(struct display_dev *device, uint8_t row, uint8_t column)
Moves cursor to desired row/column.
Definition: ssd_1306.c:192
ssd_1306_print_ascii
int32_t ssd_1306_print_ascii(struct display_dev *device, uint8_t ascii, uint8_t row, uint8_t column)
Prints character at selected position.
Definition: ssd_1306.c:224