Skip to content

Instantly share code, notes, and snippets.

View eliaskanelis's full-sized avatar

Elias Kanelis eliaskanelis

View GitHub Profile
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
static bool bitmask_writeU32( uint32_t *const address, const uint32_t mask,
const uint32_t pos, const uint32_t value )
{
const bool success = ( ( address != NULL ) && ( pos < 32U ) );
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
typedef struct
{
float dampingFactor;
float dampingCoeff;
float target;
@eliaskanelis
eliaskanelis / gist:8af7a66558c0361381c8532fb10bf4da
Created January 14, 2024 20:20
Register operations with I2C
#include <stdio.h>
#include <stdint.h>
void printb(const char* name, const uint16_t value) {
printf("%s: 0b", name);
for (int i = 15; i >= 0; --i) {
printf("%d", (value >> i) & 1);
}
printf("\n");
}
#include <stdio.h>
#include <string.h>
char buffer[] ="\n\
source state,1\n\
source state,2\n\
source state,3\n\
source state,4\n\
\n\