Skip to content

Instantly share code, notes, and snippets.

@aklsh
Created May 24, 2023 14:42
Show Gist options
  • Save aklsh/2e5810cfe7d2977227e6f9e2e7933998 to your computer and use it in GitHub Desktop.
Save aklsh/2e5810cfe7d2977227e6f9e2e7933998 to your computer and use it in GitHub Desktop.
// Resume project - RNG in ARM processor
int main(){
while(1){
a = read_pin(1)
b = read_pin(2)
c = read_pin(3)
num = (a<<2) | (b<<1) | (c);
}
return 0;
}
// given a number, turn all bits of that number in positions [start, stop] to 1.
long int fun(long int a, int start, int stop){
for(int i=start;i<=stop;i++){
a = a | (1<<i);
}
return a;
}
// given a number, return the next higher multiple of 256.
// e.g.: 120 -> 256
// 300 -> 512
// 256 -> your choice (i choose 512 :))
int fun2(int num){
num = num >> 8;
num += 1;
return (num << 8);
}
// - What is an interrupt? How is it handled - what happens when an interrupt occurs?
// - What is RTOS?
// - What is a semaphore?
// - What is a mutex?
// Overall Time: 15-20 mins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment