- D7 connected to A1 with a wire (Reset of Display)
- Display (MikroElektronika oled_c v101, SSD1351) in Slot 1 of Click Board
- LDC1000 in Slot 2 of Click Board
- USART Initalized
- USART DMA Channels configured and Inizalized
- TIM6, TIM7 Initalized
- LDC_CS_GPIO_Port --> LOW
- OLED_CS_GPIO_Port --> LOW
applicationInit (&hspi1, LDC_CS_GPIO_Port, LDC_CS_Pin);
enableInterrupt (&hspi1, LDC_CS_GPIO_Port, LDC_CS_Pin, 5500, 8500);
oled_c = (OLED_C *)malloc(sizeof(OLED_C));
OLED_C_Init_Struct(oled_c, &hspi1);
oled_c_init(oled_c);
oled_c_set_font(guiFont_Tahoma_10_Regular, WHITE, 0 );
prioOnly = false;
isSoftwareInt = false;
DISPLAY_TIME = 30000;
messageToDisplay = (uint8_t *)malloc((10 + MAX_PAYLOAD_LENGTH) * sizeof(uint8_t));
currTime = (RTC_TimeTypeDef*)malloc(sizeof(RTC_TimeTypeDef));
currDate = (RTC_DateTypeDef*)malloc(sizeof(RTC_DateTypeDef));
initGAMER(&huart2, messageToDisplay);
HAL_TIM_Base_Start_IT(&htim6);
// Print Coins after startup
printCoins(messageToDisplay);
// Send menu on startup via UART
printMenu(&huart2);
-----------------------------------------
-------Welcome to our MCSD Project-------
-----------------------------------------
/$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$$$
| $$ | $$ /$$__ $$ /$$__ $$|__ $$__/
| $$ | $$| $$ \ $$| $$ \__/ | $$
| $$$$$$$$| $$$$$$$$| $$$$$$ | $$
| $$__ $$| $$__ $$ \____ $$ | $$
| $$ | $$| $$ | $$ /$$ \ $$ | $$
| $$ | $$| $$ | $$| $$$$$$/ | $$
|__/ |__/|__/ |__/ \______/ |__/
-----------------------------------------
Your options are:
#g Receive the current amount of coins
#a Send an Answer
#m Send a message
#e Send an error
#r Reset amount of coins
#d Display number of coins on Display
#s...
#sc Set amount of coins
#st Set time and date YYYY-MM-DD-hh:mm:ss
#sd Set delay time that messages
are displayed between 25 and 60
#? Show this menu again."
-----------------------------------------
If a command with invalid content is send, then the gamer protocol sends an error and the needed format.
prioOnly: flag that indicates that only messages with prio can be displayed
isSoftwareInt: flag that needs to be set to ensure the Software Interrupt is only triggered on purpose
Coin Counter: 0
On Time: 00-00-00:00:00
A coin is inserted or the display Coin command #d\0
is sent via UART so the coin count is displayed for 30 seconds (default) or for a specified time between 25 and 60 seconds.
The displayed format is MM-DD-hh:mm:ss
. As the RTC uses a calendar internally, the Month starts with 1 and ends with 12.
A message is recieved over UART and displayed on the display for the configured timeinterval. If the message is longer then the display, it scrolls in 1px steps every delayT
ms.
uint16_t delayT = (uint16_t)((DISPLAY_TIME - (SCROLL_DELAY + 2000)) / 128);
Fits display:
Does not fit display:
Linebreaks are added automatically if a word is to long.
Diplaytime: configurable over UART using #sdxx\0
, where xx is in seconds and has to be between 25 and 60.
Description | char |
---|---|
Beginn of Message | # |
Get Number of coins | g |
Answer to message | a |
Post message | m |
Error message | e |
Reset coin counter | r |
Set coins | sc |
Set display delay | sd |
Set time | st |
Display coins | d |
Display help message | ? |
End of message | \0 |
Example messages:
Description | message |
---|---|
Answer message | #aPAYLOAD\0 |
Post message | #mLorem Ipsum dolor sit amet\0 |
Get message | #g\0 |
Error message | #eERRORMESSAGE\0 |
Reset message | #r\0 |
Display coins message | #d\0 |
Set coins message | #sc1000\0 |
Set display delay message | #sd59\0 |
Set time message | #st2022-02-04-10:30:50\0 |
Help message | #?\0 |
Exceeding payload length: error
Violation of the protocol: error
A answer message is recieved by the microcontroller. This displays the message answer: 'message' for the configured time interval.