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.
Dependencies: Gamma Beta Alpha
Dependents: 2017_Bteam_I2CTransporter BETA_A ALPHA_A GAMMA_A
I2CTransporter.cpp
00001 #include "I2CTransporter.h" 00002 00003 I2CTransporter::I2CTransporter(PinName sda, PinName scl) 00004 : _master(sda,scl) 00005 { 00006 address = 0; 00007 target_array = NULL; 00008 Transport_Began = false; 00009 } 00010 00011 void I2CTransporter::transport_begin(int addr_, char *target_array_, int data_size_) 00012 { 00013 address = addr_ ; 00014 target_array = target_array_; 00015 data_size = data_size_; 00016 Transport_Began = true; 00017 } 00018 00019 bool I2CTransporter::read() 00020 { 00021 if(Transport_Began == true) 00022 { 00023 return _master.read(address, target_array, data_size) == 0 00024 ? true 00025 : false; 00026 } 00027 else 00028 { 00029 return false; 00030 } 00031 } 00032 00033 bool I2CTransporter::write() 00034 { 00035 if(Transport_Began == true) 00036 { 00037 return _master.write(address, target_array, data_size) == 0 00038 ? true 00039 : false; 00040 } 00041 else 00042 { 00043 return false; 00044 } 00045 } 00046 00047 void I2CTransporter::transport_end() 00048 { 00049 if(Transport_Began == true) 00050 { 00051 address = 0; 00052 target_array = NULL; 00053 data_size = 0; 00054 Transport_Began = false; 00055 } 00056 else 00057 { 00058 } 00059 }
Generated on Sun Jul 17 2022 11:52:35 by
1.7.2