This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
#include <chrono> | |
void synced(const std::string& s, unsigned int n = 0) { | |
std::cout.sync_with_stdio(true); | |
while (n--) std::cout << s << std::endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <type_traits> | |
template <typename ... > struct my_tuple {}; | |
template <typename T, typename ... Ts> | |
struct my_tuple<T, Ts...> : my_tuple<Ts...> { | |
typedef T type; | |
type value; | |
my_tuple(T t, Ts ... ts) : value(t), my_tuple<Ts...>(ts...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXE=ttt | |
CC=gcc | |
all: $(EXE) | |
%.o: %.c | |
$(CC) -std=c99 -g -c -o $@ $< -I. | |
$(EXE): nega_tests.o | |
$(CC) -o $(EXE) $< -lm -g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#include <avr/power.h> | |
#include <avr/interrupt.h> | |
#include "pca.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (uint16_t i = 0; i < 256; i++) { | |
sin_table[i] = (cos(i/2)*sin(i))*31 + 32; | |
} | |
while(1) { | |
pcd8544_gotoxy(&lcd, 0, 0); | |
for (uint8_t x = 0; x<PCD8544_W; x++) { | |
for (uint8_t y = 0; y<PCD8544_H; ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint8_t buffer[(PCD8544_W * PCD8544_H) >> 3] = {0x00}; | |
for (uint8_t x = 0; x < PCD8544_W; x++) { | |
for (uint8_t y = 0; y < PCD8544_H; y++) { | |
if (common_ditherPoint(((float)y/PCD8544_H)*64, x, y)) | |
PCD8544_SET_BIT_HIGH(buffer, x, y); | |
} | |
} | |
pcd8544_blit(&lcd, buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint8_t buffer[(PCD8544_W * PCD8544_H) >> 3] = {0x00}; | |
for (uint8_t x = 0; x < PCD8544_W; x++) { | |
for (uint8_t y = 0; y < PCD8544_H; y++) { | |
if (!(x&y)) PCD8544_SET_BIT_HIGH(buffer, x, y); | |
} | |
} | |
pcd8544_blit(&lcd, buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <util/delay.h> | |
#include <math.h> | |
#include "main.h" | |
#include "pca.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "cli.h" | |
#include <string.h> | |
#include <stdio.h> | |
#define POSINC(__x) (((__x) < (CLI_CMD_BUFFER_SIZE - 1)) ? (__x + 1) : (__x)) | |
#define POSDEC(__x) ((__x) ? ((__x) - 1) : 0) | |
/* ================================================================================ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static unsigned char _cli_count_arguments(t_cli_ctx *a_ctx) { | |
char *cur = a_ctx->cmd; | |
unsigned char cnt = 0; | |
for(;;) { | |
while (*cur == ' ') cur++; | |
if (*cur == '\0') break; | |
cnt++; | |
while (*cur != '\0' && *cur != ' ') { | |
cur++; | |
} |
NewerOlder