Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔖 Release 8.3.2 #32

Merged
merged 2 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*.bin
*.elf

# Template
template/

# PROS
bin/
.vscode/
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ EXCLUDE_COLD_LIBRARIES:=
# Set this to 1 to add additional rules to compile your project as a PROS library template
IS_LIBRARY:=1
LIBNAME:=liblvgl
VERSION:=8.3.1
VERSION:=8.3.2
# EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c
# this line excludes opcontrol.c and similar files
EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext)))

# files that get distributed to every user (beyond your source archive) - add
# whatever files you want here. This line is configured to add all header files
# that are in the the include directory get exported
TEMPLATE_FILES=$(INCDIR)/display/** $(INCDIR)/pros/llemu.*
TEMPLATE_FILES=$(INCDIR)/liblvgl/**

.DEFAULT_GOAL=quick

Expand Down
12 changes: 11 additions & 1 deletion common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ MFLAGS=-mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=softfp -Os -g
CPPFLAGS=-D_POSIX_THREADS -D_UNIX98_THREAD_MUTEX_ATTRIBUTES -D_POSIX_TIMERS -D_POSIX_MONOTONIC_CLOCK
GCCFLAGS=-ffunction-sections -fdata-sections -fdiagnostics-color -funwind-tables

# Check if the llemu files in libvgl exist. If they do, define macros that the
# llemu headers in the kernel repo can use to conditionally include the libvgl
# versions
ifneq (,$(wildcard ./include/liblvgl/llemu.h))
CPPFLAGS += -D_PROS_INCLUDE_LIBLVGL_LLEMU_H
endif
ifneq (,$(wildcard ./include/liblvgl/llemu.hpp))
CPPFLAGS += -D_PROS_INCLUDE_LIBLVGL_LLEMU_HPP
endif

WARNFLAGS+=-Wno-psabi

SPACE := $() $()
COMMA := ,

C_STANDARD?=gnu11
CXX_STANDARD?=gnu++2a
CXX_STANDARD?=gnu++20

DEPDIR := .d
$(shell mkdir -p $(DEPDIR))
Expand Down
Binary file modified firmware/libpros.a
Binary file not shown.
3 changes: 3 additions & 0 deletions include/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@

#include "pros/adi.h"
#include "pros/colors.h"
#include "pros/device.h"
#include "pros/distance.h"
#include "pros/error.h"
#include "pros/ext_adi.h"
#include "pros/gps.h"
#include "pros/imu.h"
#include "pros/link.h"
#include "pros/llemu.h"
#include "pros/misc.h"
#include "pros/motors.h"
#include "pros/optical.h"
Expand All @@ -68,6 +70,7 @@
#include "pros/gps.hpp"
#include "pros/imu.hpp"
#include "pros/link.hpp"
#include "pros/llemu.hpp"
#include "pros/misc.hpp"
#include "pros/motor_group.hpp"
#include "pros/motors.hpp"
Expand Down
251 changes: 251 additions & 0 deletions include/liblvgl/llemu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
/*
* \file pros/llemu.h
*
* Legacy LCD Emulator
*
* This file defines a high-level API for emulating the three-button, UART-based
* VEX LCD, containing a set of functions that facilitate the use of a software-
* emulated version of the classic VEX LCD module.
*
* Visit https://pros.cs.purdue.edu/v5/tutorials/topical/llemu.html to learn
* more.
*
* This file should not be modified by users, since it gets replaced whenever
* a kernel upgrade occurs.
*
* Copyright (c) 2017-2020, Purdue University ACM SIGBots.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

#ifndef _LIBLVGL_LLEMU_H_
#define _LIBLVGL_LLEMU_H_

#include <errno.h>
#include <stdbool.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#include "liblvgl/lvgl.h"
#pragma GCC diagnostic pop

#ifdef __cplusplus
extern "C" {
namespace pros {
#endif

typedef void (*lcd_btn_cb_fn_t)(void);

#define LCD_BTN_LEFT 4
#define LCD_BTN_CENTER 2
#define LCD_BTN_RIGHT 1

typedef struct lcd_s {
lv_obj_t* frame;
lv_obj_t* screen;
lv_obj_t* lcd_text[8];
lv_obj_t* btn_container;
lv_obj_t* btns[3]; // < 0 => left; 1 => center; 2 => right
lcd_btn_cb_fn_t callbacks[3]; // < 0 => left; 1 => center; 2 => right
volatile uint8_t touch_bits; // < 4 => left; 2 => center; 1 => right (no
// multitouch support)
} lcd_s_t;

typedef enum lcd_text_align_e {
LCD_TEXT_ALIGN_LEFT = 0,
LCD_TEXT_ALIGN_CENTER = 1,
LCD_TEXT_ALIGN_RIGHT = 2
} text_align_e_t;

#ifdef __cplusplus
namespace c {
#endif

/**
* Checks whether the emulated three-button LCD has already been initialized.
*
* \return True if the LCD has been initialized or false if not.
*/
bool lcd_is_initialized(void);

/**
* Creates an emulation of the three-button, UART-based VEX LCD on the display.
*
* \return True if the LCD was successfully initialized, or false if it has
* already been initialized.
*/
bool lcd_initialize(void);

/**
* Turns off the Legacy LCD Emulator.
*
* Calling this function will clear the entire display, and you will not be able
* to call any further LLEMU functions until another call to lcd_initialize.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The LCD has not been initialized. Call lcd_initialize() first.
*
* \return True if the operation was successful, or false otherwise, setting
* errno values as specified above.
*/
bool lcd_shutdown(void);

/**
* Displays a formatted string on the emulated three-button LCD screen.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The LCD has not been initialized. Call lcd_initialize() first.
* EINVAL - The line number specified is not in the range [0-7]
*
* \param line
* The line on which to display the text [0-7]
* \param fmt
* Format string
* \param ...
* Optional list of arguments for the format string
*
* \return True if the operation was successful, or false otherwise, setting
* errno values as specified above.
*/
bool lcd_print(int16_t line, const char* fmt, ...);

/**
* Displays a string on the emulated three-button LCD screen.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The LCD has not been initialized. Call lcd_initialize() first.
* EINVAL - The line number specified is not in the range [0-7]
*
* \param line
* The line on which to display the text [0-7]
* \param text
* The text to display
*
* \return True if the operation was successful, or false otherwise, setting
* errno values as specified above.
*/
bool lcd_set_text(int16_t line, const char* text);

/**
* Clears the contents of the emulated three-button LCD screen.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The LCD has not been initialized. Call lcd_initialize() first.
* EINVAL - The line number specified is not in the range [0-7]
*
* \return True if the operation was successful, or false otherwise, setting
* errno values as specified above.
*/
bool lcd_clear(void);

/**
* Clears the contents of a line of the emulated three-button LCD screen.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The LCD has not been initialized. Call lcd_initialize() first.
* EINVAL - The line number specified is not in the range [0-7]
*
* \param line
* The line to clear
*
* \return True if the operation was successful, or false otherwise, setting
* errno values as specified above.
*/
bool lcd_clear_line(int16_t line);

/**
* Registers a callback function for the leftmost button.
*
* When the leftmost button on the emulated three-button LCD is pressed, the
* user-provided callback function will be invoked.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The LCD has not been initialized. Call lcd_initialize() first.
*
* \param cb
* A callback function of type lcd_btn_cb_fn_t (void (*cb)(void))
*
* \return True if the operation was successful, or false otherwise, setting
* errno values as specified above.
*/
bool lcd_register_btn0_cb(lcd_btn_cb_fn_t cb);

/**
* Registers a callback function for the center button.
*
* When the center button on the emulated three-button LCD is pressed, the
* user-provided callback function will be invoked.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The LCD has not been initialized. Call lcd_initialize() first.
*
* \param cb
* A callback function of type lcd_btn_cb_fn_t (void (*cb)(void))
*
* \return True if the operation was successful, or false otherwise, setting
* errno values as specified above.
*/
bool lcd_register_btn1_cb(lcd_btn_cb_fn_t cb);

/**
* Registers a callback function for the rightmost button.
*
* When the rightmost button on the emulated three-button LCD is pressed, the
* user-provided callback function will be invoked.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The LCD has not been initialized. Call lcd_initialize() first.
*
* \param cb
* A callback function of type lcd_btn_cb_fn_t (void (*cb)(void))
*
* \return True if the operation was successful, or false otherwise, setting
* errno values as specified above.
*/
bool lcd_register_btn2_cb(lcd_btn_cb_fn_t cb);

/**
* Gets the button status from the emulated three-button LCD.
*
* The value returned is a 3-bit integer where 1 0 0 indicates the left button
* is pressed, 0 1 0 indicates the center button is pressed, and 0 0 1
* indicates the right button is pressed. 0 is returned if no buttons are
* currently being pressed.
*
* Note that this function is provided for legacy API compatibility purposes,
* with the caveat that the V5 touch screen does not actually support pressing
* multiple points on the screen at the same time.
*
* \return The buttons pressed as a bit mask
*/
uint8_t lcd_read_buttons(void);
/**
* Changes the alignment of text on the LCD background
*
* \param alignment
* An enum specifying the alignment. Available alignments are:
* TEXT_ALIGN_LEFT
* TEXT_ALIGN_RIGHT
* TEXT_ALIGN_CENTER
*
* \return void
*/
void lcd_set_text_align(text_align_e_t alignment);

#ifdef __cplusplus
} // namespace c
} // namespace pros
} // extern "C"
#endif
#endif // _LIBLVGL_LLEMU_H_
Loading