added syntax parser to pick up my 'uint8' and fixed typos

This commit is contained in:
2025-01-16 08:11:41 -05:00
parent e01c1b971a
commit 31429c8bea
3 changed files with 576 additions and 4 deletions
+8 -4
View File
@@ -38,7 +38,7 @@ that can be implemented on a small microcontroller.
### Audience
These techniques can be applied by anyone with experience in ***C***,
***Python*** or any modern computer language.
***Python***, ***Rust*** or any modern computer language.
It helps to have a passing knowledge of how to connect a transducer
(button, LED, buzzer, etc) to a microcontroller.
@@ -70,8 +70,12 @@ Yspring MDT1x, EastSoft HR7P, Holtek Ht68.)*
![Here](blb.jpg) is a typical board hosting 12 buttons, 12 RGB LEDs, all hosted
by an STM32. Every light and button can be controlled separately
and simultaneously, using the technique described in this paper.
The source of this paper can be found at
[my git repository](https://wiki.pbeirne.com/patb/cmt)
</details>
## The Problem
Let's suppose we want to flash an LED at 1 flash/2 sec,
@@ -259,8 +263,8 @@ The `newEvent(evt)` routine simply adds the `evt` to the array `events[]`.
Something like this might work:
```C
void newEvent(uint8r evt) {
static unsigned uint8 nextEvent;
void newEvent(uint8 evt) {
static uint8 nextEvent;
events[nextEvent++] = evt;
if (nextEvent == NUM_EVENTS)
nextEvent = 0;
@@ -279,7 +283,7 @@ Here's a more realistic version:
```C
void newEvent(char evt) {
static unsigned char nextEvent; // keep track of where we are in queue
static uint8 nextEvent; // keep track of where we are in queue
disable_irq(); // critical section
events[nextEvent++] = evt; // insert event into queue
if (nextEvent == NUM_EVENTS) // loop back to the start of queue