Click here to Skip to main content
15,894,907 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: problem understanding a functionality of constructor. Pin
CPallini27-Mar-18 5:36
mveCPallini27-Mar-18 5:36 
QuestionHackerrank:Down to Zero problem Pin
SrinivasaRamanujan25-Mar-18 10:23
SrinivasaRamanujan25-Mar-18 10:23 
AnswerRe: Hackerrank:Down to Zero problem Pin
David Crow25-Mar-18 15:41
David Crow25-Mar-18 15:41 
QuestionIn type conversion of 2 different classes can i convert both ways ? Pin
Tarun Jha25-Mar-18 5:14
Tarun Jha25-Mar-18 5:14 
AnswerRe: In type conversion of 2 different classes can i convert both ways ? Pin
Victor Nijegorodov25-Mar-18 8:07
Victor Nijegorodov25-Mar-18 8:07 
GeneralRe: In type conversion of 2 different classes can i convert both ways ? Pin
Tarun Jha25-Mar-18 23:26
Tarun Jha25-Mar-18 23:26 
AnswerRe: In type conversion of 2 different classes can i convert both ways ? Pin
CPallini25-Mar-18 10:50
mveCPallini25-Mar-18 10:50 
GeneralRe: In type conversion of 2 different classes can i convert both ways ? Pin
Tarun Jha25-Mar-18 23:25
Tarun Jha25-Mar-18 23:25 
GeneralRe: In type conversion of 2 different classes can i convert both ways ? Pin
CPallini26-Mar-18 0:18
mveCPallini26-Mar-18 0:18 
QuestionAdding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Tarun Jha24-Mar-18 8:19
Tarun Jha24-Mar-18 8:19 
AnswerRe: Adding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Victor Nijegorodov24-Mar-18 8:35
Victor Nijegorodov24-Mar-18 8:35 
GeneralRe: Adding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Tarun Jha24-Mar-18 10:06
Tarun Jha24-Mar-18 10:06 
AnswerRe: Adding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Richard MacCutchan24-Mar-18 21:13
mveRichard MacCutchan24-Mar-18 21:13 
GeneralRe: Adding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Tarun Jha25-Mar-18 5:08
Tarun Jha25-Mar-18 5:08 
GeneralRe: Adding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Richard MacCutchan25-Mar-18 5:32
mveRichard MacCutchan25-Mar-18 5:32 
GeneralRe: Adding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Tarun Jha25-Mar-18 6:37
Tarun Jha25-Mar-18 6:37 
GeneralRe: Adding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Richard MacCutchan25-Mar-18 7:16
mveRichard MacCutchan25-Mar-18 7:16 
GeneralRe: Adding two matrix objects and assigning the result to third object using overloaded operators ? Pin
Tarun Jha25-Mar-18 8:06
Tarun Jha25-Mar-18 8:06 
QuestionLinux C++ implementation of ioctl SOLVED Pin
Vaclav_23-Mar-18 8:50
Vaclav_23-Mar-18 8:50 
AnswerRe: Linux C++ implementation of ioctl Pin
Jochen Arndt24-Mar-18 23:39
professionalJochen Arndt24-Mar-18 23:39 
You have two options:

  1. Use the existing I2C support on the Raspberry Pi with the I2C GPIO pins
  2. Implement your own I2C support on general use GPIO pins

The I2C speed is defined by the master by generating the clock. A device might use "clock stretching" to slow down (Clock, Stretching, Arbitration - I2C Bus[^]).

So implementations are not time critical. They can use a predefined (max.) clock and have not to care about being slowed down by other tasks on the system.

I have implemented I2C in assembler on micro controllers. Implementing it in C is not a problem but be aware that it might be a frustrating tasks because it can't be simply debugged. I highly recommend to use a logic analyser or at least a storage oscilloscope to check the signals on the bus.

Quote:
all of the sample codes I have read so far are "limited" to open ioctl file and "write " to I2C slave address.
With device drivers use i2c_transfer(). Have a look at the source of any Linux driver for a I2C device like rtc-pcf8563.c
[^].

When using ioctl() on the I2C device just use read():
C++
int fd = open("/dev/i2c-1", O_RDWR);
// Use I2C_SLAVE_FORCE if the device is in use (e.g. when a driver is installed)
ioctl(fd, I2C_SLAVE, addr);
read(fd, buffer, length);
Or use ioctl(I2C_RDWR) or ioctl(I2C_SMBUS) for reading which both does not require the I2C_SLAVE[_FORCE]. In any case check first if the used ioctl() call is supported.
AnswerRe: Linux C++ implementation of ioctl Pin
leon de boer26-Mar-18 16:53
leon de boer26-Mar-18 16:53 
GeneralRe: Linux C++ implementation of ioctl Pin
Vaclav_4-Apr-18 5:08
Vaclav_4-Apr-18 5:08 
QuestionVS2017: Cannot debug Dll's Pin
indrekm23-Mar-18 1:13
indrekm23-Mar-18 1:13 
SuggestionRe: VS2017: Cannot debug Dll's Pin
Richard MacCutchan23-Mar-18 1:21
mveRichard MacCutchan23-Mar-18 1:21 
SuggestionRe: VS2017: Cannot debug Dll's Pin
Jochen Arndt23-Mar-18 1:25
professionalJochen Arndt23-Mar-18 1:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.