hv_drv_GpioSimSWire.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * @file hv_drv_GpioSimSWire.h
  3. * @brief Header file of gpio simulate single wire module.
  4. *
  5. * @verbatim
  6. * ==============================================================================
  7. * ##### How to use #####
  8. * ==============================================================================
  9. * (+) Use ()
  10. *
  11. * @endverbatim
  12. * @author HiView SoC Software Team
  13. * @version 1.0.0
  14. * @date 2023-12-16
  15. */
  16. #ifndef _HV_DRV_GPIOSIMSWIRE_H
  17. #define _HV_DRV_GPIOSIMSWIRE_H
  18. #include "Common/hv_comm_DataType.h"
  19. /** @defgroup DRV_GPIOSIMSWIRE DRV GPIO SIMULATE SINGLE WIRE
  20. * drv gpio simulate single wire functions
  21. * @{
  22. */
  23. typedef enum _SWireID
  24. {
  25. SIMSWIRE_ID_0,
  26. SIMSWIRE_ID_MAX,
  27. }SWireID;
  28. typedef struct _GpioSimSWire
  29. {
  30. SWireID enBus; /*Support Multi Channel*/
  31. UCHAR8 ucSdtPin; /*SDT Input Pin*/
  32. UCHAR8 ucSckPin; /*SCK Input Pin*/
  33. UCHAR8 ucTWHL; /*Pulse duration of SCKI*/
  34. UCHAR8 ucTSU; /*Setup time, SDTI - SCKI */
  35. UCHAR8 ucTHL; /*Hold time, SDTI - SCKI */
  36. }GpioSimSWire;
  37. /** Swire start signal
  38. *@SCK and SDT keep low
  39. */
  40. VOID Hv_GpioSimSWire_Start(UINT32 uiIndex);
  41. /** Swire stop signal
  42. *@SCK and SDT keep Low
  43. */
  44. VOID Hv_GpioSimSWire_Stop(UINT32 uiIndex);
  45. /** Initialize gpio simulation swire
  46. * @param pstGpioSimI2c pointer to swire configuration parameters
  47. * @return SUCCESS/FAILURE
  48. */
  49. Status Hv_Drv_GpioSimSWire_Init(const GpioSimSWire *pstGpioSimSwire);
  50. /** Send in master mode an amount of data
  51. * @param pucData pointer to data buffer to be transmited
  52. * @param usDataSize amount of data to be sent
  53. * @retval Status SUCESS/FAILURE
  54. */
  55. Status Hv_Drv_GpioSimSWire_SendData(SWireID enBus, UCHAR8 *pcData, UINT32 uiDatasize);
  56. /** Receive in master mode an amount of data
  57. * @param pucData pointer to data buffer to be transmited
  58. * @param usDataSize amount of data to be receive
  59. * @retval Status SUCESS/FAILURE
  60. */
  61. Status Hv_Drv_GpioSimSWire_RecvData(SWireID enBus, UCHAR8 *pucData, USHORT16 usDataSize);
  62. /** @} */
  63. #endif