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.

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

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 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:76
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:164
ssd_1306_remove
int32_t ssd_1306_remove(struct display_dev *device)
Removes resources allocated by device.
Definition: ssd_1306.c:242
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:186
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:218