Skip to content

File OledController.cpp

FileList > demo-projets > stm32 > src > OledController.cpp

Go to the source code of this file.

  • #include "OledController.hpp"
  • #include "Dispatcher.hpp"
  • #include "string.h"
  • #include "utils/Debug.hpp"
  • #include <math.h>
  • #include <stdlib.h>

Public Static Attributes

Type Name
OLED_t OLED
uint8_t OLED_Buffer
uint8_t oled_height = = 64
uint8_t oled_width = = 128

Public Functions

Type Name
void oledDispatch (const CoprocReq_OledReq & request)
void oledDrawArc (uint8_t x, uint8_t y, uint8_t radius, uint16_t start_angle, uint16_t sweep, OLED_COLOR color)
void oledDrawCircle (uint8_t par_x, uint8_t par_y, uint8_t par_r, OLED_COLOR par_color)
void oledDrawLine (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, OLED_COLOR color)
void oledDrawPixel (uint8_t x, uint8_t y, OLED_COLOR color)
void oledDrawRectangle (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, OLED_COLOR color)
void oledFill (OLED_COLOR color)
OLED_Error_t oledFillBuffer (uint8_t * buf, uint32_t len)
bool oledGetDisplayOn ()
Reads DisplayOn state.
void oledInit (const CoprocReq_OledInit & init)
void oledPolyline (const OLED_VERTEX * par_vertex, uint16_t par_size, OLED_COLOR color)
void oledSetContrast (const uint8_t value)
Sets the contrast of the display.
void oledSetCursor (uint8_t x, uint8_t y)
void oledSetDisplayOn (const bool on)
Set Display ON/OFF.
bool oledTestConnection ()
void oledUpdateScreen (void)
char oledWriteChar (char ch, FontDef Font, OLED_COLOR color)
void oledWriteCommand (uint8_t byte)
void oledWriteData (uint8_t * buffer, size_t buff_size)
char oledWriteString (const char * str, FontDef Font, OLED_COLOR color)

Public Static Functions

Type Name
float oledDegToRad (float par_deg)
uint16_t oledNormalizeTo0_360 (uint16_t par_deg)

Macros

Type Name
define CIRCLE_APPROXIMATION_SEGMENTS 36

Public Static Attributes Documentation

variable OLED

OLED_t OLED;

variable OLED_Buffer

uint8_t OLED_Buffer[OLED_BUFFER_SIZE];

variable oled_height

uint8_t oled_height;

variable oled_width

uint8_t oled_width;

Public Functions Documentation

function oledDispatch

void oledDispatch (
    const CoprocReq_OledReq & request
) 

function oledDrawArc

void oledDrawArc (
    uint8_t x,
    uint8_t y,
    uint8_t radius,
    uint16_t start_angle,
    uint16_t sweep,
    OLED_COLOR color
) 

function oledDrawCircle

void oledDrawCircle (
    uint8_t par_x,
    uint8_t par_y,
    uint8_t par_r,
    OLED_COLOR par_color
) 

function oledDrawLine

void oledDrawLine (
    uint8_t x1,
    uint8_t y1,
    uint8_t x2,
    uint8_t y2,
    OLED_COLOR color
) 

function oledDrawPixel

void oledDrawPixel (
    uint8_t x,
    uint8_t y,
    OLED_COLOR color
) 

function oledDrawRectangle

void oledDrawRectangle (
    uint8_t x1,
    uint8_t y1,
    uint8_t x2,
    uint8_t y2,
    OLED_COLOR color
) 

function oledFill

void oledFill (
    OLED_COLOR color
) 

function oledFillBuffer

OLED_Error_t oledFillBuffer (
    uint8_t * buf,
    uint32_t len
) 

function oledGetDisplayOn

Reads DisplayOn state.

bool oledGetDisplayOn () 

Returns:

0: OFF. 1: ON.

function oledInit

void oledInit (
    const CoprocReq_OledInit & init
) 

function oledPolyline

void oledPolyline (
    const OLED_VERTEX * par_vertex,
    uint16_t par_size,
    OLED_COLOR color
) 

function oledSetContrast

Sets the contrast of the display.

void oledSetContrast (
    const uint8_t value
) 

Parameters:

  • value contrast to set.

Note:

Contrast increases as the value increases.

Note:

RESET = 7Fh.

function oledSetCursor

void oledSetCursor (
    uint8_t x,
    uint8_t y
) 

function oledSetDisplayOn

Set Display ON/OFF.

void oledSetDisplayOn (
    const bool on
) 

Parameters:

  • on 0 for OFF, any for ON.

function oledTestConnection

bool oledTestConnection () 

function oledUpdateScreen

void oledUpdateScreen (
    void
) 

function oledWriteChar

char oledWriteChar (
    char ch,
    FontDef Font,
    OLED_COLOR color
) 

function oledWriteCommand

void oledWriteCommand (
    uint8_t byte
) 

function oledWriteData

void oledWriteData (
    uint8_t * buffer,
    size_t buff_size
) 

function oledWriteString

char oledWriteString (
    const char * str,
    FontDef Font,
    OLED_COLOR color
) 

Public Static Functions Documentation

function oledDegToRad

static float oledDegToRad (
    float par_deg
) 

function oledNormalizeTo0_360

static uint16_t oledNormalizeTo0_360 (
    uint16_t par_deg
) 

Macro Definition Documentation

define CIRCLE_APPROXIMATION_SEGMENTS

#define CIRCLE_APPROXIMATION_SEGMENTS 36

The documentation for this class was generated from the following file demo-projets/stm32/src/OledController.cpp