71 return (SPECSSLAVE*)NULL;
81 return (SPECSMASTER*)NULL;
91 warning(
"Could not reach proper Specs Master and/or Slave.",
"SpecsInterface::specsWriteI2c");
94 SpecsError status = specs_i2c_write ( specsSlv,
outputSelect() , i2cAdd , nWord , data );
96 warning(
"failure at address " +
itos (i2cAdd) +
"[code=" +
itos(status) +
"]" ,
105 verbose(
"Compilation in _NODEVICE_ mode.",
"SpecsInterface::specsWriteI2c");
112 std::vector<U8>
data ){
114 unsigned char nword =
static_cast<unsigned int>( data.size() );
116 warning(
"Request to write data of size 0",
"SpecsInterface::specsWriteI2c");
119 unsigned char* new_data =
new unsigned char[nword];
120 for(
unsigned int i=0; i<data.size(); ++i) new_data[i] = data[i];
130 unsigned char subAdd ,
131 unsigned char nWord ,
136 warning(
"Could not reach proper Specs Master and/or Slave.",
"SpecsInterface::specsWriteI2c");
139 SpecsError status = specs_i2c_write_sub ( specsSlv,
outputSelect() , i2cAdd , subAdd , nWord , data );
141 warning(
"failure at address " +
itos (i2cAdd) +
"/ subAddress " +
itos(subAdd) +
142 " [code=" +
itos(status) +
"]",
"specsWriteI2c");
147 " words written at address " +
154 verbose(
"Compilation in _NODEVICE_ mode.",
"SpecsInterface::specsWriteI2c");
160 unsigned char outputSel,
161 unsigned char subAdd ,
162 unsigned char nWord ,
167 warning(
"Could not reach proper Specs Master and/or Slave.",
168 "SpecsInterface::specsWriteI2c");
171 SpecsError status = specs_i2c_write_sub ( specsSlv, outputSel ,
175 warning(
"failure at address " +
itos (i2cAdd) +
"/ subAddress " +
itos(subAdd) +
176 " [code=" +
itos(status) +
"]" ,
182 "/ subAddress " +
itos(subAdd),
186 verbose(
"Compilation in _NODEVICE_ mode.",
"SpecsInterface::specsWriteI2c");
192 unsigned char nOctets,
197 warning(
"Could not reach proper Specs Master and/or Slave.",
198 "SpecsInterface::specsReadI2c");
201 SpecsError status = specs_i2c_read ( specsSlv,
outputSelect() , i2cAdd , nOctets , i2cWords );
203 warning(
"failure at address " +
itos (i2cAdd) +
"[code=" +
itos(status) +
"]",
208 verbose(
itos(nOctets) +
" words read at address " +
itos(i2cAdd),
"SpecsReadI2c");
211 verbose(
"Compilation in _NODEVICE_ mode.",
"SpecsInterface::specsReadI2c");
217 std::vector<unsigned char>& specsWords ){
219 int nOctets = specsWords.size();
221 warning(
"The vector of data to read should have a non-zero size",
222 "SpecsInterface::specsReadI2c");
228 bool status =
specsReadI2c(address, nOctets, BufferSource);
230 for(
int j=0; j<nOctets; ++j) specsWords[j] = static_cast<unsigned char>(BufferSource[j]);
236 unsigned char subAdd,
237 unsigned char nOctets,
242 warning(
"Could not reach proper Specs Master and/or Slave.",
"SpecsInterface::specsReadI2c");
245 SpecsError status = specs_i2c_read_sub ( specsSlv,
outputSelect() , i2cAdd , subAdd , nOctets , i2cWords );
247 warning(
"failure at address " +
itos (i2cAdd) +
"/ subAddress " +
itos(subAdd) +
248 " [code=" +
itos(status) +
"]" ,
254 "/ subAddress " +
itos(subAdd),
258 verbose(
"Compilation in _NODEVICE_ mode.",
"SpecsInterface::specsReadI2c");
264 unsigned char outputSel,
265 unsigned char subAdd,
266 unsigned char nOctets,
271 warning(
"Could not reach proper Specs Master and/or Slave.",
272 "SpecsInterface::specsReadI2c");
275 SpecsError status = specs_i2c_read_sub ( specsSlv, outputSel ,
277 nOctets , i2cWords );
279 warning(
"failure at address " +
itos (i2cAdd) +
"/ subAddress " +
itos(subAdd) +
280 " [code=" +
itos(status) +
"]",
286 "/ subAddress " +
itos(subAdd),
290 verbose(
"Compilation in _NODEVICE_ mode.",
"SpecsInterface::specsReadI2c");
300 warning(
"Could not reach proper Specs Master and/or Slave.",
301 "SpecsInterface::specsWriteParallel");
304 SpecsError status = specs_parallel_write( specsSlv , add , 1 , &value );
307 " [code=" +
itos(status) +
"]" ,
308 "specsWriteParallel");
313 " successfully written at address " +
itos(add),
314 "SpecsWriteParallel");
317 verbose(
"Compilation in _NODEVICE_ mode.",
318 "SpecsWriteParallel");
328 warning(
"Could not reach proper SpecsSlave/Master.",
"SpecsInterface::specsReadI2c");
331 SpecsError status = specs_parallel_read( specsSlv , add , 1 , ¶llelBus );
334 " [code=" +
itos(status) +
"]",
335 "specsReadParallel" );
340 " successfully read at address " +
itos(add),
341 "SpecsReadParallel");
344 verbose(
"Compilation in _NODEVICE_ mode.",
345 "SpecsReadParallel");
352 unsigned short value){
357 warning(
"Could not reach proper SpecsSlave/Master.",
358 "SpecsInterface::specsWriteRegister");
363 status = specs_register_write ( specsSlv , reg , value );
366 " [code=" +
itos(status) +
"]" ,
367 "specsWriteRegister");
373 " successfully written with value " +
itos (value),
374 "SpecsWriteRegister");
377 verbose(
"Compilation in _NODEVICE_ mode.",
378 "SpecsInterface::specsWriteRegister");
389 warning(
"Could not reach proper SpecsSlave/Master.",
390 "SpecsInterface::specsReadRegister");
395 status = specs_register_read ( specsSlv , reg , &value );
398 " [code=" +
itos(status) +
"]" ,
399 "specsReadRegister");
405 " successfully read with value " +
itos(value),
406 "SpecsReadRegister");
409 verbose(
"Compilation in _NODEVICE_ mode.",
410 "SpecsInterface::specsReadRegister");
void verbose(std::string mymsg)
virtual SpecsMaster * specsMaster()
bool specsReadI2c(unsigned char address, unsigned char nOctects, U8 *i2cWords)
bool specsReadParallel(unsigned char address, U16 &data)
bool specsWriteI2c(unsigned char address, unsigned char nData, U8 *data)
bool specsWriteRegister(unsigned char, unsigned short)
void setId(unsigned char id)
def data(object, stream=None)
virtual SPECSSLAVE * specsSlaveDevice()
unsigned char m_outputSelect
bool specsWriteParallel(unsigned char address, unsigned short data)
virtual SPECSMASTER * specsMasterDevice()
virtual SpecsSlave * specsSlave()
unsigned char outputSelect()
void warning(std::string mymsg)
void setOutputSelect(unsigned char)
void setAddress(unsigned char)
bool specsReadRegister(unsigned char, U16 &)