Browse Source

Correction

remy 5 năm trước cách đây
mục cha
commit
f7e9afd00d
10 tập tin đã thay đổi với 191 bổ sung365 xóa
  1. 4 4
      Include/Eeprom.h
  2. 34 0
      Include/FIFO_COM.h
  3. 19 6
      Include/Heure.h
  4. 7 23
      Include/RTC.h
  5. 0 96
      Include/lcd.h
  6. 1 1
      Source/Eeprom.c
  7. 51 0
      Source/FIFO_COM.c
  8. 24 26
      Source/Heure.c
  9. 51 44
      Source/RTC.c
  10. 0 165
      Source/lcd.c

+ 4 - 4
Include/Eeprom.h

@@ -21,11 +21,11 @@
 
 #define EepromADD 0XA0
 
-typedef struct{
+typedef struct {
 	I2C_HandleTypeDef I2C;
 	GPIO_TypeDef WC_PORT;
 	uint16_t WC_PIN;
-}EEprom_HandleTypeDef;
+} EEprom_HandleTypeDef;
 
 EEprom_HandleTypeDef EEprom;
 
@@ -41,12 +41,12 @@ void writePointerLecture(uint16_t p);
 
 /** Public Fonction*/
 
-void initEprom(I2C_HandleTypeDef typ,GPIO_TypeDef port, uint16_t pin);
+void initEprom(I2C_HandleTypeDef typ, GPIO_TypeDef port, uint16_t pin);
 
 void writeData(uint16_t add, uint8_t *tab, uint8_t size);
 
 void readData(uint16_t add, uint8_t *tab, uint8_t size);
 
-void testEeprom();//fonction pour tester le hard de l'Eeprom
+void testEeprom(); //fonction pour tester le hard de l'Eeprom
 
 #endif /* EEPROM_H_ */

+ 34 - 0
Include/FIFO_COM.h

@@ -0,0 +1,34 @@
+#ifndef _FIFO_COM_H_
+#define _FIFO_COM_H_
+
+#include <stdint.h>
+
+#define NBFIFO 128
+
+typedef struct{
+	uint8_t Fifo[NBFIFO];
+
+	uint8_t pt_read;
+
+	uint8_t pt_write;
+}FIFO_COM;
+
+
+void initFIFO(FIFO_COM *f);
+
+/*
+ * lit le premiere element de la fifo, n'avance pas le pointeur de Fifo
+ */
+uint8_t readFirst(FIFO_COM *f);
+
+void readFifo(FIFO_COM *f, uint8_t *r, uint8_t nb);
+
+void writeFifo(FIFO_COM *f, uint8_t *r, uint8_t nb);
+
+/*
+ * retourne le nombre d'element a lire dans la fifo
+ */
+uint8_t FIFO_nbRead(FIFO_COM *f);
+
+
+#endif /* _FIFO_COM_H_ */

+ 19 - 6
Include/Heure.h

@@ -8,7 +8,24 @@
 #ifndef HEURE_H_
 #define HEURE_H_
 
-#include "RTC.h"
+#include <stdint.h>
+
+typedef struct {
+
+	uint8_t second;
+	uint8_t minute;
+	uint8_t heure;
+	uint8_t jour;
+	uint8_t joursemaine;
+	uint8_t mois;
+	uint16_t annee;
+
+} Date;
+
+typedef struct {
+	uint8_t minute;
+	uint8_t heure;
+} Heure;
 
 /**
  * fonction qui renvoie
@@ -16,11 +33,7 @@
  * 	0 si h1 et h2 egale
  * 	1 si h1 est sup�rieur a h2
  */
-int8_t CompareHeure(Heure h1,Heure h2);
-
-void HeureAjout(Heure res,Heure h1,uint8_t Pente);
-
-void HeureSuppr(Heure res,Heure h1,uint8_t Pente);
+int8_t CompareHeure(Heure h1, Heure h2);
 
 int16_t DiffHeure(Heure h1, Heure h2);
 

+ 7 - 23
Include/RTC.h

@@ -4,7 +4,7 @@
  *  Created on: 14 janv. 2019
  *      Author: e_rcluze
  *
- * Penser a ajouter les fonction de lecture ecriture dans le fichier i2c.c "générer"
+ * Penser a ajouter les fonction de lecture ecriture dans le fichier i2c.c "g�n�rer"
  *
  *
  *
@@ -31,7 +31,7 @@ void writeRTC(uint8_t add, uint8_t *tab, int len){
 #ifndef RTC_H
 #define RTC_H
 
-#include <stdint.h>
+#include "Heure.h"
 #include "i2c.h"
 
 #define RTC_ADD 0XD0
@@ -57,25 +57,7 @@ void writeRTC(uint8_t add, uint8_t *tab, int len){
 #define ANALOG_CALIBRATION	0X12
 #define SQW					0X13
 
-typedef struct {
-
-	uint8_t second;
-	uint8_t minute;
-	uint8_t heure;
-	uint8_t jour;
-	uint8_t joursemaine;
-	uint8_t mois;
-	uint16_t annee;
-
-}Date;
-
-typedef struct {
-	uint8_t minute;
-	uint8_t heure;
-}Heure;
-
-
-I2C_HandleTypeDef I2C_RTC;
+I2C_HandleTypeDef *I2C_RTC;
 
 /****Private fonction */
 void readRTC(uint8_t reg, uint8_t *tab, int len);
@@ -83,10 +65,12 @@ void readRTC(uint8_t reg, uint8_t *tab, int len);
 void writeRTC(uint8_t reg, uint8_t *tab, int len);
 
 /** Public Fonction*/
-void initRTC(I2C_HandleTypeDef typ);
+void initRTC(I2C_HandleTypeDef *typ);
 
 void readHeure(Heure *heure);
 
+uint16_t HeureEnMinute();
+
 void readDate(Date *date);
 
 void redemareRTC();
@@ -94,7 +78,7 @@ void redemareRTC();
 void writeDate(Date *date);
 
 /**
- * Fonction qui permet de tester le matériel
+ * Fonction qui permet de tester le mat�riel
  */
 void testRTC();
 

+ 0 - 96
Include/lcd.h

@@ -1,96 +0,0 @@
-/*
- * lcd.h
- *
- *  Created on: 10/06/2018
- *      Author: Olivier Van den Eede
- */
-
-#ifndef LCD_H_
-#define LCD_H_
-
-#include "stm32f4xx_hal.h"
-#include "string.h"
-#include "main.h"
-
-// #define LCD20xN 		// For 20xN LCDs
-#define LCD16xN			// For 16xN LCDs
-
-// For row start addresses
-extern const uint8_t ROW_16[];
-extern const uint8_t ROW_20[];
-
-/************************************** Command register **************************************/
-#define CLEAR_DISPLAY 0x01
-
-#define RETURN_HOME 0x02
-
-#define ENTRY_MODE_SET 0x04
-#define OPT_S	0x01					// Shift entire display to right
-#define OPT_INC 0x02					// Cursor increment
-
-#define DISPLAY_ON_OFF_CONTROL 0x08
-#define OPT_D	0x04					// Turn on display
-#define OPT_C	0x02					// Turn on cursor
-#define OPT_B 	0x01					// Turn on cursor blink
-
-#define CURSOR_DISPLAY_SHIFT 0x10		// Move and shift cursor
-#define OPT_SC 0x08
-#define OPT_RL 0x04
-
-#define FUNCTION_SET 0x20
-#define OPT_DL 0x10						// Set interface data length
-#define OPT_N 0x08						// Set number of display lines
-#define OPT_F 0x04						// Set alternate font
-
-#define SET_DDRAM_ADDR 0x80				// Set DDRAM address
-
-
-/************************************** Helper macros **************************************/
-#define DELAY(X) HAL_Delay(X)
-
-
-/************************************** LCD defines **************************************/
-#define LCD_NIB 4
-#define LCD_BYTE 8
-#define LCD_DATA_REG 1
-#define LCD_COMMAND_REG 0
-
-
-/************************************** LCD typedefs **************************************/
-#define Lcd_PortType GPIO_TypeDef*
-#define Lcd_PinType uint16_t
-
-typedef enum {
-	LCD_4_BIT_MODE,
-	LCD_8_BIT_MODE
-} Lcd_ModeTypeDef;
-
-
-typedef struct {
-	Lcd_PortType * data_port;
-	Lcd_PinType * data_pin;
-
-	Lcd_PortType rs_port;
-	Lcd_PinType rs_pin;
-
-	Lcd_PortType en_port;
-	Lcd_PinType en_pin;
-
-	Lcd_ModeTypeDef mode;
-
-} Lcd_HandleTypeDef;
-
-
-/************************************** Public functions **************************************/
-void Lcd_init(Lcd_HandleTypeDef * lcd);
-void Lcd_int(Lcd_HandleTypeDef * lcd, int number);
-void Lcd_string(Lcd_HandleTypeDef * lcd, char * string);
-void Lcd_cursor(Lcd_HandleTypeDef * lcd, uint8_t row, uint8_t col);
-Lcd_HandleTypeDef Lcd_create(
-		Lcd_PortType port[], Lcd_PinType pin[],
-		Lcd_PortType rs_port, Lcd_PinType rs_pin,
-		Lcd_PortType en_port, Lcd_PinType en_pin, Lcd_ModeTypeDef mode);
-
-
-
-#endif /* LCD_H_ */

+ 1 - 1
Source/Eeprom.c

@@ -1,4 +1,4 @@
-#include "Eeprom.h"
+#include <Eeprom.h>
 
 /****Private fonction */
 

+ 51 - 0
Source/FIFO_COM.c

@@ -0,0 +1,51 @@
+/*
+ * FIFO_COM.c
+ *
+ *  Created on: 14 mai 2019
+ *      Author: e_rcluze
+ */
+
+#include "FIFO_COM.h"
+
+void initFIFO(FIFO_COM *f){
+	f->pt_read = 0;
+	f->pt_write = 0;
+}
+
+uint8_t readFirst(FIFO_COM *f) {
+	return f->Fifo[f->pt_read];
+}
+
+void readFifo(FIFO_COM *f, uint8_t *r, uint8_t nb) {
+	for (uint8_t i = 0; i < nb;i++) {
+		if (f->pt_read + i >= NBFIFO)
+			r[i] = f->Fifo[f->pt_read + i - NBFIFO];
+		else
+			r[i] = f->Fifo[f->pt_read + i];
+	}
+	if (f->pt_read + nb >= NBFIFO)
+		f->pt_read = f->pt_read + nb - NBFIFO;
+	else
+		f->pt_read = f->pt_read + nb;
+}
+
+void writeFifo(FIFO_COM *f, uint8_t *r, uint8_t nb) {
+	uint8_t i;
+	for (i = 0; i < nb;i++) {
+		if (f->pt_write + i >= NBFIFO)
+			f->Fifo[f->pt_write + i - NBFIFO] = r[i];
+		else
+			f->Fifo[f->pt_write + i] = r[i];
+	}
+	if (f->pt_write + nb >= NBFIFO)
+		f->pt_write = f->pt_write + nb - NBFIFO;
+	else
+		f->pt_write = f->pt_write + nb;
+}
+
+uint8_t FIFO_nbRead(FIFO_COM *f) {
+	if (f->pt_read <= f->pt_write)
+		return f->pt_write - f->pt_read;
+	else
+		return f->pt_write + NBFIFO - f->pt_read;
+}

+ 24 - 26
Source/Heure.c

@@ -7,48 +7,46 @@
 
 #include "RTC.h"
 
-int8_t CompareHeure(Heure h1,Heure h2){
+int8_t CompareHeure(Heure h1, Heure h2) {
 
-	if( h1.heure==h2.heure){
-		if (h1.minute==h2.minute)
+	if (h1.heure == h2.heure) {
+		if (h1.minute == h2.minute)
 			return 0;
-		else if (h1.minute<h2.minute)
+		else if (h1.minute < h2.minute)
 			return -1;
 		else
 			return 1;
-	}
-	else if (h1.heure<h2.heure)
+	} else if (h1.heure < h2.heure)
 		return -1;
 	else
 		return 1;
 }
 
-void HeureAjout(Heure res,Heure h1,uint8_t Pente){
-	uint8_t minute=h1.minute+Pente;
-	res.heure=h1.heure+minute/60;
-	res.minute=minute%60;
+void HeureAjout(Heure res, Heure h1, uint8_t Pente) {
+	uint8_t minute = h1.minute + Pente;
+	res.heure = h1.heure + minute / 60;
+	res.minute = minute % 60;
 }
 
-void HeureSuppr(Heure res,Heure h1,uint8_t Pente){
-	int8_t minute=h1.minute-Pente;
-	if (minute<0) {
-		res.heure=h1.heure-1;
-		res.minute=minute+60;
-	}
-	else {
-		res.heure=h1.heure;
-		res.minute=minute;
+void HeureSuppr(Heure res, Heure h1, uint8_t Pente) {
+	int8_t minute = h1.minute - Pente;
+	if (minute < 0) {
+		res.heure = h1.heure - 1;
+		res.minute = minute + 60;
+	} else {
+		res.heure = h1.heure;
+		res.minute = minute;
 	}
 }
 
-int16_t DiffHeure(Heure h1, Heure h2){
-	return ((h1.heure-h2.heure)*60)+(h1.minute-h2.minute);
+int16_t DiffHeure(Heure h1, Heure h2) {
+	return ((h1.heure - h2.heure) * 60) + (h1.minute - h2.minute);
 }
 
-int32_t DiffDate(Date h1, Date h2){
+int32_t DiffDate(Date h1, Date h2) {
 	int32_t min = h1.minute - h2.minute;
-	int32_t heure = (h1.heure - h2.heure)*60;
-	int32_t jour = (h1.jour - h2.jour)*24*60;
-	int32_t annee = (h1.annee - h2.annee)*24*60*365;
-	return min+heure+jour+annee;
+	int32_t heure = (h1.heure - h2.heure) * 60;
+	int32_t jour = (h1.jour - h2.jour) * 24 * 60;
+	int32_t annee = (h1.annee - h2.annee) * 24 * 60 * 365;
+	return min + heure + jour + annee;
 }

+ 51 - 44
Source/RTC.c

@@ -8,74 +8,75 @@
 #include "RTC.h"
 
 /** Private Fonction*/
-void readRTC(uint8_t reg, uint8_t *tab, int len){
-	HAL_I2C_Master_Transmit(&I2C_RTC,RTC_ADD,&reg,1,1000);
-	HAL_I2C_Master_Receive(&I2C_RTC,RTC_ADD,tab,len,1000);
+void readRTC(uint8_t reg, uint8_t *tab, int len) {
+
+	HAL_StatusTypeDef res = HAL_I2C_Master_Transmit(I2C_RTC, RTC_ADD, &reg, 1, 10000);
+	res = HAL_I2C_Master_Receive(I2C_RTC, RTC_ADD, tab, len, 1000);
 }
 
-void writeRTC(uint8_t reg, uint8_t *tab, int len){
-	uint8_t t[len+1];
-	t[0]=reg;
-	for(int i=0;i<len;i++)
-		t[i+1]=tab[i];
-	HAL_I2C_Master_Transmit(&I2C_RTC,RTC_ADD,t,len+1,1000);
+void writeRTC(uint8_t reg, uint8_t *tab, int len) {
+	uint8_t t[len + 1];
+	t[0] = reg;
+	for (int i = 0; i < len; i++)
+		t[i + 1] = tab[i];
+	HAL_I2C_Master_Transmit(I2C_RTC, RTC_ADD, t, len + 1, 1000);
 }
 
 /** Public Fonction*/
 
-void initRTC(I2C_HandleTypeDef typ){
+void initRTC(I2C_HandleTypeDef *typ) {
 	I2C_RTC = typ;
 }
 
-void readHeure(Heure *heure){
+void readHeure(Heure *heure) {
 	uint8_t tab[2];
-	readRTC(MINUTES,tab,2);
-	heure->minute = (((tab[0]&0x70)>>4)*10)+(tab[0]&0X0F);
-	heure->heure = (((tab[1]&0X30)>>4)*10)+(tab[1]&0X0F);
+	readRTC(MINUTES, tab, 2);
+	heure->minute = (((tab[0] & 0x70) >> 4) * 10) + (tab[0] & 0X0F);
+	heure->heure = (((tab[1] & 0X30) >> 4) * 10) + (tab[1] & 0X0F);
 }
 
 /** Public Fonction*/
-void readDate(Date *date){
+void readDate(Date *date) {
 	uint8_t tab[7];
-	readRTC(SECOND,tab,7);
-	date->second=(((tab[0]&0X70)>>4)*10)+(tab[0]&0X0F);
-	date->minute=(((tab[1]&0x70)>>4)*10)+(tab[1]&0X0F);
-	date->heure=(((tab[2]&0X30)>>4)*10)+(tab[2]&0X0F);
-	date->jour=(((tab[4]&0X30)>>4)*10)+(tab[4]&0X0F);
-	date->mois=(((tab[5]&0X10)>>4)*10)+(tab[5]&0X0F);
-	date->annee=((tab[6]>>4)*10)+(tab[6]&0X0F);
+	readRTC(SECOND, tab, 7);
+	date->second = (((tab[0] & 0X70) >> 4) * 10) + (tab[0] & 0X0F);
+	date->minute = (((tab[1] & 0x70) >> 4) * 10) + (tab[1] & 0X0F);
+	date->heure = (((tab[2] & 0X30) >> 4) * 10) + (tab[2] & 0X0F);
+	date->jour = (((tab[4] & 0X30) >> 4) * 10) + (tab[4] & 0X0F);
+	date->mois = (((tab[5] & 0X10) >> 4) * 10) + (tab[5] & 0X0F);
+	date->annee = ((tab[6] >> 4) * 10) + (tab[6] & 0X0F);
 }
 
-void writeDate(Date *date){
+void writeDate(Date *date) {
 	uint8_t tab[7];
 
-	tab[0]=((date->second/10)<<4) + (date->second%10);
-	tab[1]=((date->minute/10)<<4) + (date->minute%10);
-	tab[2]=((date->heure/10)<<4) + (date->heure%10);
-	tab[3]=date->joursemaine;
-	tab[4]=((date->jour/10)<<4) + (date->jour%10);
-	tab[5]=((date->mois/10)<<4) + (date->mois%10);
-	tab[6]=((date->annee/10)<<4) + (date->annee%10);
+	tab[0] = ((date->second / 10) << 4) + (date->second % 10);
+	tab[1] = ((date->minute / 10) << 4) + (date->minute % 10);
+	tab[2] = ((date->heure / 10) << 4) + (date->heure % 10);
+	tab[3] = date->joursemaine;
+	tab[4] = ((date->jour / 10) << 4) + (date->jour % 10);
+	tab[5] = ((date->mois / 10) << 4) + (date->mois % 10);
+	tab[6] = ((date->annee / 10) << 4) + (date->annee % 10);
 
-	writeRTC(SECOND,tab,7);
+	writeRTC(SECOND, tab, 7);
 }
 
-void redemareRTC(){
+void redemareRTC() {
 	uint8_t pt[1];
-	readRTC(ALARM_HOURS,pt,1);
-	pt[0]=pt[0]&!0x40;
-	writeRTC(ALARM_HOURS,pt,1);
+	readRTC(ALARM_HOURS, pt, 1);
+	pt[0] = pt[0] & !0x40;
+	writeRTC(ALARM_HOURS, pt, 1);
 }
 
-void testRTC(){
+void testRTC() {
 	Date d;
-	d.annee=2020;
-	d.mois=1;
-	d.jour=20;
-	d.joursemaine=1;
-	d.heure=14;
-	d.minute=0;
-	d.second=0;
+	d.annee = 2020;
+	d.mois = 1;
+	d.jour = 20;
+	d.joursemaine = 1;
+	d.heure = 14;
+	d.minute = 0;
+	d.second = 0;
 	writeDate(&d);
 	redemareRTC();
 	HAL_Delay(2000);
@@ -83,7 +84,13 @@ void testRTC(){
 	HAL_Delay(1);
 }
 
-void testBatteryRTC(){
+uint16_t HeureEnMinute() {
+	Heure h;
+	readHeure(&h);
+	return h.minute+h.heure*60;
+}
+
+void testBatteryRTC() {
 	redemareRTC();
 	Date d;
 	readDate(&d);

+ 0 - 165
Source/lcd.c

@@ -1,165 +0,0 @@
-/*
- * lcd.c
- *
- *  Created on: 10/06/2018
- *      Author: Olivier Van den Eede
- */
-
-#include "lcd.h"
-#include <stdio.h>
-
-const uint8_t ROW_16[] = {0x00, 0x40, 0x10, 0x50};
-const uint8_t ROW_20[] = {0x00, 0x40, 0x14, 0x54};
-/************************************** Static declarations **************************************/
-
-static void lcd_write_data(Lcd_HandleTypeDef * lcd, uint8_t data);
-static void lcd_write_command(Lcd_HandleTypeDef * lcd, uint8_t command);
-static void lcd_write(Lcd_HandleTypeDef * lcd, uint8_t data, uint8_t len);
-
-
-/************************************** Function definitions **************************************/
-
-/**
- * Create new Lcd_HandleTypeDef and initialize the Lcd
- */
-Lcd_HandleTypeDef Lcd_create(
-		Lcd_PortType port[], Lcd_PinType pin[],
-		Lcd_PortType rs_port, Lcd_PinType rs_pin,
-		Lcd_PortType en_port, Lcd_PinType en_pin, Lcd_ModeTypeDef mode)
-{
-	Lcd_HandleTypeDef lcd;
-
-	lcd.mode = mode;
-
-	lcd.en_pin = en_pin;
-	lcd.en_port = en_port;
-
-	lcd.rs_pin = rs_pin;
-	lcd.rs_port = rs_port;
-
-	lcd.data_pin = pin;
-	lcd.data_port = port;
-
-	Lcd_init(&lcd);
-
-	return lcd;
-}
-
-/**
- * Initialize 16x2-lcd without cursor
- */
-void Lcd_init(Lcd_HandleTypeDef * lcd)
-{
-	if(lcd->mode == LCD_4_BIT_MODE)
-	{
-			lcd_write_command(lcd, 0x33);
-			lcd_write_command(lcd, 0x32);
-			lcd_write_command(lcd, FUNCTION_SET | OPT_N);				// 4-bit mode
-	}
-	else
-		lcd_write_command(lcd, FUNCTION_SET | OPT_DL | OPT_N);
-
-
-	lcd_write_command(lcd, CLEAR_DISPLAY);						// Clear screen
-	lcd_write_command(lcd, DISPLAY_ON_OFF_CONTROL | OPT_D);		// Lcd-on, cursor-off, no-blink
-	lcd_write_command(lcd, ENTRY_MODE_SET | OPT_INC);			// Increment cursor
-}
-
-/**
- * Write a number on the current position
- */
-void Lcd_int(Lcd_HandleTypeDef * lcd, int number)
-{
-	char buffer[11];
-	sprintf(buffer, "%d", number);
-
-	Lcd_string(lcd, buffer);
-}
-
-/**
- * Write a string on the current position
- */
-void Lcd_string(Lcd_HandleTypeDef * lcd, char * string)
-{
-	for(uint8_t i = 0; i < strlen(string); i++)
-	{
-		lcd_write_data(lcd, string[i]);
-	}
-}
-
-/**
- * Set the cursor position
- */
-void Lcd_cursor(Lcd_HandleTypeDef * lcd, uint8_t row, uint8_t col)
-{
-	#ifdef LCD20xN
-	lcd_write_command(lcd, SET_DDRAM_ADDR + ROW_20[row] + col);
-	#endif
-
-	#ifdef LCD16xN
-	lcd_write_command(lcd, SET_DDRAM_ADDR + ROW_16[row] + col);
-	#endif
-}
-
-/**
- * Clear the screen
- */
-void Lcd_clear(Lcd_HandleTypeDef * lcd) {
-	lcd_write_command(lcd, CLEAR_DISPLAY);
-}
-
-
-/************************************** Static function definition **************************************/
-
-/**
- * Write a byte to the command register
- */
-void lcd_write_command(Lcd_HandleTypeDef * lcd, uint8_t command)
-{
-	HAL_GPIO_WritePin(lcd->rs_port, lcd->rs_pin, LCD_COMMAND_REG);		// Write to command register
-
-	if(lcd->mode == LCD_4_BIT_MODE)
-	{
-		lcd_write(lcd, (command >> 4), LCD_NIB);
-		lcd_write(lcd, command & 0x0F, LCD_NIB);
-	}
-	else
-	{
-		lcd_write(lcd, command, LCD_BYTE);
-	}
-
-}
-
-/**
- * Write a byte to the data register
- */
-void lcd_write_data(Lcd_HandleTypeDef * lcd, uint8_t data)
-{
-	HAL_GPIO_WritePin(lcd->rs_port, lcd->rs_pin, LCD_DATA_REG);			// Write to data register
-
-	if(lcd->mode == LCD_4_BIT_MODE)
-	{
-		lcd_write(lcd, data >> 4, LCD_NIB);
-		lcd_write(lcd, data & 0x0F, LCD_NIB);
-	}
-	else
-	{
-		lcd_write(lcd, data, LCD_BYTE);
-	}
-
-}
-
-/**
- * Set len bits on the bus and toggle the enable line
- */
-void lcd_write(Lcd_HandleTypeDef * lcd, uint8_t data, uint8_t len)
-{
-	for(uint8_t i = 0; i < len; i++)
-	{
-		HAL_GPIO_WritePin(lcd->data_port[i], lcd->data_pin[i], (data >> i) & 0x01);
-	}
-
-	HAL_GPIO_WritePin(lcd->en_port, lcd->en_pin, 1);
-	DELAY(1);
-	HAL_GPIO_WritePin(lcd->en_port, lcd->en_pin, 0); 		// Data receive on falling edge
-}