1 /* 2 * Copyright (c) 2020 Hubert Miś 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief FT8XX common functions 10 */ 11 12 #ifndef ZEPHYR_DRIVERS_MISC_FT8XX_FT8XX_COMMON_H_ 13 #define ZEPHYR_DRIVERS_MISC_FT8XX_FT8XX_COMMON_H_ 14 15 #include <stdint.h> 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 /** 22 * @brief FT8xx functions to write and read memory 23 * @defgroup ft8xx_common FT8xx common functions 24 * @ingroup ft8xx_interface 25 * @{ 26 */ 27 28 /** 29 * @brief Write 1 byte (8 bits) to FT8xx memory 30 * 31 * @param address Memory address to write to 32 * @param data Byte to write 33 */ 34 void ft8xx_wr8(uint32_t address, uint8_t data); 35 36 /** 37 * @brief Write 2 bytes (16 bits) to FT8xx memory 38 * 39 * @param address Memory address to write to 40 * @param data Value to write 41 */ 42 void ft8xx_wr16(uint32_t address, uint16_t data); 43 44 /** 45 * @brief Write 4 bytes (32 bits) to FT8xx memory 46 * 47 * @param address Memory address to write to 48 * @param data Value to write 49 */ 50 void ft8xx_wr32(uint32_t address, uint32_t data); 51 52 /** 53 * @brief Read 1 byte (8 bits) from FT8xx memory 54 * 55 * @param address Memory address to read from 56 * 57 * @return Value read from memory 58 */ 59 uint8_t ft8xx_rd8(uint32_t address); 60 61 /** 62 * @brief Read 2 bytes (16 bits) from FT8xx memory 63 * 64 * @param address Memory address to read from 65 * 66 * @return Value read from memory 67 */ 68 uint16_t ft8xx_rd16(uint32_t address); 69 70 /** 71 * @brief Read 4 bytes (32 bits) from FT8xx memory 72 * 73 * @param address Memory address to read from 74 * 75 * @return Value read from memory 76 */ 77 uint32_t ft8xx_rd32(uint32_t address); 78 79 /** 80 * @} 81 */ 82 83 #ifdef __cplusplus 84 } 85 #endif 86 87 #endif /* ZEPHYR_DRIVERS_MISC_FT8XX_FT8XX_COMMON_H_ */ 88