abcminiuser / micromenu-v2 Goto Github PK
View Code? Open in Web Editor NEWTiny text-orientated menu library in C for embedded use.
Tiny text-orientated menu library in C for embedded use.
I would like to use your menu in my projects in a modified form (e. g. for STM32, different naming schema and other changes), but am unsure in which way I'm allowed to modify and publish the modified version on github as a part of the software (obviously including a reference/link to the original work). Are there any restrictions?
Btw: Awesome little project!
Do you have plans to converting this so it can be used on a PIC?
Hello,
I have an ATMega328P-U with MiniCore bootloaded at 16MHz. I would like to use this library but I am having trouble understanding how to utilize this with a SH1106 128x64 I2C device. I am using the u8g2 library to drive the display.
I wasn't able to find any other documentation regarding this library and so I am asking here. I've seen a few posts on AVRFreaks but most of the links are dead.
The idea was to have two push buttons (BUTTON_UP and BUTTON_DOWN) to navigate a menu and display this interaction on the OLED.
Attached is a sample C code (just to test the push buttons to turn on/off an LED).
Please mind the code as I am new to C and AVR architectures, nonetheless I would appreciate feedback on the code structure as well:
....
....
#include <MicroMenu.h>
#include <u8g2.h>
#include <u8x8_avr.h>
#define SH1106_ADDR 0x78
// pin definitions
#define BUTTON_UP PINB1
#define BUTTON_DOWN PINB2
u8g2_t u8g2;
int main(void)
{
// outputs
// led
DDRB |= 1 << PINB0; // output PB0
PORTB ^= 1 << PINB0; // toggle only PIN 0 on PORTB
// inputs
// buttons
DDRB &= ~(1 << BUTTON_UP); // input PB1
DDRB &= ~(1 << BUTTON_DOWN); // input PB2
// button status
PORTB |= 1 << BUTTON_UP; // set PB1 to high reading
PORTB |= 1 << BUTTON_DOWN; // set PB2 to high reading
int pressed = 0;
// oled sh1106 i2c setup
u8g2_ClearBuffer(&u8g2);
u8g2_Setup_sh1106_i2c_128x64_noname_f(&u8g2, U8G2_R0, u8x8_byte_avr_hw_i2c, u8x8_avr_delay);
u8g2_InitInterface(&u8g2);
u8g2_SetI2CAddress(&u8g2, SH1106_ADDR);
u8g2_InitDisplay(&u8g2);
u8g2_SetPowerSave(&u8g2, 0);
u8g2_SetFont(&u8g2, u8g2_font_smart_patrol_nbp_tr);
u8g2_SetFontRefHeightText(&u8g2);
u8g2_SetFontPosTop(&u8g2);
u8g2_DrawStr(&u8g2, 0, 0, "u8g2 AVR HW I2C");
u8g2_SendBuffer(&u8g2);
while (1)
{
// turn on led
if (bit_is_clear(PINB, 1)){
if (pressed == 0){
u8g2_ClearBuffer(&u8g2);
u8g2_DrawStr(&u8g2, 0, 0, "LED ON");
u8g2_SendBuffer(&u8g2);
PORTB ^= 1 << PINB0;
pressed = 1;
}
}
// turn off led
else if (bit_is_clear(PINB, 2)){
if (pressed == 1){
u8g2_ClearBuffer(&u8g2);
u8g2_DrawStr(&u8g2, 0, 0, "LED OFF");
u8g2_SendBuffer(&u8g2);
PORTB |= 1 << PINB0;
pressed = 0;
}
}
}
}
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.