minor changes
This commit is contained in:
2022-11-27 07:49:52 +01:00
parent d0b533daf9
commit 1b83af44e9
5 changed files with 56 additions and 17 deletions

View File

@@ -1,15 +1,18 @@
#include <stdlib.h>
// #include <assert.h>
#include "oled.h"
#include "ssd1306.h"
#include "sh1106.h"
HAL_StatusTypeDef oled_Config(OLED_HandleTypeDef *hOled, uint8_t DevAddress, uint8_t Width, uint8_t Height, OLED_DisplayType_t OledType)
{
// static_assert(hOled != NULL, "brak pointera");
if (hOled == NULL || Width == 0 || Height == 0 || OledType == UNKNOWN)
{
return HAL_ERROR;
}
hOled->hi2c = NULL;
hOled->DevAddress = DevAddress;
hOled->Width = Width;
hOled->Height = Height;
@@ -78,7 +81,7 @@ OLED_SendStatus_t oled_display_page(OLED_HandleTypeDef *hOled)
{
if (hOled == NULL)
{
return;
return ERROR;
}
OLED_SendStatus_t sendStatus;
switch (hOled->OledType)
@@ -97,9 +100,3 @@ OLED_SendStatus_t oled_display_page(OLED_HandleTypeDef *hOled)
return sendStatus;
}
int main(void)
{
OLED_HandleTypeDef display;
oled_Config(&display, 0x3C, 128, 64, SH1106);
}

View File

@@ -14,6 +14,7 @@ typedef enum
} OLED_DisplayType_t;
typedef enum{
ERROR,
SENDPAGE,
SENDALL
} OLED_SendStatus_t;
@@ -30,4 +31,7 @@ typedef struct
} OLED_HandleTypeDef;
void oled_init(OLED_HandleTypeDef *hOled, I2C_HandleTypeDef *hi2c);
HAL_StatusTypeDef oled_Config(OLED_HandleTypeDef *hOled, uint8_t DevAddress, uint8_t Width, uint8_t Height, OLED_DisplayType_t OledType);
void oled_init(OLED_HandleTypeDef *hOled, I2C_HandleTypeDef *hi2c);
void oled_display_all(OLED_HandleTypeDef *hOled);
OLED_SendStatus_t oled_display_page(OLED_HandleTypeDef *hOled);