Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
moabdelwahab6611 authored Jul 20, 2023
1 parent e86b34c commit 98812c1
Show file tree
Hide file tree
Showing 41 changed files with 21,229 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# .gitignore file

# MPLAB X IDE (Netbeans) specific
**/*.X/~*.*
**/*.X/build/
**/*.X/debug/
**/*.X/dist/
**/*.X/disassembly/
**/*.X/.generated_files/
**/*.X/nbproject/private/
**/*.X/nbproject/*.mk
**/*.X/nbproject/*.bash
**/*.X/nbproject/Makefile-genesis.properties

# Object files
*.o
*.ko
*.obj
*.elf

# Executables
*.exe


# KDE specific
.directory

# Misc
.svn
*.bak
42 changes: 42 additions & 0 deletions EEPROM_24C02C.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* File : EEPROM_24C02C.c
* Author : Mohamed Ahmed Abdel Wahab
* LinkedIn : https://www.linkedin.com/in/mohamed-abdel-wahab-162413253/
* Github : https://github.com/moabdelwahab6611
* Created on June 19, 2023, 10:18 PM
*/

/**************************Includes-Section*****************************/
#include "EEPROM_24C02C.h"
/***********************************************************************/

/*****************Helper Functions Declarations-Section*****************/

/***********************************************************************/

/*****************Software Interfaces Functions-Section*****************/
/*
* @Brief : To write byte in EEPROM_24C02C.
* @Param EEPROM_Address
* @Param Byte_Address
* @Param Data
*/
void EEPROM_24C02C_Write_Byte(i2c_address_t EEPROM_Address, i2c_address_t Byte_Address, uint8_t Data)
{
I2C_Write1ByteRegister(EEPROM_Address, Byte_Address, Data);
}

/*
* @Brief : To read byte from EEPROM_24C02C.
* @Param EEPROM_Address
* @Param Byte_Address
* @Return Received_Value
*/
uint8_t EEPROM_24C02C_Read_Byte(i2c_address_t EEPROM_Address, i2c_address_t Byte_Address)
{
uint8_t Received_Value = 0;
Received_Value = I2C_Read1ByteRegister(EEPROM_Address, Byte_Address);

return Received_Value;
}
/***********************************************************************/
47 changes: 47 additions & 0 deletions EEPROM_24C02C.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* File : EEPROM_24C02C.h
* Author : Mohamed Ahmed Abdel Wahab
* LinkedIn : https://www.linkedin.com/in/mohamed-abdel-wahab-162413253/
* Github : https://github.com/moabdelwahab6611
* Created on June 19, 2023, 10:18 PM
*/

#ifndef EEPROM_24C02C_H
#define EEPROM_24C02C_H

/**************************Includes-Section*****************************/
#include "../../mcc_generated_files/mcc.h"
#include "../../mcc_generated_files/examples/i2c_master_example.h"
/***********************************************************************/

/**********************Macro Declarations-Section***********************/

/***********************************************************************/

/******************Macro Function Declarations-Section******************/

/***********************************************************************/

/********************Data Types Declarations-Section********************/

/***********************************************************************/

/**********Software Interfaces Functions Declarations-Section***********/
/*
* @Brief : To write byte in EEPROM_24C02C.
* @Param EEPROM_Address
* @Param Byte_Address
* @Param Data
*/
void EEPROM_24C02C_Write_Byte(i2c_address_t EEPROM_Address, i2c_address_t Byte_Address, uint8_t Data);

/*
* @Brief : To read byte from EEPROM_24C02C.
* @Param EEPROM_Address
* @Param Byte_Address
* @Return Received_Value
*/
uint8_t EEPROM_24C02C_Read_Byte(i2c_address_t EEPROM_Address, i2c_address_t Byte_Address);
/***********************************************************************/
#endif /* EEPROM_24C02C_H */

113 changes: 113 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL


# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib


# build
build: .build-post

.build-pre:
# Add your pre 'build' code here...

.build-post: .build-impl
# Add your post 'build' code here...


# clean
clean: .clean-post

.clean-pre:
# Add your pre 'clean' code here...
# WARNING: the IDE does not call this target since it takes a long time to
# simply run make. Instead, the IDE removes the configuration directories
# under build and dist directly without calling make.
# This target is left here so people can do a clean when running a clean
# outside the IDE.

.clean-post: .clean-impl
# Add your post 'clean' code here...


# clobber
clobber: .clobber-post

.clobber-pre:
# Add your pre 'clobber' code here...

.clobber-post: .clobber-impl
# Add your post 'clobber' code here...


# all
all: .all-post

.all-pre:
# Add your pre 'all' code here...

.all-post: .all-impl
# Add your post 'all' code here...


# help
help: .help-post

.help-pre:
# Add your pre 'help' code here...

.help-post: .help-impl
# Add your post 'help' code here...



# include project implementation makefile
include nbproject/Makefile-impl.mk

# include project make variables
include nbproject/Makefile-variables.mk
64 changes: 64 additions & 0 deletions RealTimeClockDS1307.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* File : RealTimeClockDS1307.c
* Author : Mohamed Ahmed Abdel Wahab
* LinkedIn : https://www.linkedin.com/in/mohamed-abdel-wahab-162413253/
* Github : https://github.com/moabdelwahab6611
* Created on June 19, 2023, 3:57 PM
*/

/**************************Includes-Section*****************************/
#include "RealTimeClockDS1307.h"
/***********************************************************************/

/*****************Helper Functions Declarations-Section*****************/
static RealTimeClockDS1307_T RealTimeClockDS1307;
/* "_Year" : "_Month" : "_Day" * "_Hours" : "_Minutes" : "_Seconds" */
static uint8_t RealTimeClockDS1307_RB_Date[17];
/***********************************************************************/

/*****************Software Interfaces Functions-Section*****************/
/*
* @Brief : To write full date and time.
* @Return RealTimeClockDS1307
*/
RealTimeClockDS1307_T RealTimeClockDS1307_Get_Date_And_Time(void)
{
RealTimeClockDS1307._Seconds = I2C_Read1ByteRegister(0xD0, 0x00);
RealTimeClockDS1307._Minutes = I2C_Read1ByteRegister(0xD0, 0x01);
RealTimeClockDS1307._Hours = I2C_Read1ByteRegister(0xD0, 0x02);
RealTimeClockDS1307._Day = I2C_Read1ByteRegister(0xD0, 0x04);
RealTimeClockDS1307._Month = I2C_Read1ByteRegister(0xD0, 0x05);
RealTimeClockDS1307._Year = I2C_Read1ByteRegister(0xD0, 0x06);
return RealTimeClockDS1307;
}

/*
* @Brief : To show full date and time.
*/
void Print_RealTimeClockDS1307_full_Date(void)
{
RealTimeClockDS1307_RB_Date[0] = ((RealTimeClockDS1307._Day >> 4) + 0x30);
RealTimeClockDS1307_RB_Date[1] = ((RealTimeClockDS1307._Day & 0x0F) + 0x30);
RealTimeClockDS1307_RB_Date[2] = '-';
RealTimeClockDS1307_RB_Date[3] = ((RealTimeClockDS1307._Month >> 4) + 0x30);
RealTimeClockDS1307_RB_Date[4] = ((RealTimeClockDS1307._Month & 0x0F) + 0x30);
RealTimeClockDS1307_RB_Date[5] = '-';
RealTimeClockDS1307_RB_Date[6] = ((RealTimeClockDS1307._Year >> 4) + 0x30);
RealTimeClockDS1307_RB_Date[7] = ((RealTimeClockDS1307._Year & 0x0F) + 0x30);

RealTimeClockDS1307_RB_Date[8] = '/';

RealTimeClockDS1307_RB_Date[9] = ((RealTimeClockDS1307._Hours >> 4) + 0x30);
RealTimeClockDS1307_RB_Date[10] = ((RealTimeClockDS1307._Hours & 0x0F) + 0x30);
RealTimeClockDS1307_RB_Date[11] = '-';
RealTimeClockDS1307_RB_Date[12] = ((RealTimeClockDS1307._Minutes >> 4) + 0x30);
RealTimeClockDS1307_RB_Date[13] = ((RealTimeClockDS1307._Minutes & 0x0F) + 0x30);
RealTimeClockDS1307_RB_Date[14] = '-';
RealTimeClockDS1307_RB_Date[15] = ((RealTimeClockDS1307._Seconds >> 4) + 0x30);
RealTimeClockDS1307_RB_Date[16] = ((RealTimeClockDS1307._Seconds & 0x0F) + 0x30);


USART_LoggingDebugData_Send_String("Date : \r", 8);
USART_LoggingDebugData_Send_String(RealTimeClockDS1307_RB_Date, 17);
}
/***********************************************************************/
52 changes: 52 additions & 0 deletions RealTimeClockDS1307.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* File : RealTimeClockDS1307.h
* Author : Mohamed Ahmed Abdel Wahab
* LinkedIn : https://www.linkedin.com/in/mohamed-abdel-wahab-162413253/
* Github : https://github.com/moabdelwahab6611
* Created on June 19, 2023, 3:57 PM
*/

#ifndef REALTIMECLOCKDS1307_H
#define REALTIMECLOCKDS1307_H

/**************************Includes-Section*****************************/
#include "../../mcc_generated_files/mcc.h"
#include "../../mcc_generated_files/examples/i2c_master_example.h"
#include "../USART_LoggingDebugData/USART_LoggingDebugData.h"
/***********************************************************************/

/**********************Macro Declarations-Section***********************/

/***********************************************************************/

/******************Macro Function Declarations-Section******************/

/***********************************************************************/

/********************Data Types Declarations-Section********************/
/* @Brief : Real Time Clock DS1307 date and time configurations. */
typedef struct
{
uint8_t _Hours;
uint8_t _Minutes;
uint8_t _Seconds;
uint8_t _Year;
uint8_t _Month;
uint8_t _Day;
}RealTimeClockDS1307_T;
/***********************************************************************/

/**********Software Interfaces Functions Declarations-Section***********/
/*
* @Brief : To write full date and time.
* @Return RealTimeClockDS1307
*/
RealTimeClockDS1307_T RealTimeClockDS1307_Get_Date_And_Time(void);

/*
* @Brief : To show full date and time.
*/
void Print_RealTimeClockDS1307_full_Date(void);
/***********************************************************************/
#endif /* REALTIMECLOCKDS1307_H */

Loading

0 comments on commit 98812c1

Please sign in to comment.