Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
platform.h
00001 /******************************************************************************* 00002 ################################################################################ 00003 # 00004 # This program is free software; you can redistribute it and/or modify it under 00005 # the terms of the GNU General Public License version 2 and only version 2 as 00006 # published by the Free Software Foundation. 00007 # 00008 # This program is distributed in the hope that it will be useful, but WITHOUT 00009 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00010 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00011 # details. 00012 # 00013 # You should have received a copy of the GNU General Public License along with 00014 # this program; if not, write to the Free Software Foundation, Inc., 00015 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00016 # 00017 #------------------------------------------------------------------------------ 00018 # Imaging Division 00019 ################################################################################ 00020 ********************************************************************************/ 00021 00022 /** 00023 * @file platform.h 00024 * 00025 * @brief All platform specific declarations to be used by the High Level API are defined here. 00026 * The developer is responsible for providing the implementation of the prototypes declared. 00027 * 00028 */ 00029 00030 #ifndef _PLATFORM 00031 #define _PLATFORM 00032 #ifndef __KERNEL__ 00033 #include <stdbool.h> 00034 #include <stdint.h> 00035 #endif 00036 /** @brief Typedef defining .\n 00037 * The developer should modify this to suit the platform being deployed. 00038 */ 00039 #ifndef TRUE 00040 #define TRUE 1 00041 #endif 00042 00043 #ifndef FALSE 00044 #define FALSE 0 00045 #endif 00046 00047 /** @brief Typedef defining 8 bit unsigned char type.\n 00048 * The developer should modify this to suit the platform being deployed. 00049 */ 00050 typedef unsigned char bool_t; 00051 00052 #ifndef _STDINT_H 00053 00054 /** @brief Typedef defining 64 bit unsigned long type.\n 00055 * The developer should modify this to suit the platform being deployed. 00056 */ 00057 typedef unsigned long long uint64_t; 00058 00059 /** @brief Typedef defining 64 bit long type.\n 00060 * The developer should modify this to suit the platform being deployed. 00061 */ 00062 typedef long long long64_t; 00063 00064 /** @brief Typedef defining 32 bit unsigned int type.\n 00065 * The developer should modify this to suit the platform being deployed. 00066 */ 00067 typedef unsigned int uint32_t; 00068 00069 /** @brief Typedef defining 32 bit int type.\n 00070 * The developer should modify this to suit the platform being deployed. 00071 */ 00072 typedef int int32_t; 00073 00074 /** @brief Typedef defining 16 bit unsigned short type.\n 00075 * The developer should modify this to suit the platform being deployed. 00076 */ 00077 typedef unsigned short uint16_t; 00078 00079 /** @brief Typedef defining 16 bit short type.\n 00080 * The developer should modify this to suit the platform being deployed. 00081 */ 00082 typedef short int16_t; 00083 00084 /** @brief Typedef defining 8 bit unsigned char type.\n 00085 * The developer should modify this to suit the platform being deployed. 00086 */ 00087 typedef unsigned char uint8_t; 00088 00089 /** @brief Typedef defining 8 bit char type.\n 00090 * The developer should modify this to suit the platform being deployed. 00091 */ 00092 typedef signed char int8_t; 00093 00094 #endif //_STDINT_H 00095 00096 /** @brief Typedef defining 64 bit double type.\n 00097 * The developer should modify this to suit the platform being deployed. 00098 */ 00099 typedef double double_t; 00100 00101 /** @brief Typedef defining 32 bit float type.\n 00102 * The developer should modify this to suit the platform being deployed. 00103 */ 00104 typedef float float_t; 00105 00106 #ifndef NULL 00107 #define NULL 0 00108 #endif 00109 00110 /** 00111 * @brief Method to print a given string to the program output. 00112 */ 00113 void debug1_print(char *pBuffer); 00114 00115 /** 00116 * @brief Method to print a given string to the program output. 00117 */ 00118 void debug2_print(char *pBuffer); 00119 00120 /** 00121 * Method to initialise a given I2C device for a given I2C 00122 * address. 00123 */ 00124 void i2c_initialise(uint32_t addr); 00125 00126 /** 00127 * Method to close device if opened. 00128 */ 00129 void i2c_close(); 00130 00131 /** 00132 * Method to write a single byte to a given I2C reg index. 00133 * Throws WriteFail upon failure. 00134 */ 00135 void i2c_write_byte(uint32_t reg, uint8_t data, uint8_t baseAddr); 00136 00137 /** 00138 * Method to write a single word to a given I2C reg index. 00139 * Throws WriteFail upon failure. 00140 */ 00141 void i2c_write_word(uint32_t reg, uint16_t data, uint8_t baseAddr); 00142 00143 /** 00144 * Method to write an array of bytes to a given I2C reg index. 00145 * Throws WriteFail upon failure. 00146 */ 00147 void i2c_write(uint32_t reg, uint8_t *data, int32_t size, uint8_t baseAddr); 00148 00149 /** 00150 * Method to read a single byte from a given I2C reg index. 00151 * Throws ReadFail upon error. 00152 */ 00153 uint8_t i2c_read_byte(uint32_t reg, uint8_t baseAddr); 00154 00155 /** 00156 * Method to read a two byte word from a given I2C reg index. 00157 * Throws ReadFail upon error. 00158 */ 00159 uint16_t i2c_read_word(uint32_t reg, uint8_t baseAddr); 00160 00161 /** 00162 * Method to read an int32 from a given I2C reg index. 00163 * Throws ReadFail upon error. 00164 */ 00165 uint32_t i2c_read_uint32(uint32_t reg, uint8_t baseAddr); 00166 00167 /** 00168 * Method to read multiple bytes from a given I2C reg index. 00169 * Throws ReadFail upon error. 00170 */ 00171 void i2c_read(uint32_t reg, uint8_t* data, int32_t size, uint8_t baseAddr); 00172 00173 /** 00174 * Method to start the timer. 00175 */ 00176 void timer_start(); 00177 00178 /** 00179 * Method reporting the number of seconds elapsed since the timer was started. 00180 */ 00181 double_t timer_elapsedTime(); 00182 00183 /** 00184 * Method to stop the timer. 00185 */ 00186 void timer_stop(); 00187 00188 /** 00189 * Method to wait a given number of ms. 00190 */ 00191 void timer_wait_ms(int32_t ms); 00192 00193 /** 00194 * Method to wait a given number of us 00195 */ 00196 void timer_wait_us(int32_t us); 00197 00198 /** 00199 * Method to report the current clock time in us. 00200 */ 00201 uint32_t timer_get_clock_time_usecs(); 00202 00203 /** 00204 * Method to report the current clock time in ms. 00205 */ 00206 uint32_t timer_get_clock_time_msecs(); 00207 00208 #endif /* _PLATFORM */ 00209 00210
Generated on Tue Jul 12 2022 22:19:50 by
1.7.2