ch32v30x_opa.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : ch32v30x_opa.h
  3. * Author : WCH
  4. * Version : V1.0.0
  5. * Date : 2021/06/06
  6. * Description : This file contains all the functions prototypes for the
  7. * OPA firmware library.
  8. *********************************************************************************
  9. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
  10. * Attention: This software (modified or not) and binary are used for
  11. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
  12. *******************************************************************************/
  13. #ifndef __CH32V30x_OPA_H
  14. #define __CH32V30x_OPA_H
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "ch32v30x.h"
  19. #define OPA_PSEL_OFFSET 3
  20. #define OPA_NSEL_OFFSET 2
  21. #define OPA_MODE_OFFSET 1
  22. /* OPA member enumeration */
  23. typedef enum
  24. {
  25. OPA1=0,
  26. OPA2,
  27. OPA3,
  28. OPA4
  29. }OPA_Num_TypeDef;
  30. /* OPA PSEL enumeration */
  31. typedef enum
  32. {
  33. CHP0=0,
  34. CHP1
  35. }OPA_PSEL_TypeDef;
  36. /* OPA NSEL enumeration */
  37. typedef enum
  38. {
  39. CHN0=0,
  40. CHN1
  41. }OPA_NSEL_TypeDef;
  42. /* OPA out channel enumeration */
  43. typedef enum
  44. {
  45. OUT_IO_OUT0=0,
  46. OUT_IO_OUT1
  47. }OPA_Mode_TypeDef;
  48. /* OPA Init Structure definition */
  49. typedef struct
  50. {
  51. OPA_Num_TypeDef OPA_NUM; /* Specifies the members of OPA */
  52. OPA_PSEL_TypeDef PSEL; /* Specifies the positive channel of OPA */
  53. OPA_NSEL_TypeDef NSEL; /* Specifies the negative channel of OPA */
  54. OPA_Mode_TypeDef Mode; /* Specifies the mode of OPA */
  55. }OPA_InitTypeDef;
  56. void OPA_DeInit(void);
  57. void OPA_Init(OPA_InitTypeDef* OPA_InitStruct);
  58. void OPA_StructInit(OPA_InitTypeDef* OPA_InitStruct);
  59. void OPA_Cmd(OPA_Num_TypeDef OPA_NUM, FunctionalState NewState);
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif