Code Monkey home page Code Monkey logo

sd_hal_at24's Introduction

AT24_HAL_I2C

Hi guys! If you are familiar with HAL Libraries , you Know that work with I2C_HAL Library is hard to handle.so for start, any Hardware developer recommend You to work with EEPROMs , so here we gone use I2C_HAL library and write somethings on EEPROMs (for example AT24 ) and then read that from. so here we are.first i wanna show you 2 function in my library that you can see below and then you can easily understand others.

at24_HAL_WriteBytes

its easy one,this is the base and don't afraid this is easy one . in this function we use HAL_I2C_Mem_Write and write our own function.This function handles Writing Array of Bytes on the specific Address . this program have this feature that don't force you to use absolute 16 bytes , you can use more than 16 bytes buffer.

Notes:

  • hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
  • DevAddress: specifies the slave address to be programmed (EEPROM ADDRESS).
  • MemAddress: Internal memory address (WHERE YOU WANNA WRITE TO).
  • pData: Pointer to data buffer.
  • TxBufferSize: Amount of data you wanna Write.
  • we consider Timeout as 1000.

at24_HAL_ReadBytes

Function just get the DevAddress of the Slave (not master) and for the next step You know that the most of the EEPROM address start with 0xA0 .it get the MemAddress for the location you want to read data from.

Notes:

  • hi2c: Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
  • DevAddress: specifies the slave address to be programmed (EEPROM ADDRESS).
  • MemAddress: Internal memory address (WHERE YOU WANNA READ FROM).
  • pData: Pointer to data buffer.
  • TxBufferSize: Amount of data you wanna Write.
  • we consider Timeout as 1000.

here we are . we have 2 function for read and write and we can use it and expand our lib and make it better.

don't forget to visit our site .

thanks.

Sina Darvishi

sd_hal_at24's People

Contributors

sinadarvi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sd_hal_at24's Issues

sdI2C_Writebytes(), sdI2C_RandomRead() seem to undefined

Sir,
sdI2C_WriteBytes(), sdI2C_RandomRead() within at24_HAL_WriteString() and at24_HAL_ReadString() in at24_hal_i2c.c seem to be undefined and cause errors while building the project.

Should I attach any specific library for these functions to work? Pls help me resolve this issue, sir.

Thank you.
error_lib

STMF103R8Tx - Not get hal_ok

I'm using STMF1 with your library

My init function

static void MX_I2C1_Init(void)
{

  hi2c1.Instance = I2C1;
  hi2c1.Init.ClockSpeed = 400000;
  hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
  hi2c1.Init.OwnAddress1 = 0;
  hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
  hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_ENABLE;
  hi2c1.Init.OwnAddress2 = 0;
  hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
  hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
  if (HAL_I2C_Init(&hi2c1) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

}

but i can't pass any HAL_OK while loop of yours, i'm using AT24, 512KB, A0,A1,A2,Wp are grounded
any ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.