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

Added display character frame #31

Merged
merged 36 commits into from May 17, 2019
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
951b88b
Added display character frame
JensBouman May 10, 2019
eab49c8
Merge branch 'master' into feature-display_character
JensBouman May 13, 2019
fa4b669
Fixed comment and character type
JensBouman May 13, 2019
2a781e3
Removed unnecessary information
JensBouman May 13, 2019
fc8a61a
Changed frame name to represent the size (8x8)
JensBouman May 13, 2019
5a227a2
Internal frame helper error fixed
JensBouman May 14, 2019
b62a22c
Cursor based character display frame types. Added ENUM for claiming c…
JensBouman May 14, 2019
debf438
Added doxygen to the cursor-based frames
JensBouman May 15, 2019
71832b7
Change frame type name for cursor position and color. Also added Inte…
JensBouman May 16, 2019
a0c0e25
Edited Display frame descriptions
JensBouman May 16, 2019
969fb23
Change tabs to spaces
JensBouman May 16, 2019
9c66184
Change frame_type name to reflect the 8x8 font it uses
JensBouman May 16, 2019
1fbc739
Merge branch 'master' into feature-display_character
JensBouman May 16, 2019
dc2b0b0
Changed remaining tabs to spaces
JensBouman May 16, 2019
4b0d85c
Increased character limit to 255 characters
JensBouman May 16, 2019
7975114
Fixed extended frame size. Misunderstood the limit as 256, when in fa…
JensBouman May 16, 2019
b717cf6
Fixed display_cursor datatype and null terminating character limit
JensBouman May 16, 2019
cb7e6ec
Merge branch 'master' into feature-display_character
JensBouman May 16, 2019
c98da93
Merge branch 'master' into feature-display_character
JensBouman May 17, 2019
f857a23
Added R2D2_PACK_STRUCT and changed display_cursor type to uint8_t bec…
JensBouman May 17, 2019
3ed9e25
Merge branch 'feature-display_character' of https://github.com/r2d2-2…
JensBouman May 17, 2019
7d267b5
Removed character array size member, because char arrays are null poi…
JensBouman May 17, 2019
2bede84
Set character frame now accepts more characters
JensBouman May 17, 2019
d9c557d
Merge branch 'master' into feature-display_character
JensBouman May 17, 2019
060e79a
Changed enum name to correctly describe its use
JensBouman May 17, 2019
f5c3eae
Merge branch 'master' into feature-display_character
JensBouman May 17, 2019
58e4beb
Fixed order of size members in struct
JensBouman May 17, 2019
aa158ab
Merge branch 'master' into feature-display_character
JensBouman May 17, 2019
b633204
Merge branch 'master' into feature-display_character
JensBouman May 17, 2019
5a7426a
Add string optimisation
LRstudentHU May 17, 2019
f3d4ec1
Merge branch 'feature-display_character' of https://github.com/R2D2-2…
LRstudentHU May 17, 2019
f28e843
Merge branch 'master' into feature-display_character
JensBouman May 17, 2019
34c9b71
Merge branch 'master' into feature-display_character
JensBouman May 17, 2019
6c6237b
formatted my part of frametype
JensBouman May 17, 2019
83f772e
removed unnecessary comments
JensBouman May 17, 2019
ce2ae41
Added documentation about cursor_id, and renamed cursor-based charact…
JensBouman May 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
119 changes: 115 additions & 4 deletions code/headers/frame_types.hpp
Expand Up @@ -105,6 +105,10 @@ namespace r2d2 {
ACTIVITY_LED_STATE,
DISTANCE,
DISPLAY_FILLED_RECTANGLE,
DISPLAY_8x8_CHARACTER,
DISPLAY_8x8_CURSOR_CHARACTER,
CURSOR_POSITION,
CURSOR_COLOR,
BATTERY_LEVEL,
UI_COMMAND,
MANUAL_CONTROL,
Expand Down Expand Up @@ -263,15 +267,15 @@ namespace r2d2 {
struct frame_distance_s {
uint16_t mm;
};

/**
* Struct to set a rectangle on a display. This fills a
* Struct to set a rectangle on a display. This fills a
* rectangle with the color specified.
*
*
* Currently we can't fill the bigger screens. When the
* extended frames are here the position and width/height
* will change to a uint16_t to support the bigger screens.
*
*
* Display wiki:
* https://github.com/R2D2-2019/R2D2-2019/wiki/Display
*/
Expand All @@ -291,6 +295,98 @@ namespace r2d2 {
uint8_t blue;
};

/**
* Struct to set a single character on a display. This shows
* a colored character at given location. The character
* can be any character from the un-extended
* ascii table (characters 0-127)
*
* Display wiki:
* https://github.com/R2D2-2019/R2D2-2019/wiki/Display
*/
R2D2_PACK_STRUCT
struct frame_display_8x8_character_s {
LRstudentHU marked this conversation as resolved.
Show resolved Hide resolved
// position of character
uint8_t x;
uint8_t y;

// color of pixels
uint8_t red;
uint8_t green;
uint8_t blue;

// The characters to draw
// Last element because of string optimisation
char characters[243];
};

/**
* The display will require each user to claim a cursor
* these can be used to store data (like position
* and color).
*
* Further references to cursor_id will mean this value.
*/
enum claimed_display_cursor : uint8_t {
// Free for any person to use.
OPEN_CURSOR,

// Don't touch
CURSORS_COUNT
};

/**
* Struct to set a character on a display. This shows
* a colored character at given location. The character
* can be any character from the un-extended
* ascii table (characters 0-127)
*
* For now an alternative to x/y and color based character
* drawing.
*/
R2D2_PACK_STRUCT
struct frame_display_8x8_character_via_cursor_s {
// Targets which cursor to write to. This should be one
// your module claimed. The characters will be drawn from the cursor
// position as starting location.
uint8_t cursor_id;

// The characters to draw
// Last element because of string optimisation
char characters[247];
};

/**
* This frame will move the targeted cursor to the
* given position. (0,0) is the upper left corner.
*
*/
R2D2_PACK_STRUCT
struct frame_cursor_position_s {
// Targets which cursor to write to. This should be one
// your module claimed. The targeted cursor will have the new
// x and y values. These are used to draw from.
uint8_t cursor_id;
uint8_t cursor_x;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add what location these cursors have? Direct pixel location or the font location

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed in 83f772e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linked commit doesnt add any documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I hastily made the wrong comment to the wrong change, my bad. I will change it soon.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added more documentation about the cursor_id in ce2ae41. If this isn't what you meant, please say so.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant in hwlib when you write to the screen the location is not directly the pixel you write to. (At leasts when I used it).

So when you wrote to (1, 0) it would write as the second character on the first line. Is this following that principle or can you write to (100, 100) and it will start at pixel (100, 100) and write it from there?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I read it, this is simply pixel position.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay sure then it is probably just me.

uint8_t cursor_y;
};

/**
* This frame will set the targeted cursor color to
* given colors.
*
*/
R2D2_PACK_STRUCT
struct frame_cursor_color_s {
// Targets which cursor to write to. This should be one
// your module claimed. The targeted cursor will have the new color
// values.
uint8_t cursor_id;
uint8_t red;
uint8_t green;
uint8_t blue;
};

/**
* ONLY USABLE IN PYTHON TO PYTHON COMMUNICATION
*
Expand Down Expand Up @@ -444,6 +540,21 @@ namespace r2d2 {
R2D2_INTERNAL_FRAME_HELPER(frame_activity_led_state_s, ACTIVITY_LED_STATE)
R2D2_INTERNAL_FRAME_HELPER(frame_distance_s, DISTANCE)
R2D2_INTERNAL_FRAME_HELPER(frame_display_filled_rectangle_s, DISPLAY_FILLED_RECTANGLE)

R2D2_INTERNAL_FRAME_HELPER(
frame_display_8x8_character_s,
DISPLAY_8x8_CHARACTER,
R2D2_OPTIMISE_STRING(frame_display_8x8_character_s, characters)
)

R2D2_INTERNAL_FRAME_HELPER(
frame_display_8x8_character_via_cursor_s,
DISPLAY_8x8_CURSOR_CHARACTER,
R2D2_OPTIMISE_STRING(frame_display_8x8_character_via_cursor_s, characters)
)

R2D2_INTERNAL_FRAME_HELPER(frame_cursor_position_s, CURSOR_POSITION)
R2D2_INTERNAL_FRAME_HELPER(frame_cursor_color_s, CURSOR_COLOR)
R2D2_INTERNAL_FRAME_HELPER(frame_battery_level_s, BATTERY_LEVEL)
R2D2_INTERNAL_FRAME_HELPER(frame_ui_command_s, UI_COMMAND, R2D2_POISON_TYPE(frame_ui_command_s))
R2D2_INTERNAL_FRAME_HELPER(frame_path_step_s, PATH_STEP)
Expand Down