Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Board_GLCD.h"
- #include "Board_LED.h"
- #include "stm32f2xx_hal.h"
- #include "GLCD_Config.h"
- #include "JOY.h"
- #include "Serial.h"
- extern GLCD_FONT GLCD_Font_16x24;
- uint32_t fw,fh,dx,dy;
- bool ready;
- /**Initialize the peripherals: Already Done**/
- void setup(void){
- GLCD_Initialize();
- LED_Initialize();
- JOY_Init();
- SER_Init(115200);
- GLCD_SetFont(&GLCD_Font_16x24);
- GLCD_SetBackgroundColor(GLCD_COLOR_PURPLE);
- fw = GLCD_Font_16x24.width;// font width
- fh = GLCD_Font_16x24.height; //font height
- //minimum x position on the screen. Corresponds to column 0
- dx = (GLCD_WIDTH - 16*fw)>>1;
- //minimum y position on the screen. Corresponds to row 0
- dy = (GLCD_HEIGHT - 6 * fh) >> 1;
- //use to prevent Joy stick sampling when the joy stick has not be initialized
- ready = true;
- }
- /**Checks if the direction of the joy stick and move the cursor in the joy stick's direction. If the cursor is at the bounds, cursor will not be moved**/
- void sampleJoystick(void){
- if(!ready)return; //initialization has not completed, abort
- uint32_t key = JOY_GetKeys();
- // Put code here //
- }
- /**Draw ascii characters on the screen**/
- void draw(void){
- GLCD_DrawChar(0, 0, 0x36);
- GLCD_DrawChar(18, 0, 0x39);
- }
- int main(void){
- SystemCoreClockUpdate();
- HAL_Init();
- SysTick_Config(SystemCoreClock/1000);
- setup();
- GLCD_ClearScreen();
- draw();
- // Add Additional lines of code if required //
- while(1){}
- }
- /*SysTick ISR*/
- void SysTick_Handler(void){
- //increment HAL tick variable; this is required for LCD Display Config.
- HAL_IncTick();
- //check for joy stick movement to configure Joystick Sampling
- sampleJoystick();
- }
- /**Highlight the character c in the 16x6 grid **/
- void highlightText(uint32_t c){
- // Put code here //
- }
- /**Convert row and column to actual x y position: p[0] = column p[1] = row **/
- void toPosition(int * p){
- // Put code here //
- }
- /**Fill the array p with the row and column number of the character ch: p[0] column p[1] = row **/
- void getPos(uint32_t ch,int *p){
- // Put code here //
- }
- /**Toggle the LED based on the bits of the character c.
- 1 LED will be turned on
- 0 LED will be turned off **/
- void LED (uint32_t c){
- // Put code here //
- }
- /** Clear any previous highlight and highlight c **/
- void ClearHighlight(uint32_t c){
- // Put code here //
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement