update u8g2lib + working display
This commit is contained in:
47
MilliOhmMeter_FW/src/display_hall.h
Normal file
47
MilliOhmMeter_FW/src/display_hall.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#include "U8g2lib.h"
|
||||
|
||||
#include "measure.h"
|
||||
#include "connect.h"
|
||||
|
||||
|
||||
#define SCREENREFRESH 100
|
||||
#define SCREENWIDTH 256
|
||||
|
||||
#define FONT8 u8g2_font_helvR08_tf
|
||||
#define FONT16 u8g2_font_7x14_tf
|
||||
#define FONT24 u8g2_font_freedoomr25_tn //u8g2_font_logisoso24_tf
|
||||
|
||||
class U8G2_SSD1322 : public U8G2 {
|
||||
public:
|
||||
U8G2_SSD1322(const u8g2_cb_t *rotation, uint8_t mosi, uint8_t clk, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() {
|
||||
u8g2_Setup_ssd1322_nhd_256x64_f(&u8g2, rotation, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino);
|
||||
SetPin_4Wire_HW_SPI(getU8x8(), mosi, clk, cs, dc, reset);
|
||||
}
|
||||
|
||||
void SetPin_4Wire_HW_SPI(u8x8_t *u8x8, uint8_t mosi, uint8_t clk, uint8_t cs, uint8_t dc, uint8_t reset)
|
||||
{
|
||||
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
|
||||
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
|
||||
u8x8_SetPin(u8x8, U8X8_PIN_I2C_DATA, mosi); //note the orignina u8x8 callbacks are using I2C_data and I2C_clk
|
||||
u8x8_SetPin(u8x8, U8X8_PIN_I2C_CLOCK, clk);
|
||||
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void initDisplayHall(void);
|
||||
void handleDisplayHall(void);
|
||||
|
||||
void clearDisplay(void);
|
||||
|
||||
String showValue(String designator, float value, String unit);
|
||||
|
||||
uint16_t getDisplayWidth(void);
|
||||
uint16_t getDisplayHeight(void);
|
||||
|
||||
U8G2_SSD1322* getDisplay(void);
|
||||
|
||||
Reference in New Issue
Block a user