Skip to content

Commit

Permalink
Update some formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiancristea00 committed Dec 18, 2023
1 parent ce67428 commit 4a0b3e5
Show file tree
Hide file tree
Showing 20 changed files with 158 additions and 143 deletions.
14 changes: 7 additions & 7 deletions Base/include/oled-draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


#ifndef OLED_DRAW_H
#define OLED_DRAW_H
#define OLED_DRAW_H

////////////////////////////////////////////////////////////////////////////////
// //
Expand Down Expand Up @@ -43,11 +43,11 @@ typedef enum OLED_SHAPE_TYPE
OLED_SHAPE_LINE = 0x01,
OLED_SHAPE_RECTANGLE = 0x02,
OLED_SHAPE_FILLED_RECTANGLE = 0x03,
OLED_SHAPE_DISC = 0x04,
OLED_SHAPE_CIRCLE = 0x05,
OLED_SHAPE_BITMAP = 0x06,
OLED_SHAPE_CHARACTER = 0x07,
OLED_SHAPE_STRING = 0x08,
OLED_SHAPE_DISC = 0x04,
OLED_SHAPE_CIRCLE = 0x05,
OLED_SHAPE_BITMAP = 0x06,
OLED_SHAPE_CHARACTER = 0x07,
OLED_SHAPE_STRING = 0x08,
} oled_shape_type_t;

typedef struct OLED_POINT
Expand Down Expand Up @@ -138,4 +138,4 @@ typedef struct OLED_SHAPE
void OLED_SetShape(oled_shape_t * const shape, oled_shape_type_t const type, oled_shape_parameters_t const * const parameters, oled_colour_t const colour);


#endif // OLED_DRAW_H
#endif // OLED_DRAW_H
4 changes: 2 additions & 2 deletions Base/include/oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


#ifndef OLED_H
#define OLED_H
#define OLED_H


////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -156,4 +156,4 @@ void OLED_SendColor(oled_device_t const * const device, oled_packed_colour_t con
void OLED_SetBackground(oled_device_t const * const device, oled_colour_t const colour);


#endif // OLED_H
#endif // OLED_H
2 changes: 1 addition & 1 deletion Base/include/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


#ifndef SPI_H
#define SPI_H
#define SPI_H


////////////////////////////////////////////////////////////////////////////////
Expand Down
37 changes: 19 additions & 18 deletions Base/src/oled-draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "oled-draw.h"

#include "config.h"
#include "utils.h"
#include "oled.h"

#include <stdint.h>
Expand Down Expand Up @@ -48,7 +49,7 @@
* @param[in] colour Colour of the point
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_Point(oled_device_t const * const device, uint8_t const x, uint8_t const y, oled_packed_colour_t const colour);
INLINE void OLED_DRAW_Point(oled_device_t const * const device, uint8_t const x, uint8_t const y, oled_packed_colour_t const colour);

/**
* @brief Draws a line on the OLED screen.
Expand All @@ -59,7 +60,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Point(oled_device_t const *
* @param[in] colour Colour of the line
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_Line(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, uint8_t const width, oled_packed_colour_t const colour);
INLINE void OLED_DRAW_Line(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, uint8_t const width, oled_packed_colour_t const colour);

/**
* @brief Draws a rectangle on the OLED screen.
Expand All @@ -70,7 +71,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Line(oled_device_t const *
* @param[in] colour Colour of the border
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_Rectangle(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, uint8_t const width, oled_packed_colour_t const colour);
INLINE void OLED_DRAW_Rectangle(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, uint8_t const width, oled_packed_colour_t const colour);

/**
* @brief Draws a filled rectangle on the OLED screen.
Expand All @@ -80,7 +81,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Rectangle(oled_device_t con
* @param[in] colour Colour of the rectangle
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_FilledRectangle(oled_device_t const * const device, oled_point_t const startPoint, oled_point_t const endPoint, oled_packed_colour_t const colour);
INLINE void OLED_DRAW_FilledRectangle(oled_device_t const * const device, oled_point_t const startPoint, oled_point_t const endPoint, oled_packed_colour_t const colour);

/**
* @brief Draws a circle on the OLED screen.
Expand All @@ -91,7 +92,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_FilledRectangle(oled_device
* @param[in] colour Colour of the border
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_Circle(oled_device_t const * const device, oled_point_t const center, uint8_t const radius, uint8_t const width, oled_packed_colour_t const colour);
INLINE void OLED_DRAW_Circle(oled_device_t const * const device, oled_point_t const center, uint8_t const radius, uint8_t const width, oled_packed_colour_t const colour);

/**
* @brief Draws a disc on the OLED screen.
Expand All @@ -101,7 +102,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Circle(oled_device_t const
* @param[in] colour Colour of the disc
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_Disc(oled_device_t const * const device, oled_point_t const center, uint8_t const radius, oled_packed_colour_t const colour);
INLINE void OLED_DRAW_Disc(oled_device_t const * const device, oled_point_t const center, uint8_t const radius, oled_packed_colour_t const colour);

/**
* @brief Draws a 24-bit RGB colour bitmap on the OLED screen.
Expand All @@ -112,7 +113,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Disc(oled_device_t const *
* @param[in] start Start position (top left corner)
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_Bitmap(oled_device_t const * const device, oled_packed_colour_t const * const bitmap, uint8_t const xSize, uint8_t const ySize, oled_point_t const start);
INLINE void OLED_DRAW_Bitmap(oled_device_t const * const device, oled_packed_colour_t const * const bitmap, uint8_t const xSize, uint8_t const ySize, oled_point_t const start);

/**
* @brief Draws a character on the OLED screen.
Expand All @@ -124,7 +125,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Bitmap(oled_device_t const
* @param[in] colour Colour of the character
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_Character(oled_device_t const * const device, oled_point_t const start, uint8_t const xScale, uint8_t const yScale, uint8_t const character, oled_packed_colour_t const colour);
INLINE void OLED_DRAW_Character(oled_device_t const * const device, oled_point_t const start, uint8_t const xScale, uint8_t const yScale, uint8_t const character, oled_packed_colour_t const colour);

/**
* @brief Draws a string on the OLED screen.
Expand All @@ -136,7 +137,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Character(oled_device_t con
* @param[in] colour Colour of the characters
* @return None
**/
__attribute__((always_inline)) inline void OLED_DRAW_String(oled_device_t const * const device, oled_point_t const start, uint8_t const xScale, uint8_t const yScale, uint8_t const * const data, oled_packed_colour_t const colour);
INLINE void OLED_DRAW_String(oled_device_t const * const device, oled_point_t const start, uint8_t const xScale, uint8_t const yScale, uint8_t const * const data, oled_packed_colour_t const colour);

/**
* @brief Unified API to draw a point on the OLED screen.
Expand Down Expand Up @@ -216,7 +217,7 @@ void OLED_DrawString(oled_device_t const * const device, oled_shape_t const * co
// //
////////////////////////////////////////////////////////////////////////////////

__attribute__((always_inline)) inline void OLED_DRAW_Point(oled_device_t const * const device, uint8_t const x, uint8_t const y, oled_packed_colour_t const colour)
INLINE void OLED_DRAW_Point(oled_device_t const * const device, uint8_t const x, uint8_t const y, oled_packed_colour_t const colour)
{
if ((x > OLED_DRAW_MAX_DIMENSION) || (y > OLED_DRAW_MAX_DIMENSION))
{
Expand All @@ -233,7 +234,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Point(oled_device_t const *
return;
}

__attribute__((always_inline)) inline void OLED_DRAW_Line(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, uint8_t const width, oled_packed_colour_t const colour)
INLINE void OLED_DRAW_Line(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, uint8_t const width, oled_packed_colour_t const colour)
{
uint8_t const lineWidth = (width > 1) ? width : 1;

Expand Down Expand Up @@ -285,7 +286,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Line(oled_device_t const *
return;
}

__attribute__((always_inline)) inline void OLED_DRAW_Rectangle(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, uint8_t const width, oled_packed_colour_t const colour)
INLINE void OLED_DRAW_Rectangle(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, uint8_t const width, oled_packed_colour_t const colour)
{

oled_point_t const topLeft = { start.x, start.y };
Expand All @@ -301,7 +302,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Rectangle(oled_device_t con
return;
}

__attribute__((always_inline)) inline void OLED_DRAW_FilledRectangle(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, oled_packed_colour_t const colour)
INLINE void OLED_DRAW_FilledRectangle(oled_device_t const * const device, oled_point_t const start, oled_point_t const end, oled_packed_colour_t const colour)
{
OLED_SetColumnAddressBounds(device, start.x, end.x);
OLED_SetRowAddressBounds(device, start.y, end.y);
Expand All @@ -321,7 +322,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_FilledRectangle(oled_device
return;
}

__attribute__((always_inline)) inline void OLED_DRAW_Circle(oled_device_t const * const device, oled_point_t const center, uint8_t const radius, uint8_t const width, oled_packed_colour_t const colour)
INLINE void OLED_DRAW_Circle(oled_device_t const * const device, oled_point_t const center, uint8_t const radius, uint8_t const width, oled_packed_colour_t const colour)
{
int8_t x;
int8_t y;
Expand Down Expand Up @@ -365,7 +366,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Circle(oled_device_t const
return;
}

__attribute__((always_inline)) inline void OLED_DRAW_Disc(oled_device_t const * const device, oled_point_t const center, uint8_t const radius, oled_packed_colour_t const colour)
INLINE void OLED_DRAW_Disc(oled_device_t const * const device, oled_point_t const center, uint8_t const radius, oled_packed_colour_t const colour)
{
int8_t y = ((radius > 1) ? radius : 1) + 1;
int8_t x = 0;
Expand Down Expand Up @@ -403,7 +404,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Disc(oled_device_t const *
return;
}

__attribute__((always_inline)) inline void OLED_DRAW_Bitmap(oled_device_t const * const device, oled_packed_colour_t const * const bitmap, uint8_t const xSize, uint8_t const ySize, oled_point_t const start)
INLINE void OLED_DRAW_Bitmap(oled_device_t const * const device, oled_packed_colour_t const * const bitmap, uint8_t const xSize, uint8_t const ySize, oled_point_t const start)
{
OLED_SetColumnAddressBounds(device, start.x, start.x + xSize - 1);
OLED_SetRowAddressBounds(device, start.y, start.y + ySize - 1);
Expand All @@ -423,7 +424,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Bitmap(oled_device_t const
return;
}

__attribute__((always_inline)) inline void OLED_DRAW_Character(oled_device_t const * const device, oled_point_t const start, uint8_t const xScale, uint8_t const yScale, uint8_t const character, oled_packed_colour_t const colour)
INLINE void OLED_DRAW_Character(oled_device_t const * const device, oled_point_t const start, uint8_t const xScale, uint8_t const yScale, uint8_t const character, oled_packed_colour_t const colour)
{
static uint8_t const font[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x00, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x00, /* ' ' AND ! AND " */
Expand Down Expand Up @@ -488,7 +489,7 @@ __attribute__((always_inline)) inline void OLED_DRAW_Character(oled_device_t con
return;
}

__attribute__((always_inline)) inline void OLED_DRAW_String(oled_device_t const * const device, oled_point_t const start, uint8_t const xScale, uint8_t const yScale, uint8_t const * const data, oled_packed_colour_t const colour)
INLINE void OLED_DRAW_String(oled_device_t const * const device, oled_point_t const start, uint8_t const xScale, uint8_t const yScale, uint8_t const * const data, oled_packed_colour_t const colour)
{
uint8_t character = '\0';
uint8_t const * currentStringPosition = data;
Expand Down
Loading

0 comments on commit 4a0b3e5

Please sign in to comment.