Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 19, 2022
1 parent 252b864 commit 7e90e88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
*/
#pragma once

/* DGUS implementation written by coldtobi in 2019 for Marlin
* Updated for STM32G0B1RE by Protomosh in 2022
*/
/**
* DGUS implementation written by coldtobi in 2019.
* Updated for STM32G0B1RE by Protomosh in 2022.
*/

#include "config/DGUS_Screen.h"
#include "config/DGUS_Control.h"
Expand All @@ -36,12 +37,9 @@
#define DEBUG_OUT ENABLED(DEBUG_DGUSLCD)
#include "../../../core/debug_out.h"

#define Swap16(val) ((uint16_t)(((uint16_t)(val) >> 8) |\
((uint16_t)(val) << 8)))

// New endienness swap for 32bit mcu (tested with STM32G0B1RE)
// New endianness swap for 32bit mcu (tested with STM32G0B1RE)
#define BE16_P(V) ( ((uint8_t*)(V))[0] << 8U | ((uint8_t*)(V))[1] )
#define BE32_P(V) ( ((uint8_t*)(V))[0] << 24U | ((uint8_t*)(V))[1] << 16U | ((uint8_t*)(V))[2] << 8U | ((uint8_t*)(V))[3] )
#define BE32_P(V) ( ((uint8_t*)(V))[0] << 24U | ((uint8_t*)(V))[1] << 16U | ((uint8_t*)(V))[2] << 8U | ((uint8_t*)(V))[3] )

// Low-Level access to the display.
class DGUSDisplay {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace DGUSRxHandler {
*(T*)vp.extra = (T)data;
break;
}
case 2: {
case 2: {
const uint16_t data = BE16_P(data_ptr);
*(T*)vp.extra = (T)data;
break;
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "DGUSDisplay.h"
#include "definition/DGUS_VP.h"

#define Swap16(val) ((uint16_t)(((uint16_t)(val) >> 8) | ((uint16_t)(val) << 8)))

namespace DGUSTxHandler {

#if ENABLED(SDSUPPORT)
Expand Down

0 comments on commit 7e90e88

Please sign in to comment.