Code Monkey home page Code Monkey logo

micromenu-v2's People

Contributors

abcminiuser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micromenu-v2's Issues

License/modification

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!

Porting to PIC18

Do you have plans to converting this so it can be used on a PIC?

A Beginner Question

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.