MCB1700_Welcome/Main.c

116 lines
2.2 KiB
C

/*! @file Main.c
@brief app main
@author Hendrik Schutter
@version V1.0
@date 14.11.2020
This file contains the main app function and init.
*/
#include "Welcome.h"
//25x25 Dot Qr Code, 25bits per line (x)
uint32_t au32QrCode[25] =
{
0x1FC897F,
0x105BE41,
0x174E55D,
0x175A85D,
0x174555D,
0x1054B41,
0x1FD557F,
0x1400,
0x1F7DBAA,
0xF08422,
0x15B31B,
0x48E1C1,
0xEFA8D7,
0x15BDCAA,
0x12703FB,
0x1589271,
0x1161DF4,
0x1C918,
0x1FDB557,
0x1042118,
0x175E3F7,
0x1759A5F,
0x1758D0D,
0x1055BB9,
0x1FDD43F
};
static void vMainInitApp(void);
static void vPrintQr(void);
/**
* @fn int main (void)
* @brief app entry point
* @param void
* @return int
* @author hendrik schutter
* @date 14.11.2020
*/
int main (void)
{
vMainInitApp(); //init app
vPrintQr(); //print Qr
while(1) {
//calculate important things (Artificial neural network)
}
}
/**
* @fn void vMainInitApp(void)
* @brief initialize app
* @param void
* @return void
* @author hendrik schutter
* @date 14.11.2020
*/
static void vMainInitApp(void)
{
// Init GLCD
GLCD_Initialize ();
GLCD_SetForegroundColor (GLCD_COLOR_BLACK);
GLCD_SetBackgroundColor (GLCD_COLOR_WHITE);
GLCD_ClearScreen ();
GLCD_SetFont(&GLCD_Font_16x24); // declared as extern in externals.h
GLCD_DrawString (4*GLCD_Font_16x24.width, 5,"fckaf.de/BXm");
// Init LED
LED_Initialize();
}
/**
* @fn static void vPrintQr(void)
* @brief print Qr code from array
* @param void
* @return void
* @author hendrik schutter
* @date 14.11.2020
*/
static void vPrintQr(void) {
uint8_t u8DotSize = 8U;
uint8_t u8Yoffset = 30U;
uint8_t u8Xoffset = 60U;
for(uint8_t y = 0; y < 25; y++) {
for(int8_t x = 0; x < 25; x++) {
if(au32QrCode[y] & (1 << x))
{
//print dots u8DotSize X u8DotSize
for(uint8_t u8DotLine = 0; u8DotLine < u8DotSize; u8DotLine++)
{
//print horizontal line, swap left to right
GLCD_DrawHLine (-(x-24)*u8DotSize+u8Xoffset, y*u8DotSize+u8DotLine+u8Yoffset, u8DotSize);
}
}
}
}
}