Commit 2a046e0b authored by siguhe's avatar siguhe
Browse files

Added screen functionality with encoders. Should now be ready for testing with Hub

parent 75db4a91
Loading
Loading
Loading
Loading
+35 −11
Original line number Diff line number Diff line
@@ -601,6 +601,7 @@ static void button_event_handler(uint8_t pin_no, uint8_t button_action)

        case LEDBUTTON_BUTTON3:
            position[3]=button_action;
            if(button_action){
                NRF_LOG_INFO("Send button state change.");
                err_code = ble_lbs_on_button_change(m_conn_handle, &m_lbs, position);
                if (err_code != NRF_SUCCESS &&
@@ -610,12 +611,28 @@ static void button_event_handler(uint8_t pin_no, uint8_t button_action)
                {
                    APP_ERROR_CHECK(err_code);
                }
                counter_encoder1=0;
                counter_encoder2=0;
                counter_encoder3=0;
            }
            break;

        default:
            APP_ERROR_HANDLER(pin_no);
            break;
    }
    char char_arr1 [4];
    char char_arr2 [4];
    char char_arr3 [4];
    sprintf(char_arr1, "%d", counter_encoder1);
    sprintf(char_arr2, "%d", counter_encoder2);
    sprintf(char_arr3, "%d", counter_encoder3);
    //screen_clear();
    
    nrf_gfx_screen_fill_custom(p_lcd,GRAY);
    text_print(&char_arr1,100,15);
    text_print(&char_arr2,100,30);
    text_print(&char_arr3,100,45);

}

@@ -688,13 +705,13 @@ static void brackground_set(void)
    nrf_gfx_invert(p_lcd, false);
}

static void text_print(const char * test_text, uint16_t x, uint16_t y)
 void text_print(char * test_text, uint16_t x, uint16_t y)
{
    nrf_gfx_point_t text_start =NRF_GFX_POINT(x,y); //NRF_GFX_POINT(x, nrf_gfx_height_get(p_lcd) - 50);
    APP_ERROR_CHECK(nrf_gfx_print(p_lcd, &text_start, 0, test_text, p_font, true));
}

static void screen_clear(void)
void screen_clear(void)
{
    nrf_gfx_screen_fill(p_lcd, GRAY);
}
@@ -831,8 +848,15 @@ int main(void)
    nrf_gpio_pin_set(0);
    gfx_initialization();
    brackground_set();
    text_print("TEST",2,0);
    text_print("WELCOME TO",2,0);
    text_print("NEOKOMP",2,15);
    nrf_delay_ms(1000);
    screen_clear();
    text_print("POSTITION:",2,0);
    text_print("ROW:",2,15);
    text_print("COLUMN:",2,30);
    text_print("DEPTH:",2,45);
    
    // Enter main loop.
    for (;;)
    {
+2.54 KiB (961 KiB)

File changed.

No diff preview for this file type.

Loading