i2c_slave.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**************************************************************************************************
  2. Phyplus Microelectronics Limited confidential and proprietary.
  3. All rights reserved.
  4. IMPORTANT: All rights of this software belong to Phyplus Microelectronics
  5. Limited ("Phyplus"). Your use of this Software is limited to those
  6. specific rights granted under the terms of the business contract, the
  7. confidential agreement, the non-disclosure agreement and any other forms
  8. of agreements as a customer or a partner of Phyplus. You may not use this
  9. Software unless you agree to abide by the terms of these agreements.
  10. You acknowledge that the Software may not be modified, copied,
  11. distributed or disclosed unless embedded on a Phyplus Bluetooth Low Energy
  12. (BLE) integrated circuit, either as a product or is integrated into your
  13. products. Other than for the aforementioned purposes, you may not use,
  14. reproduce, copy, prepare derivative works of, modify, distribute, perform,
  15. display or sell this Software and/or its documentation for any purposes.
  16. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  17. PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  18. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  19. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  20. PHYPLUS OR ITS SUBSIDIARIES BE LIABLE OR OBLIGATED UNDER CONTRACT,
  21. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  22. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  23. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  24. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  25. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  26. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  27. **************************************************************************************************/
  28. /*******************************************************************************
  29. * @file i2c_slave.h
  30. * @brief i2c slave Configuration,API...
  31. * @version 1.0
  32. * Copyright(C) 2016, PhyPlus Semiconductor
  33. * All rights reserved.
  34. *******************************************************************************/
  35. #ifndef __I2C_SLAVE_H__
  36. #define __I2C_SLAVE_H__
  37. /*******************************************************************************
  38. *@ Module : Includes
  39. *@ Description : NULL
  40. *******************************************************************************/
  41. #include "types.h"
  42. #include "i2c_common.h"
  43. /*******************************************************************************
  44. *@ Module : I2C Slave Paramter structure
  45. *@ Description : None
  46. *******************************************************************************/
  47. typedef struct
  48. {
  49. // General
  50. uint8_t id; // set
  51. I2C_WorkMode workmode; // init some Para ,according to workmode
  52. I2C_ADDRESS_e AddressMode;
  53. uint8_t RX_FIFO_Len; // RX , TX FIFO SET
  54. uint8_t Tx_FIFO_Len;
  55. GPIO_Pin_e SDA_PIN; // I2C Pin
  56. GPIO_Pin_e SCL_PIN;
  57. uint32_t IRQ_Source;
  58. uint8_t Slave_Address; // SAR,when as Slave
  59. I2C_Hdl_t evt_handler;
  60. }I2C_Slave_Parameter;
  61. /*******************************************************************************
  62. *@ Module : Function Statement
  63. *@ Description : NULL
  64. *******************************************************************************/
  65. uint8_t Hal_I2C_Slave_Init(I2C_Slave_Parameter *para,uint8_t *handle);
  66. uint8_t Hal_I2c_Slave_Open(uint8_t handle);
  67. void Hal_I2c_Slave_Close(uint8_t handle);
  68. uint8_t Hal_I2C_Slave_Deinit(uint8_t *handle);
  69. uint8_t Hal_Check_I2C_Slave_Closed(uint8_t handle);
  70. void Hal_I2C_Slave_ReadRX_FIFO(uint8_t handle,uint8_t *p,uint8_t len);
  71. void Hal_I2C_Slave_CLR_IRQs(uint8_t handle,uint32_t irqs);
  72. void Hal_I2C_Slave_WriteTX_FIFO(uint8_t handle,uint8_t *p,uint8_t len);
  73. #endif