While i am aware of uGFX (in fact i already worked with it and written some drivers) i thought it would be a good idea to have support for u8g2 lib as well. Does anybody have some implementation working an help me get started. I was thinking of taking the c-source an implementing ChibiOS HAL for the callbacks.
Any information would be appreciated.
Thank you,
Robert
Q: u8g2 lib ported to chibiOS - anybody already started?
- tfAteba
- Posts: 547
- Joined: Fri Oct 16, 2015 11:03 pm
- Location: Strasbourg, France
- Has thanked: 91 times
- Been thanked: 48 times
Re: Q: u8g2 lib ported to chibiOS - anybody already started?
Hi Robert,
I'm not aware of the u8g2 lib, it looks interresting. I will have a close look, because two or tree years ago I started to write a driver to support an oLED LCD with SSD1306 controller. I will try to see if there is more support that what I did.
You can take a look to this topic also, that will give you the link to my git repository if you want to take a look to my code
Have fun: http://www.chibios.com/forum/viewtopic.php?f=16&t=4434
I'm not aware of the u8g2 lib, it looks interresting. I will have a close look, because two or tree years ago I started to write a driver to support an oLED LCD with SSD1306 controller. I will try to see if there is more support that what I did.
You can take a look to this topic also, that will give you the link to my git repository if you want to take a look to my code
Have fun: http://www.chibios.com/forum/viewtopic.php?f=16&t=4434
regards,
Theo.
Theo.
Re: Q: u8g2 lib ported to chibiOS - anybody already started?
Thank you.
I started with porting by making the following steps:
.) made chibios176/u8g2 folder plus u8g2.mk
.) copied all of u8g2/csrc to u8g2/src
.) made new file src/ch_hal.c and ch_hal.h
.) in main.c:
#include "src/ch_hal.h"
u8g2_t u8g2; //global var for display
u8g2_Setup_ssd1306_128x64_noname_f(
&u8g2,
U8G2_R0,
u8g2_ch_spi_byte_cb,
u8g2_ch_gpio_and_delay_cb); // init u8g2 structure
u8g2_InitDisplay(&u8g2); // send init sequence to the display, display is in sleep mode after this,
u8g2_SetPowerSave(&u8g2, 0); // wake up display
u8g2_ClearBuffer(&u8g2);
u8g2_DrawBox(&u8g2, 10,20, 20, 30);
u8g2_SetFont(&u8g2, u8g2_font_ncenB14_tr);
u8g2_DrawStr(&u8g2, 0,15,"Hello World!");
u8g2_SendBuffer(&u8g2);
.) in ch_hal.c:
uint8_t u8g2_ch_gpio_and_delay_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
uint8_t u8g2_ch_spi_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
.) in Makefile include:
include ./u8g2/u8g2.mk
$(U8G2SRC)
$(U8G2INC)
the work is now in ch_hal.c/h where all the os specific delay, io and spi callbacks are.
I made this on a vanilla nucleo 401 project with added shell. It compiles fine for now but, as mentioned, the work is starting now.
As an attachment are the files i made for now.
I started with porting by making the following steps:
.) made chibios176/u8g2 folder plus u8g2.mk
.) copied all of u8g2/csrc to u8g2/src
.) made new file src/ch_hal.c and ch_hal.h
.) in main.c:
#include "src/ch_hal.h"
u8g2_t u8g2; //global var for display
u8g2_Setup_ssd1306_128x64_noname_f(
&u8g2,
U8G2_R0,
u8g2_ch_spi_byte_cb,
u8g2_ch_gpio_and_delay_cb); // init u8g2 structure
u8g2_InitDisplay(&u8g2); // send init sequence to the display, display is in sleep mode after this,
u8g2_SetPowerSave(&u8g2, 0); // wake up display
u8g2_ClearBuffer(&u8g2);
u8g2_DrawBox(&u8g2, 10,20, 20, 30);
u8g2_SetFont(&u8g2, u8g2_font_ncenB14_tr);
u8g2_DrawStr(&u8g2, 0,15,"Hello World!");
u8g2_SendBuffer(&u8g2);
.) in ch_hal.c:
uint8_t u8g2_ch_gpio_and_delay_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
uint8_t u8g2_ch_spi_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
.) in Makefile include:
include ./u8g2/u8g2.mk
$(U8G2SRC)
$(U8G2INC)
the work is now in ch_hal.c/h where all the os specific delay, io and spi callbacks are.
I made this on a vanilla nucleo 401 project with added shell. It compiles fine for now but, as mentioned, the work is starting now.
As an attachment are the files i made for now.
- Attachments
-
- src.zip
- (5.93 KiB) Downloaded 200 times
- tfAteba
- Posts: 547
- Joined: Fri Oct 16, 2015 11:03 pm
- Location: Strasbourg, France
- Has thanked: 91 times
- Been thanked: 48 times
Re: Q: u8g2 lib ported to chibiOS - anybody already started?
Hi Robert,
Good job , I wander why you have use ch_hal.h and ch_hal.c for the work you did with the library.
I will be interrested on this if the support of the I2C is added. This is the interface used on my LCD.
Also, you can take a look on how some third party such as "fatfs" and "lwip" are added into ChibiOS project. I think you can do the same thing with you library.
Good job , I wander why you have use ch_hal.h and ch_hal.c for the work you did with the library.
I will be interrested on this if the support of the I2C is added. This is the interface used on my LCD.
Also, you can take a look on how some third party such as "fatfs" and "lwip" are added into ChibiOS project. I think you can do the same thing with you library.
regards,
Theo.
Theo.
Re: Q: u8g2 lib ported to chibiOS - anybody already started?
I made ch_hal.c/h as abstraction layer between u8g2 library and chibios. You need this according to https://github.com/olikraus/u8g2/wiki/Porting-to-new-MCU-platform.
I that file you need to fill in the function for pin set/reset, delay and hardware interfaces like SPI and I2C.
Tomorrow i can borrow an SPI Display (Nokia 5110) and i can continue. Unfortunately i don't have an i2c display but maybe you can add the functions as soon as i have a working library. with the project i have started it should be quite easy.
cheers,
robert
I that file you need to fill in the function for pin set/reset, delay and hardware interfaces like SPI and I2C.
Tomorrow i can borrow an SPI Display (Nokia 5110) and i can continue. Unfortunately i don't have an i2c display but maybe you can add the functions as soon as i have a working library. with the project i have started it should be quite easy.
cheers,
robert
- tfAteba
- Posts: 547
- Joined: Fri Oct 16, 2015 11:03 pm
- Location: Strasbourg, France
- Has thanked: 91 times
- Been thanked: 48 times
Re: Q: u8g2 lib ported to chibiOS - anybody already started?
Interesting, I also have an old Nokia 5110 spi lcd, so I will be happy to test you work when you will finish.
If necessary, I will also add I2C support at the right time.
Thanks.
If necessary, I will also add I2C support at the right time.
Thanks.
regards,
Theo.
Theo.
Who is online
Users browsing this forum: No registered users and 32 guests