es_conf_info_i2c.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Change Logs:
  3. * Date Author Notes
  4. * 2021-04-20 liuhy the first version
  5. *
  6. * Copyright (C) 2021 Shanghai Eastsoft Microelectronics Co., Ltd. All rights reserved.
  7. *
  8. * SPDX-License-Identifier: Apache-2.0
  9. *
  10. * Licensed under the Apache License, Version 2.0 (the License); you may
  11. * not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  18. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. *
  22. */
  23. #ifndef __ES_CONF_INFO_I2C_H__
  24. #define __ES_CONF_INFO_I2C_H__
  25. #include "es_conf_info_map.h"
  26. #include <ald_i2c.h>
  27. #include <ald_gpio.h>
  28. #include <rtdbg.h>
  29. #define ES_C_I2C_STRETCH I2C_NOSTRETCH_DISABLE
  30. #define ES_C_I2C_NO_STRETCH I2C_NOSTRETCH_ENABLE
  31. #define ES_C_I2C_GENERALCALL I2C_GENERALCALL_ENABLE
  32. #define ES_C_I2C_NO_GENERALCALL I2C_GENERALCALL_DISABLE
  33. #define ES_C_I2C_ADDR_7_MODE I2C_ADDR_7BIT
  34. #define ES_C_I2C_ADDR_10_MODE I2C_ADDR_10BIT
  35. /* I2C 配置 */
  36. /* codes_main */
  37. #ifndef ES_DEVICE_NAME_I2C0
  38. #define ES_DEVICE_NAME_I2C0 "i2c0"
  39. #endif
  40. #ifndef ES_DEVICE_NAME_I2C1
  41. #define ES_DEVICE_NAME_I2C1 "i2c1"
  42. #endif
  43. #ifndef ES_I2C0_CLK_SPEED
  44. #define ES_I2C0_CLK_SPEED 100000
  45. #endif
  46. #ifndef ES_I2C0_OWN_ADDR1
  47. #define ES_I2C0_OWN_ADDR1 0x20
  48. #endif
  49. #ifndef ES_I2C0_GENERAL_CALL
  50. #define ES_I2C0_GENERAL_CALL ES_C_I2C_NO_GENERALCALL
  51. #endif
  52. #ifndef ES_I2C0_STRETCH
  53. #define ES_I2C0_STRETCH ES_C_I2C_STRETCH
  54. #endif
  55. #ifndef ES_I2C0_ADDR_MODE
  56. #define ES_I2C0_ADDR_MODE ES_C_I2C_ADDR_7_MODE
  57. #endif
  58. #ifndef ES_I2C1_CLK_SPEED
  59. #define ES_I2C1_CLK_SPEED 100000
  60. #endif
  61. #ifndef ES_I2C1_OWN_ADDR1
  62. #define ES_I2C1_OWN_ADDR1 0x20
  63. #endif
  64. #ifndef ES_I2C1_GENERAL_CALL
  65. #define ES_I2C1_GENERAL_CALL ES_C_I2C_NO_GENERALCALL
  66. #endif
  67. #ifndef ES_I2C1_STRETCH
  68. #define ES_I2C1_STRETCH ES_C_I2C_STRETCH
  69. #endif
  70. #ifndef ES_I2C1_ADDR_MODE
  71. #define ES_I2C1_ADDR_MODE ES_C_I2C_ADDR_7_MODE
  72. #endif
  73. #endif