added summary block

This commit is contained in:
2024-11-24 16:35:05 +05:30
parent c6b07ae2f7
commit 61dcb7ac2c

View File

@@ -1,3 +1,5 @@
Add table of contents
## Blinky ## Blinky
The classic, helloWorld of embedded programming. This program turns the LED on and off periodically. The classic, helloWorld of embedded programming. This program turns the LED on and off periodically.
@@ -134,7 +136,7 @@ The rest of the code is similar to the prior examples, which toggles the LEDS on
## ToggleBlinky ## ToggleBlinky
This example uses `gpio_get_out_level` to to get the output level for gicen given gpio port. The above example can be simplified by using this function call, as below. This example uses `gpio_get_out_level` to to get the output level for gicen given gpio port. The above example can be simplified by using this function call, as below. This function will be covered in DigitalIn.md as well.
```c ```c
int LED1 = 11; int LED1 = 11;
@@ -227,7 +229,7 @@ Code to turn the fan on and off with a 2 second delay:
## Binary LED Counter ## Binary LED Counter
This example uses 5 LEDS to visualize a 5 bit binary counter. Mask commands are used to set the LEDS simultaneously. This example again uses 5 LEDS to visualize a 5 bit binary counter. Mask commands are used to set the LEDS simultaneously.
```c ```c
int pinMask = 0b1111100000000000; int pinMask = 0b1111100000000000;
@@ -246,3 +248,31 @@ while (true)
`gpio_put_masked` has similar characteristics as other masked functions. This will set the output pins according to the second argument simultaneously, `counter<<11` in this case. Counter is left shifted by 11 bits to align with the mask. `gpio_put_masked` has similar characteristics as other masked functions. This will set the output pins according to the second argument simultaneously, `counter<<11` in this case. Counter is left shifted by 11 bits to align with the mask.
if counter is `11001`, `counter<<11` will be `1100100000000000`. if counter is `11001`, `counter<<11` will be `1100100000000000`.
---
## Summary
Below are the API calls used in this document:
### Initializing Calls:
| API call | Arguments | Definition |
| - | - | - |
| `gpio_init` | GP# | Initializes GP# pin |
| `gpio_set_dir` | GP#, <GPIO_IN/GPIO_OUT> | Sets the direction of GP# pin to either read or write |
| `gpio_set_drive_strength` | GP#, GPIO_DRIVE_STRENGTH_#MA | Sets the drive strength of GP# pin to given value |
| `gpio_init_mask` | GP_MASK | Initializes the GP pins highlighted by GP_MASK |
| `gpio_set_dir_masked` | GP_MASK, DIR_MASK | Sets the direction of GP pins highlighted by GP_MASK according to DIR_MASK |
### Controlling Calls:
| API call | Arguments | Definition |
| - | - | - |
| `gpio_put` | GP#, <true/false> | Sets the GP# pin to HIGH or LOW |
| `gpio_put_masked` | GP_MASK, DIR_MASK | Sets the GP pins highlighted by GP_MASK according to DIR_MASK |
### MISC Calls:
| API call | Arguments | Definition |
| - | - | - |
| `sleep_ms` | TIME | Pauses the program for given number of milli-seconds when called |
| `stdio_init_all` | -- | Initializes stuff |