/**
 ******************************************************************************
 * @file           : main.c
 * @author         : Auto-generated by STM32CubeIDE
 * @brief          : Main program body
 ******************************************************************************
 * @attention
 *
 * Copyright (c) 2024 STMicroelectronics.
 * All rights reserved.
 *
 * This software is licensed under terms that can be found in the LICENSE file
 * in the root directory of this software component.
 * If no LICENSE file comes with this software, it is provided AS-IS.
 *
 ******************************************************************************
 */

#include <stdint.h>
#include "STM32F103IO.h"
#include "Keypad.h"
#include "LCD1602.h"



#if !defined(__SOFT_FP__) && defined(__ARM_FP)
  #warning "FPU is not initialized, but the project is compiling for an FPU. Please initialize the FPU before use."
#endif




#define        ROW0       PA4
#define        ROW1       PA5
#define        ROW2       PA6
#define        ROW3       PA7
#define        COL0       PA0
#define        COL1       PA1
#define        COL2       PA2
#define        COL3       PA3

#define        RS         PB8
#define        EN         PB9
#define        D4         PB4
#define        D5         PB5
#define        D6         PB6
#define        D7         PB7




int main(void)
{
	volatile char key;

	keypad_row_pin(ROW0, ROW1, ROW2, ROW3);
	keypad_column_pin(COL0, COL1, COL2, COL3);

	LCD_Init(RS, EN, D4, D5, D6, D7);


  LCD_Cursor(0, 5);
	LCD_String("Keypad");
	LCD_Cursor(1, 0);


	while(1){
		key = keypad();
		if(key){
			LCD_Char(key);
			delay_ms(700);
		}
	}
}