No ACL setup yet! Denying access to everyone.
en:edu:zmitac:s2:aih:lab:nrf52zephyrtimers
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:edu:zmitac:s2:aih:lab:nrf52zephyrtimers [2023/12/06 23:03] – [Reading the status of the timer] ktokarz | en:edu:zmitac:s2:aih:lab:nrf52zephyrtimers [2023/12/06 23:05] (current) – [Timer use] ktokarz | ||
|---|---|---|---|
| Line 19: | Line 19: | ||
| void led_timer_function(struct k_timer *timer_id) | void led_timer_function(struct k_timer *timer_id) | ||
| { | { | ||
| - | gpio_pin_set(led_dev, | + | gpio_pin_set(led_dev, |
| - | led1_is_on = !led1_is_on; | + | |
| } | } | ||
| </ | </ | ||
| Line 157: | Line 157: | ||
| then the function for the work item must be defined: | then the function for the work item must be defined: | ||
| < | < | ||
| - | void my_work_item_function(struct k_work *my_work_item){ | + | void my_work_item_function(struct k_work *my_work_item) |
| - | printk(" | + | { |
| + | | ||
| } | } | ||
| </ | </ | ||
| Line 178: | Line 179: | ||
| < | < | ||
| for (int i=0; i<40; i++) | for (int i=0; i<40; i++) | ||
| - | { | + | { |
| - | printk(" | + | |
| - | | + | } |
| </ | </ | ||
| 3. Observe the results while adjusting the max iteration value, and explain observations in the report.\\ | 3. Observe the results while adjusting the max iteration value, and explain observations in the report.\\ | ||
| - | 4. Add at the end of led_timer_function the line shown below and observe the behaviour of the program. < | + | 4. Add at the end of led_timer_function the line shown below and observe the behaviour of the program. |
| + | < | ||
| 5. Define two work items with their functions. One for the code from the timer function, and the second for the code from the main function. Instead of executing the full code in the timer and main function submit corresponding work items. The code for the timer work item can look as follows (the code for the main function as well as the work items definition and initialization write on your own). Experiment with the maximal iteration value in the " | 5. Define two work items with their functions. One for the code from the timer function, and the second for the code from the main function. Instead of executing the full code in the timer and main function submit corresponding work items. The code for the timer work item can look as follows (the code for the main function as well as the work items definition and initialization write on your own). Experiment with the maximal iteration value in the " | ||
| < | < | ||
| Line 197: | Line 199: | ||
| for (int i=0; i<40; i++) | for (int i=0; i<40; i++) | ||
| { | { | ||
| - | printk(" | + | printk(" |
| - | k_msleep(1); | + | |
| } | } | ||
| } | } | ||
en/edu/zmitac/s2/aih/lab/nrf52zephyrtimers.1701900204.txt.gz · Last modified: by ktokarz
