/*!
 * @file        g32a10xx_gpio_i2c.h
 *
 * @brief       This file contains the headers of the interrupt handlers
 *
 * @version     V1.0.0
 *
 * @date        2026-02-25
 *
 * @attention
 *
 *  Copyright (C) 2026 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the Geehy Semiconductor Software License Agreement for the governing permissions
 *  and limitations under the License.
 */

/* Define to prevent recursive inclusion */
#ifndef AT24CXX_H
#define AT24CXX_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes */
#include "g32a10xx.h"
#include "g32a10xx_gpio.h"

/** @addtogroup Examples
  @{
  */

/** @addtogroup I2C_Examples
  @{
  */

/** @addtogroup GPIO_I2C
  @{
  */

/** @defgroup GPIO_I2C_Macros
  @{
  */

#ifdef AT24C02   
//==================== 24C02 address ====================
#define AT24C02_ADDR        (uint8_t)0xA0    // device address A0/A1/A2 all grounded
#define AT24C02_PAGE_SIZE   (uint8_t)8U       // 8 bytes one page
#define AT24C02_SIZE        (uint8_t)256     // total 256 bytes, 256*8=2048 bit
#else
//==================== 24C32 address ====================
#define AT24C32_ADDR        (uint8_t)0xA0    // device address A0/A1/A2 all grounded
#define AT24C32_PAGE_SIZE   (uint8_t)32U       // 32 bytes one page
#define AT24C32_SIZE        (uint8_t)4096    // total 4096 bytes, 4096*8=32768 bit
#endif

/**@} end of group GPIO_I2C_Macros */


/** @defgroup GPIO_I2C_Functions I2C_Functions
  @{
  */

#ifdef AT24C02  
uint8_t I2c_At24c02_ReadByte(uint8_t Addr);
void I2c_At24c02_WriteByte(uint8_t Addr, uint8_t Data);
void I2c_At24c02_WritePage(uint8_t Addr, uint8_t *BufPtr, uint8_t Len);
void I2c_At24c02_ReadData(uint8_t Addr, uint8_t *BufPtr, uint8_t Len);
#else
uint8_t I2c_At24c32_ReadByte(uint16_t Addr);
void I2c_At24c32_WriteByte(uint16_t Addr, uint8_t Data);
void I2c_At24c32_WritePage(uint16_t Addr, const uint8_t *BufPtr, uint8_t Len);
void I2c_At24c32_ReadData(uint16_t Addr, uint8_t *BufPtr, uint8_t Len);
#endif

#ifdef __cplusplus
}
#endif

#endif /* AT24CXX_H */

/**@} end of group GPIO_I2C_Functions */
/**@} end of group GPIO_I2C */
/**@} end of group I2C_Examples */
/**@} end of group Examples */


