# Decorators Differences | |
https://stackoverflow.com/questions/35572663/using-python-decorator-with-or-without-parentheses |
Mutexes, Semaphores, etc. are provided by the operating system as a means of synchronization. Their behavior is handled by the operating system.
Normally, on windows/freeRTOS, the scheduler will not context switch into a thread that is waiting on a synchronization object.
See here for windows https://docs.microsoft.com/en-us/windows/desktop/procthread/context-switches
// TopicMatch.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <vector> | |
#include <string> | |
#include <iostream> | |
using namespace std; |
In order to include modules from another directory, import the directory w.r.t. the 'doc' directory. E.g. if you put the docs
folder in the top level directory of the project, the sphinx interpreter runs in the docs
directory. Thus, to import the top level directory, import ..
. If you want to import a folder within the top level directory import ../<folder>
.
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
Tolerances are usually given as absolutes. I.e. No uncertainty. This is specified in by the American Society of Mechanical Engineers (ASME), although, it could probably be specified case to case. See this thread on the discussion https://www.eng-tips.com/viewthread.cfm?qid=176582. That thread references ASME Y14.5M-1994, section 2.5, Interpretation of Limits.
A newer version of that document is http://www-eng.lbl.gov/~shuman/NEXT/ANGEL2/ASME-Y14-5M-2004-Dimension-Ing-and-Tolerancing.pdf.
I was trying to understand the clocking mechanism in the stm32l0 (among other stms). I was trying to figure out how I would know to enable, e.g. __HAL_RCC_GPIOA_CLK_ENABLE
when modifying certain registers.
I found the answer in memory map section, which specifies which peripheral each memory mapped region belongs. Turns out GPIOH is its own peripheral, (I assume, although not explicitly stated, that 'GPIOH' is the peripheral that handles the multiplexing of physical pins.)
Copied from section 2.2.2 of Stm32l0x reference manual.
Memory map and register boundary addresses
See the datasheet corresponding to your device for a comprehensive diagram of the
I thought it was weird that some software/libs/frameworks take executable code as config, but I recently read a blog talking about DSLs and config files with conditionals and statements.
It talked about how certain programs provide a DSL in their yaml configs (obviously in-house for each program). These DSLs are not portable because every system rolls their own.
Article here, https://blog.earthly.dev/intercal-yaml-and-other-horrible-programming-languages/
For example, Webpack can take config as an executable javascript file. I always thought that was weird (not bad), but I think I much prefer it to a DSL embedded in yaml or JSON.
I've been thinking about a way to write code that is both dependency free and blocking free for several use cases. (A serial protocol for example)
I've seen solutions where the dependencies are injected into the library code, and the library calls the dependency that way, but if the library is expecting polling, or blocking behavior, that isn't good. E.g. If a uart driver needs a delay(ms)
function, that's bad; I don't want the uart driver to block.
Instead, I imagine the library code to return instructions back to the app code, describing what the app should do. (redux-saga for react does something like this, where they return 'effects' - I like that)
So instead of the library code blocking with the delay function - return an 'effect' (stealing redux-saga terms) describing how long to wait. TASK_WAIT_10MS
or something like that. It doesn't have to be the returned value, but the idea is that the library code communicates what it needs from the user.