4 Numbers and Variables

Now that we have written a trivial program or two, it’s time to get the machine to do some real work. In this chapter you will learn how to manipulate numbers.

As embedded programmers, we are concerned with exactly what the numbers are doing. For example, the number 32 could represent the number of sheep in a barnyard, or it could energize GPIO pin #4, which turns on the big red warning light. What’s worse, our STM32 groups up to 32 different GPIOs into a single number, so while 32 might tell the device to “turn on the big red light,” 34 could tell it to “turn on the big red light and sound the klaxon.” To control ...

Get Bare Metal C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.