C is a general-purpose computer programming language used for operating systems, games and other high performance work. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.

learn more… | top users | synonyms

19
votes
1answer
2k views

How does memory-mapped I/O addressing work?

How does memory-mapped I/O addressing work? I'm trying to understand a sample supplied I2S: Anyone got it running?. Configuring Clocks: #define BCM2708_PERI_BASE 0x20000000 #define ...
11
votes
1answer
540 views

How can I detect that I'm compiling for Raspberry Pi?

As Raspberry Pi needs a bit of special code (I'm talking about C/C++) for accessing some hardware features (e.g. a call to bcm_host_init()). I'm looking for a reliable and elegant way to detect this ...
8
votes
3answers
1k views

Which CPU flags are suitable for gcc on Raspberry Pi?

gcc takes the -mcpu= (or -march=) flags to produce optimized code for a particular CPU type. There's a plethora of arm variants, and the gcc Arm target also provides numerous FPU types. Which ...
6
votes
2answers
581 views

Can I program C within a nice IDE on desktop computer for the RPi

I'm from a Microsoft Windows development background, I'm happy with the IntelliSense and code navigation features, is it possible for me to install an IDE, such as Eclipse, [I'm assuming it's probably ...
6
votes
2answers
1k views

How to use Java to read/write data to/from the header pins?

I just got Java running on my Raspberry Pi which took a lot more screwing around than i had hoped. I want to be able to read/write data to/from the header pins from Java. How can I do this? Do I need ...
5
votes
2answers
907 views

Can't access shared libraries when running with sudo

I'm trying to get a demo working writing PCM to the I2S; I've created a small demo program that gives an error when I run with the following command ./demo stereo_small.wav can't open /dev/mem So I ...
4
votes
2answers
407 views

Cannot read input to SDA/SCL GPIO pins

I'm totally stumped trying to figure out how to read input to the SDA/SCL GPIO pins on the Pi. Context: I have a Wiegand 26 RFID reader that I would like to read data from. The idea is that I get the ...
4
votes
1answer
435 views

C/C++ sound API for games

I have a game that, up until now, uses SDL_mixer for playing MP3 sound effects. Works on Linux, Windows, OSX. At the moment doesn't work on 64 bit Linux, so I was thinking of switching to FMOD. ...
4
votes
2answers
471 views

Outb in C to access GPIO

I have a basic understanding of the GPIO on the RPi. I want to adapt some of my previous software which interfaced my project board via the Parallel port via direct output to the PP address (0x378) ...
3
votes
2answers
180 views

Get PI's temperature using C

I know you can get the temperature using the tool vcgencmd but I was wondering if there is any API I can use in C to get the temperature programatically without reading the stdout of vcgencmd ?
3
votes
1answer
556 views

How do I connect a DS18B20?

I'm trying to connect a DS18B20 to the GPIOs. I have successfully done so electronically, but I could only code the reset function because it's not that time critical. It is OK for that function to ...
3
votes
1answer
98 views

Read the value of an GPIO output pin

I've made a program using the wiringPi library that assigns GPIO pins to toggle at the press of associated number keys. I'd like my program to show the current status of the pins, even if they are ...
2
votes
2answers
317 views

Raspbian source code

I´m using Raspbian on RaspBerry Pi and it´s working ok, but now I want to modify the distro according to my needs. I know the source for the kernel is found in kernel.org, but I haven't been able to ...
2
votes
2answers
251 views

nanosleep won't sleep short time

I trying to toggle one of my GPIO pins at a specific frequency, at the kHz range. I set up the wiringPi Library, the blinking example seems to work just fine.So I modified the code, so it will ...
1
vote
1answer
136 views

I2C: Raspberri pi as a Slave

I am trying to make two raspberry pi communicate through I2C protocol. I got little information that how I can code as a master in C using i2c-dev.h. So my question is how to make one of my raspberry ...
1
vote
1answer
346 views

sample speed i2c

If running standard release of debian on my Rpi. How fast can I sample the sensor readings through i2c and save values? Why Im asking, I tried to read a DS18B20 and save it,s values (wrote the ...
1
vote
2answers
101 views

Control robot over WiFi

I am working on a small robot that is driven using a joystick. As of now the joystick is connected to the Pi via USB and is driving the servos as intended. What I would like to do is get rid of the ...
1
vote
0answers
151 views

va_arg with double returns wrong value

In the tests for blocks runtime implementation, I'm having a test fail because a block that takes a variable number of arguments is not getting the right value for a double that is passed in. The ...
0
votes
2answers
176 views

How to compile C files in terminal

Question Can someone please tell me how to compile from the command line in a clear, concise way. Preferably, my programs will be written in a real text editor (such as leaf pad). Background I am a ...
0
votes
1answer
78 views

Where is my mistake?

I am trying to run a c program which will wait for me to hit a key on a 4x4 keypad and then display the number I have hit. The program I have bit runs but ends just as soon as I start it and I can't ...
0
votes
1answer
33 views

Speed up C code running USB webcam

I have some code that I have adapted to run on a headless Rpi using a usb webcam, it is running a bit slow, so my questions are: If I were to use the GPI pins with a dedicated webcam would that be ...
0
votes
0answers
105 views

Using the wiringPi I2C Library

I am trying to figure out how this library works (https://projects.drogon.net/raspberry-pi/wiringpi/i2c-library/) . Firstly, what is int fd that all the functions require. It is never stated. I can't ...
0
votes
0answers
66 views

Share screen from my laptop to raspberry pi

Can i get the screen buffers(screen share kind of software) from my laptop and send it to raspberry pi via as video packets over network which displays it. ( I have read bits on SIP , and i don't want ...