repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
natflausino/cub3D
src/bonus/walls_bonus.c
<filename>src/bonus/walls_bonus.c #include "../../includes/bonus/cub3d_bonus.h" void draw_strip(t_game *game, int x, int side, int strip_height) { int color; int i; int x_tex; int y_tex; int start; i = 0; start = (game->file.height / 2) - (strip_height / 2); game->end = (game->file.height / 2) + (strip_h...
natflausino/cub3D
libraries/libft/srcs/libft/ft_putstr.c
<filename>libraries/libft/srcs/libft/ft_putstr.c #include "libft.h" void ft_putstr(char *s) { size_t len; size_t i; if (!s) return ; i = 0; len = ft_strlen(s); while (i < len) { ft_putchar(*(s + i)); i++; } }
natflausino/cub3D
src/bonus/bitmap_bonus.c
<filename>src/bonus/bitmap_bonus.c #include "../../includes/bonus/cub3d_bonus.h" void image_header(t_bmp *bmp, int file) { unsigned char str[54]; ft_bzero(str, 54); ft_memcpy(str, "BM", 2); ft_memcpy(str + 2, &bmp->file_size, 4); ft_memcpy(str + 10, &bmp->offset_bits, 4); ft_memcpy(str + 14, &bmp->size_header, ...
natflausino/cub3D
src/mandatory/player.c
#include "../../includes/mandatory/cub3d.h" double normalize_angle(double angle) { double norm_angle; norm_angle = remainder(angle, 2 * PI); if (norm_angle < 0) { norm_angle = (2 * PI) + norm_angle; } return (norm_angle); } void move_player(t_game *game) { double move_ws; double move_ad; double px; doubl...
natflausino/cub3D
src/bonus/parsing_map_bonus.c
#include "../../includes/bonus/cub3d_bonus.h" void count_arg(t_game *game, int fd) { if (game->file.args != 8) { return_error(-18); } if (game->floor_bool == 0 || game->celling_bool == 0) { return_error(-24); } } void map_extract(t_game *game, char *line, int fd) { char *str; char *tmp; char *new_line; ...
natflausino/cub3D
includes/mandatory/cub3d.h
#ifndef CUB3D_H # define CUB3D_H /****************************************************************************** ** LIBRARIES ******************************************************************************/ # include <math.h> # include <stdio.h> # include <float.h> # include <stdbool.h> # include <fcntl.h> # include "e...
natflausino/cub3D
src/mandatory/raycasting.c
#include "../../includes/mandatory/cub3d.h" void dist2wall(t_game *game, double horz_dist, double vert_dist) { game->ray.was_hit_v = 0; if (horz_dist < vert_dist) { game->ray.wall_dist = horz_dist; game->ray.wall_hitx = game->ray.hit_hx; game->ray.wall_hity = game->ray.hit_hy; } else { game->ray.wall_dis...
natflausino/cub3D
src/mandatory/events.c
#include "../../includes/mandatory/cub3d.h" int close_window(t_game *game) { free(game->ray.dist_wall); free(game->sprite); mlx_destroy_window(game->data.mlx, game->data.win); mlx_destroy_image(game->data.mlx, game->data.img); mlx_destroy_display(game->data.mlx); free(game->data.mlx); game->data.mlx = NULL; fr...
natflausino/cub3D
src/mandatory/sprites2.c
<reponame>natflausino/cub3D #include "../../includes/mandatory/cub3d.h" void sort_sprite(t_game *game) { int i; int j; double temp; i = -1; while (++i < game->num_sprite - 1) { j = i; if (game->sprite[i].dist < game->sprite[j + 1].dist) { temp = game->sprite[i].dist; game->sprite[i].dist = game...
natflausino/cub3D
src/bonus/sprite_and_textures_bonus.c
<reponame>natflausino/cub3D #include "../../includes/bonus/cub3d_bonus.h" char *type_define(int tex, int id) { char *type; char *temp; type = ft_itoa(id); if (tex == SP) temp = ft_strjoin("./text/sprites/sprite", type); else if (tex == LIFE) temp = ft_strjoin("./text/textures/hud/hearts_", type); else if (t...
natflausino/cub3D
libraries/libft/includes/libft.h
<gh_stars>1-10 #ifndef LIBFT_H # define LIBFT_H # include <unistd.h> # include <stdlib.h> # include <limits.h> # include <stdarg.h> # include <sys/param.h> # include <sys/resource.h> //# define MAX_FILE_DESCRIPTOR RLIMIT_NOFILE //# define BUFFER_SIZE 32 # define READ_LINE 1 # define NEW_LINE 1 # define NO_NEW_LINE...
natflausino/cub3D
libraries/libft/srcs/libft/ft_strlcpy.c
#include "libft.h" size_t ft_strlcpy(char *dest, const char *src, size_t destsize) { size_t srcsize; size_t i; if (!dest || !src) return (0); srcsize = ft_strlen(src); i = 0; if (destsize != 0) { while (src[i] != '\0' && i < (destsize - 1)) { dest[i] = src[i]; i++; } dest[i] = '\0'; } return ...
natflausino/cub3D
src/bonus/walls2_bonus.c
#include "../../includes/bonus/cub3d_bonus.h" int is_wall(t_game *game, int x, int y) { int block_size; int x_map; int y_map; block_size = game->block; x_map = (x / block_size); y_map = (y / block_size); return (game->file.tab[y_map][x_map]); } int check_wall(t_game *game, double new_x, double new_y) { int x...
natflausino/cub3D
src/bonus/special_wall_bonus.c
#include "../../includes/bonus/cub3d_bonus.h" int special_wall(t_game *game, int color) { if (game->life == 1) color = 0xb48c36; if (game->life == 0) color = 0x3f403f; if (game->item == 6 && game->life != 0) color = 0xffce66; return (color); } int special_floor(t_game *game, int color) { if (game->life == ...
natflausino/cub3D
src/mandatory/raycasting2.c
<filename>src/mandatory/raycasting2.c #include "../../includes/mandatory/cub3d.h" void check_horiz(t_game *game, int *horzhit) { double next_x; double next_y; next_x = game->ray.interc_x; next_y = game->ray.interc_y; while (next_x >= 0 && next_x < (game->block * game->file.map_col) && next_y >= 0 && next_y < (...
natflausino/cub3D
libraries/libft/srcs/libft/ft_memcpy.c
#include "libft.h" void *ft_memcpy(void *dest, const void *src, size_t n) { size_t i; i = 0; if (!dest && !src) return (0); while (i < n) { ((unsigned char *)dest)[i] = ((unsigned char *)src)[i]; i++; } return (dest); }
natflausino/cub3D
libraries/libft/srcs/libft/ft_strtrim.c
#include "libft.h" char *ft_strtrim(char const *s1, char const *set) { size_t i; if (!s1 || !set) return (0); while (*s1 && ft_strchr(set, *s1)) s1++; i = ft_strlen(s1); while (i && ft_strchr(set, s1[i])) i--; return (ft_substr(s1, 0, i + 1)); }
natflausino/cub3D
src/bonus/effect_bonus.c
#include "../../includes/bonus/cub3d_bonus.h" void damage_cure(t_game *game, int x, int y, int dist) { if (is_wall(game, x - dist, y - dist) == '3' || is_wall(game, x + dist, y - dist) == '3' || is_wall(game, x - dist, y + dist) == '3' || is_wall(game, x + dist, y + dist) == '3') game->sprite->damage = 1; if...
natflausino/cub3D
src/mandatory/parsing_file.c
#include "../../includes/mandatory/cub3d.h" char *full_line(t_game *game, char *line) { int i; int size_line; char *tmp; tmp = line; size_line = ft_strlen(line); i = 0; if (size_line < game->file.map_col) { line = (char *)ft_calloc(1, sizeof(char) * (game->file.map_col + 1)); while (i < game->file.map_c...
natflausino/cub3D
src/bonus/sprites3_bonus.c
#include "../../includes/bonus/cub3d_bonus.h" void render_sprite(t_game *game) { sort_sprite(game); sprite_angle(game); sprite_param(game); } void free_sprites(t_game *game) { int i; char *type; i = 0; if (game->sprite) { while (i < game->total_sprites) { if (game->sprite[i].tex.img) { mlx_des...
natflausino/cub3D
src/bonus/minimap_bonus.c
<filename>src/bonus/minimap_bonus.c #include "../../includes/bonus/cub3d_bonus.h" void image_put_pixel(t_game *game, int x, int y, int color) { char *pixel; pixel = game->data.addr + 2 * (y * (game->data.line_len / 8)) + (x * (game->data.bpp / 32)); *(unsigned int *)pixel = color; } void draw_rect(t_game *gam...
natflausino/cub3D
libraries/libft/srcs/libft/ft_memset.c
<reponame>natflausino/cub3D #include "libft.h" void *ft_memset(void *s, int c, size_t n) { size_t i; unsigned char *pointer; i = 0; pointer = (unsigned char *)s; while (i < n) { ((unsigned char *)s)[i] = c; i++; } return (s); }
natflausino/cub3D
src/mandatory/walls.c
<reponame>natflausino/cub3D<gh_stars>1-10 #include "../../includes/mandatory/cub3d.h" void draw_strip(t_game *game, int x, int side, int strip_height) { int color; int i; int x_tex; int y_tex; int start; i = 0; start = (game->file.height / 2) - (strip_height / 2); game->end = (game->file.height / 2) + (s...
ElFuchito/react-native-insta-story
ios/InstaStory.h
<reponame>ElFuchito/react-native-insta-story // InstaStory.h #import <React/RCTViewManager.h> @interface InstaStory : RCTViewManager @end
ApsaraDB/PolarDB-for-PostgreSQL
src/include/storage/polar_bufmgr.h
/*------------------------------------------------------------------------- * * polar_bufmgr.h * Polardb buffer manager definitions. * * * Copyright (c) 2021, Alibaba Group Holding Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance wi...
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/TestDownloadAPI.h
<reponame>Fuqingshan/ZCNetwork // // TestDownloadAPI.h // ZCNetwork // // Created by yier on 2019/10/24. // Copyright © 2019 yier. All rights reserved. // #import "ZCBaseAPI.h" NS_ASSUME_NONNULL_BEGIN @interface TestDownloadAPI : ZCBaseAPI @end NS_ASSUME_NONNULL_END
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/Helper/ZCHelper.h
// // ZCHelper.h // ZCNetwork // // Created by yier on 2019/10/22. // Copyright © 2019 yier. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @interface ZCHelper : NSObject + (NSString *)idfa; + (NSString *)idfv; + (NSString *)platform;///<iphone or ipad + (NSString *)clientV...
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/Cookies/ZCCommonCookies.h
// // ZCCommonCookies.h // ZCNetwork // // Created by yier on 2019/10/22. // Copyright © 2019 yier. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @interface ZCCommonCookies : NSObject + (NSDictionary *)commonCookies; + (NSString *)cookiesWithParams:(NSDictionary *)params; @...
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/URLSession/ZCFileModel.h
<gh_stars>0 // // ZCFileModel.h // ZCNetwork // // Created by yier on 2019/10/24. // Copyright © 2019 yier. All rights reserved. // #import <Foundation/Foundation.h> @interface ZCFileModel : NSObject //上传文件方式,fileURL和fileData 二选一 @property(nonatomic, strong) NSURL *fileURL;///<本地文件数据保存的路径,下载时不能为空 @property(nonato...
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/Serializer/ZCJSONRequestSerializer.h
// // ZCJSONRequestSerializer.h // ZCNetwork // // Created by yier on 2019/10/22. // Copyright © 2019 yier. All rights reserved. // #import <AFNetworking/AFNetworking.h> NS_ASSUME_NONNULL_BEGIN @interface ZCJSONRequestSerializer : AFJSONRequestSerializer @end NS_ASSUME_NONNULL_END
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/URLSession/ZCHTTPSessionManager.h
// // ZCHTTPSessionManager.h // ZCNetwork // // Created by yier on 2019/10/22. // Copyright © 2019 yier. All rights reserved. // #import <AFNetworking/AFNetworking.h> /** ZCPinningModeNone: App Transport Security Settings -> Allow Arbitrary Loads -> YES ZCPinningModeOneself: App Transport Security Settings -> Exce...
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/AppDelegate.h
<gh_stars>0 // // AppDelegate.h // ZCNetwork // // Created by yier on 2019/10/25. // Copyright © 2019 yier. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @end
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/URLSession/ZCBaseAPI.h
// // ZCBaseAPI.h // ZCNetwork // // Created by yier on 2019/10/22. // Copyright © 2019 yier. All rights reserved. // #import <Foundation/Foundation.h> #import <ReactiveObjC/ReactiveObjC.h> #import "ZCHTTPSessionManager.h" FOUNDATION_EXTERN NSString * const ZCHTTPMethod_GET; FOUNDATION_EXTERN NSString * const ZCH...
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/ZCNetwork.h
// // ZCNetwork.h // ZCNetwork // // Created by yier on 2019/10/22. // Copyright © 2019 yier. All rights reserved. // #ifndef ZCNetwork_h #define ZCNetwork_h #import "ZCBaseAPI.h" #import "ZCFileModel.h" #import "ZCJSONRequestSerializer.h" #import "ZCJSONResponseSerializer.h" #endif /* ZCNetwork_h */
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/Serializer/ZCJSONResponseSerializer.h
<reponame>Fuqingshan/ZCNetwork // // ZCJSONResponseSerializer.h // ZCNetwork // // Created by yier on 2019/10/22. // Copyright © 2019 yier. All rights reserved. // #import <AFNetworking/AFNetworking.h> NS_ASSUME_NONNULL_BEGIN @interface ZCJSONResponseSerializer : AFJSONResponseSerializer @end NS_ASSUME_NONNULL...
Fuqingshan/ZCNetwork
ZCNetwork/ZCNetwork/HTTPNetwork/ZCNetworkDefine.h
<reponame>Fuqingshan/ZCNetwork // // ZCNetworkDefine.h // ZCNetwork // // Created by yier on 2019/10/24. // Copyright © 2019 yier. All rights reserved. // #ifndef ZCNetworkDefine_h #define ZCNetworkDefine_h typedef NS_ENUM(NSInteger,ZCJSONError){ ZCJSONErrorUnkonw = -700000, ZCJSONErrorResultError = -700...
aignas/rules_go
tests/core/c_linkmodes/crypto_test_dl.c
<reponame>aignas/rules_go<gh_stars>1000+ #include <dlfcn.h> #include <stdio.h> #ifndef SO #error No SO path defined #endif int main() { void* handle = dlopen(SO, RTLD_NOW); if (!handle) { printf("dlopen: %s\n", dlerror()); return 1; } typedef void (*gofn_t)(); gofn_t gofn = (gofn_t)dlsym(handle, "G...
aignas/rules_go
tests/core/cgo/add.c
<reponame>aignas/rules_go #include <add.h> #include <generated_cppopts.h> #include <generated_copts.h> #if !defined(RULES_GO_C) || !defined(RULES_GO_CPP) || defined(RULES_GO_CXX) #error This is a C file, only RULES_GO_C and RULES_GO_CPP should be defined. #endif #if !defined(GENERATED_COPTS) || !defined(GENERATED_CPP...
aignas/rules_go
tests/core/c_linkmodes/add_test_archive.c
<gh_stars>1000+ #include <assert.h> #include "tests/core/c_linkmodes/adder_archive.h" #ifndef CGO_EXPORT_H_EXISTS #error cgo header did not include define #endif int main(int argc, char** argv) { assert(GoAdd(42, 42) == 84); return 0; }
aignas/rules_go
tests/core/go_embed_data/error.c
#error do not compile
aignas/rules_go
tests/core/cgo/split_import_c.h
#ifndef split_import_c #define split_import_c int half(int); #endif
aignas/rules_go
tests/core/cgo/split_import_c.c
int half(int x) { return x/2; }
ProgMiner/ipscanner
linux.c
/* MIT License Copyright (c) 2018 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distrib...
ProgMiner/ipscanner
util.c
<reponame>ProgMiner/ipscanner /* MIT License Copyright (c) 2018 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, m...
ProgMiner/ipscanner
options.c
/* MIT License Copyright (c) 2018 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distrib...
ProgMiner/ipscanner
win32.c
/* MIT License Copyright (c) 2018 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distrib...
ProgMiner/ipscanner
main.c
<reponame>ProgMiner/ipscanner /* MIT License Copyright (c) 2018 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, m...
chalos/c-logger
src/loggerconf.c
<gh_stars>10-100 #include "loggerconf.h" #include <assert.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "logger.h" enum { /* Logger type */ kConsoleLogger = 1 << 0, kFileLogger = 1 << 1, kMaxFileNameLen = 256, kMaxLineLen = 512, }; /* Console logger */ ...
chalos/c-logger
test/logger_console_test.c
<reponame>chalos/c-logger #include "logger.h" #include <stdio.h> #if defined(_WIN32) || defined(_WIN64) #include <io.h> #else #include <fcntl.h> #include <unistd.h> #endif /* defined(_WIN32) || defined(_WIN64) */ #include "nanounit.h" #if defined(_WIN32) || defined(_WIN64) #define dup _dup #define dup2 _dup2 #defin...
chalos/c-logger
src/loggerconf.h
#ifndef LOGGERCONF_H #define LOGGERCONF_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * Configure the logger with a configuration file. * If the filename is NULL, return without doing anything. * * The following is the configurable key/value list. * |key |value ...
chalos/c-logger
example/logger_console_example.c
#include "logger.h" int main(void) { logger_initConsoleLogger(stderr); logger_setLevel(LogLevel_DEBUG); LOG_INFO("console logging"); return 0; }
chalos/c-logger
src/logger.c
<filename>src/logger.c #include "logger.h" #include <assert.h> #include <stdarg.h> #include <stdlib.h> #include <time.h> #if defined(_WIN32) || defined(_WIN64) #include <winsock2.h> #else #include <pthread.h> #include <sys/time.h> #include <sys/syscall.h> #include <unistd.h> #endif /* defined(_WIN32) || defined(_W...
chalos/c-logger
test/loggerconf_test.c
#include "loggerconf.h" #include "logger.h" #include "nanounit.h" static void cleanup(void) { remove("conf.log"); } static int test_configure_empty(void) { int result = logger_configure("res/empty.conf"); nu_assert_eq_int(0, result); return 0; } static int test_configure_consoleLogger(void) { int...
chalos/c-logger
example/logger_file_example.c
#include "logger.h" int main(void) { logger_initFileLogger("log.txt", 1024 * 1024, 5); logger_setLevel(LogLevel_DEBUG); LOG_INFO("file logging"); LOG_DEBUG("format example: %d%c%s", 1, '2', "3"); return 0; }
chalos/c-logger
test/logger_loglevel_test.c
#include "logger.h" #include <stdio.h> #include "nanounit.h" static int test_trace(void) { /* when: */ logger_setLevel(LogLevel_TRACE); /* then: */ nu_assert_eq_int(LogLevel_TRACE, logger_getLevel()); nu_assert(logger_isEnabled(LogLevel_TRACE)); nu_assert(logger_isEnabled(LogLevel_DEBUG)); ...
chalos/c-logger
test/nanounit.h
<gh_stars>10-100 #ifndef NANOUNIT_H #define NANOUNIT_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include <stdio.h> #include <string.h> static char nu_message[1024]; static int nu_tests_runs = 0; static int nu_failures = 0; #define nu_fail() do { \ sprintf(nu_message, "%s:%d: fail", __FILE__, __L...
chalos/c-logger
example/logger_multi_example.c
#include "logger.h" #if defined(_WIN32) || defined(_WIN64) #include <windows.h> #else #include <unistd.h> #define Sleep(n) usleep((n) * 1000) #endif /* defined(_WIN32) || defined(_WIN64) */ static const int kLoggingCount = 10; int main(void) { int i = 0; logger_initConsoleLogger(NULL); logger_initFile...
chalos/c-logger
test/logger_file_test.c
#include "logger.h" #include <stdio.h> #include "nanounit.h" static const char kOutputFileName[] = "file.log"; static void setup(void) { remove(kOutputFileName); } static void cleanup(void) { remove(kOutputFileName); } static int test_initFailed(void) { int result; /* when: configure the empty file...
chalos/c-logger
example/loggerconf_example.c
<gh_stars>10-100 #include <stdio.h> #include "logger.h" #include "loggerconf.h" int main(int argc, char* argv[]) { char filename[256]; if (argc <= 1) { printf("usage: %s <conf file>\n", argv[0]); return 1; } strncpy(filename, argv[1], strlen(argv[1])); logger_configure(filename); ...
DominicMDev/CrashlyticsRecorder
Example/Pods/Target Support Files/Pods-CrashlyticsRecorder_Tests/Pods-CrashlyticsRecorder_Tests-umbrella.h
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double Pods_CrashlyticsRecorder_TestsVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_Crashlytics...
DominicMDev/CrashlyticsRecorder
Example/Pods/Target Support Files/CrashlyticsRecorder/CrashlyticsRecorder-umbrella.h
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double CrashlyticsRecorderVersionNumber; FOUNDATION_EXPORT const unsigned char CrashlyticsRecorderVersionS...
mc18g13/teensy-drone
common/test/MenuOption/MenuOption.h
#ifndef MENU_OPTION #define MENU_OPTION #include <Arduino.h> #include <functional> #include "Constants.h" class IMenuOption { public: virtual void callback() = 0; virtual void printMessage() = 0; }; template<typename Type> class MenuOption : public IMenuOption { public: MenuOption( Type* instance, void...
mc18g13/teensy-drone
test-cli/lib/FilterTest/FilterTest.h
#ifndef FILTER_TEST_HANDLER #define FILTER_TEST_HANDLER #include "MenuOptionHandler.h" class FilterTest : public MenuOptionHandler { public: FilterTest(); virtual void setup() override; virtual void printTitle() override; void runFilter(); }; #endif
mc18g13/teensy-drone
calibration-cli/lib/MARGCalibrationHandler/MARGCalibrationHandler.h
<reponame>mc18g13/teensy-drone<filename>calibration-cli/lib/MARGCalibrationHandler/MARGCalibrationHandler.h #ifndef MARG_CALIBRATION_HANDLER #define MARG_CALIBRATION_HANDLER #include <SPI.h> #include <MARG.h> #include <arm_math.h> #include <map> #include "MenuOptionHandler.h" #define SPI_CLOCK 8000000 // 8MHz clock ...
mc18g13/teensy-drone
common/lib/DynamicArray/DynamicArray.h
#ifndef DYNAMIC_ARRAY_H #define DYNAMIC_ARRAY_H template <typename Type> class DynamicArray { private: Type* m_data; size_t m_size; public: DynamicArray() : m_data(nullptr), m_size(0) { } ~DynamicArray() { delete [] m_data; } void append(Type newData) { int newDataSize = m_size + 1...
mc18g13/teensy-drone
common/lib/CircularBuffer/CircularBuffer.h
<filename>common/lib/CircularBuffer/CircularBuffer.h #ifndef CIRCULAR_BUFFER #define CIRCULAR_BUFFER #include <Arduino.h> #include "arm_math.h" #include "Constants.h" class CircularBuffer { private: int size; float32_t* data; bool m_hasFilledArray; int m_currentIndex; public: CircularBuffer(int arraySize);...
mc18g13/teensy-drone
test-cli/lib/MotorNoiseTest/MotorNoiseTest.h
<reponame>mc18g13/teensy-drone<filename>test-cli/lib/MotorNoiseTest/MotorNoiseTest.h #ifndef MOTOR_NOISE_TEST_HANDLER #define MOTOR_NOISE_TEST_HANDLER #include "MenuOptionHandler.h" #include "Constants.h" #include "MARG.h" // #include "MotorControlManager.h" // #include "MotorSignalController.h" #include "DShotMotor...
mc18g13/teensy-drone
test-cli/lib/MARGTest/MARGTest.h
<filename>test-cli/lib/MARGTest/MARGTest.h #ifndef MARG_TEST_HANDLER #define MARG_TEST_HANDLER #include "MenuOptionHandler.h" #include "MARG.h" class MARGTest : public MenuOptionHandler { private: MARG* m_marg; public: MARGTest(); ~MARGTest() { delete m_marg; } virtual void setup() override; virtua...
mc18g13/teensy-drone
common/lib/MemoryLocations/MemoryLocations.h
#define SIZE_FLOAT_32_T 4 #define MAG_START 0 #define MAG_COUNT 6 #define ACCEL_START (MAG_START + SIZE_FLOAT_32_T * MAG_COUNT) #define ACCEL_COUNT 6 #define ROLL_START (ACCEL_START + SIZE_FLOAT_32_T * ACCEL_COUNT) #define ROLL_COUNT 3 #define PITCH_START (ROLL_START + SIZE_FLOAT_32_T * ROLL_COUNT) #define PITCH_CO...
mc18g13/teensy-drone
drone/lib/Drone/Drone.h
#ifndef DRONE #define DRONE #include <Arduino.h> #include "Quaternion.h" #include "OrientationFilter.h" // #include "MotorControlManager.h" #include "ReceiverAligner.h" class Drone { public: Drone(); ~Drone(); void setup(); void start(); private: MARG m_marg; OrientationFilter m_orientationFilter; lo...
mc18g13/teensy-drone
common/lib/Math/Math.h
#ifndef _MATH_H #define _MATH_H class Math { public: static float fastInverseSquareRoot(float x) { float halfx = 0.5f * x; float y = x; long i = *(long*)&y; i = 0x5f3759df - (i>>1); y = *(float*)&i; y = y * (1.5f - (halfx * y * y)); return y; } static float mapfloat(float x, float in_min, f...
mc18g13/teensy-drone
common/lib/ReceiverManager/ReceiverManager.h
<filename>common/lib/ReceiverManager/ReceiverManager.h #ifndef RECEIVER_MANAGER #define RECEIVER_MANAGER #include <Arduino.h> #include "ReceiverPulseTimer.h" #include "MemoryLocations.h" #include "Math.h" #include "ReceiverAligner.h" namespace ReceiverManager { #define ROLL_PIN 2 #define PITCH_PIN 3 #define THR...
mc18g13/teensy-drone
common/lib/ReceiverAligner/ReceiverAligner.h
#ifndef RECEIVER_ALIGNER #define RECEIVER_ALIGNER #include "ReceiverPulseTimer.h" #include "arm_math.h" #include "Constants.h" class ReceiverAligner { public: ReceiverAligner(ReceiverPulseTimer* receiverTimer, float32_t minValue, float32_t maxValue, float32_t midValue) : m_timer(receiverTimer), min(minVal...
mc18g13/teensy-drone
common/lib/Constants/Constants.h
#ifndef CONSTANTS #define CONSTANTS // #define BLUETOOTH #ifdef BLUETOOTH #define DEBUG_SERIAL Serial1 #else #define DEBUG_SERIAL Serial #endif #include "arm_math.h" constexpr long LOOPTIME_US = 200; constexpr float32_t LOOPTIME_S = (float32_t)LOOPTIME_US / 1000000; constexpr float32_t THROTTLE_MAP_START = 0; cons...
mc18g13/teensy-drone
common/lib/IIRFilter/IIRFilter.h
#ifndef IIR_FILTER #define IIR_FILTER #include "CircularBuffer.h" #include "arm_math.h" class IIRFilter { private: const int m_size; float32_t const * m_inputCoefficientsB; float32_t const * m_outputCoefficientsA; CircularBuffer* m_accelerometerFilterInputsX; CircularBuffer* m_accelerometerFilterOutputsY; ...
mc18g13/teensy-drone
common/lib/MARG/MARG.h
#ifndef _MARG_H #define _MARG_H #include <Arduino.h> #include <EEPROM.h> #include <SPI.h> #include "MPU9250.h" #include "AccelerometerFilter.h" #include "GyroscopeFilter.h" #include "Vector.h" #define G 9.807f class MARG { public: MARG(bool accelerationSoftwareFilterOn = false, bool gyroSoftwareFiltersOn = f...
mc18g13/teensy-drone
common/lib/AccelerometerFilter/AccelerometerFilter.h
<filename>common/lib/AccelerometerFilter/AccelerometerFilter.h #ifndef ACCELEROMETER_FILTER #define ACCELEROMETER_FILTER #include "IIRFilter.h" class AccelerometerFilter { public: AccelerometerFilter(); ~AccelerometerFilter(); float32_t get(); void update(float32_t input); private: float32_t* m_inputCoeffi...
mc18g13/teensy-drone
common/lib/Quaternion/Quaternion.h
<reponame>mc18g13/teensy-drone #ifndef _QUATERNION_H #define _QUATERNION_H #include "Vector.h" #include <arm_math.h> #include "Math.h" class Vector; class Quaternion { public: float32_t q0 = 1; float32_t q1 = 0; float32_t q2 = 0; float32_t q3 = 0; Quaternion(); Quaternion(float32_t _q0, float3...
mc18g13/teensy-drone
common/test/MenuOptionHandler/MenuOptionHandler.h
<reponame>mc18g13/teensy-drone #ifndef MENU_OPTION_HANDLER #define MENU_OPTION_HANDLER #include <Arduino.h> #include <map> #include "MenuOption.h" #include "EEPROM.h" #include "MemoryLocations.h" #include "DynamicArray.h" class MenuOptionHandler { private: DynamicArray<IMenuOption*> m_options; bool m_shouldContinu...
mc18g13/teensy-drone
common/lib/GyroscopeFilter/GyroscopeFilter.h
#ifndef GYROSCOPE_FILTER #define GYROSCOPE_FILTER #include "IIRFilter.h" class GyroscopeFilter { public: GyroscopeFilter(); ~GyroscopeFilter(); float32_t get(); void update(float32_t input); void updateLow(float32_t input); float32_t getLow(); private: float32_t* m_inputCoefficientsBNotchFilter90hz; ...
mc18g13/teensy-drone
common/lib/DShotMotorController/DShotMotorController.h
<filename>common/lib/DShotMotorController/DShotMotorController.h #ifndef DSHOT_MOTOR_CONTROLLER_H #define DSHOT_MOTOR_CONTROLLER_H #include <Arduino.h> constexpr uint8_t FRONT_LEFT_MOTOR_PIN = 20; constexpr uint8_t FRONT_RIGHT_MOTOR_PIN = 21; constexpr uint8_t BACK_LEFT_MOTOR_PIN = 22; constexpr uint8_t BACK_RIGHT...
mc18g13/teensy-drone
common/lib/Vector/Vector.h
#ifndef _VECTOR_H #define _VECTOR_H #include "Math.h" #include "Quaternion.h" #include <arm_math.h> class Quaternion; class Vector { public: float32_t v0; float32_t v1; float32_t v2; Vector(); Vector(float32_t _v0, float32_t _v1, float32_t _v2); Vector minus(Vector v); Vector add(Vector ...
mc18g13/teensy-drone
drone/lib/OrientationFilter/OrientationFilter.h
<reponame>mc18g13/teensy-drone #ifndef _ORIENTATION_FILTER_H #define _ORIENTATION_FILTER_H #include "MARG.h" #include <Arduino.h> #include "Quaternion.h" #include <arm_math.h> class OrientationFilter { public: OrientationFilter(MARG* marg); void update(float32_t deltaT); float32_t getRoll(); float...
mc18g13/teensy-drone
calibration-cli/lib/ReceiverCalibrationHandler/ReceiverCalibrationHandler.h
#ifndef RECEIVER_CALIBRATION_HANDLER #define RECEIVER_CALIBRATION_HANDLER #include <arm_math.h> #include "MenuOptionHandler.h" #include "ReceiverPulseTimer.h" class ReceiverCalibrationHandler : public MenuOptionHandler { public: ReceiverCalibrationHandler(); virtual void setup() override; virtual void printTit...
mc18g13/teensy-drone
drone/lib/PIDController/PIDController.h
<gh_stars>0 #ifndef PID_CONTROLLER #define PID_CONTROLLER #include "arm_math.h" class PIDController { public: PIDController( const float32_t proportionalConstant, const float32_t integralConstant, const float32_t derivativeConstant, const float32_t outputLimit, const float32_t integralLimit); ...
mc18g13/teensy-drone
common/lib/MotorControlManager/MotorControlManager.h
<reponame>mc18g13/teensy-drone // #ifndef MOTOR_CONTROL_MANAGER // #define MOTOR_CONTROL_MANAGER // #include "MotorSignalController.h" // #define FRONT_LEFT_MOTOR_PIN 20 // #define FRONT_RIGHT_MOTOR_PIN 21 // #define BACK_LEFT_MOTOR_PIN 22 // #define BACK_RIGHT_MOTOR_PIN 23 // namespace MotorControlManager { // ...
mc18g13/teensy-drone
common/lib/MotorSignalController/MotorSignalController.h
#ifndef MOTOR_SIGNAL_CONTROLLER #define MOTOR_SIGNAL_CONTROLLER #include <TeensyDelay.h> #include <arm_math.h> class MotorSignalController { public: MotorSignalController(int outputPin) : pin(outputPin) { pinMode(outputPin, OUTPUT); } int pin; int channelIdHigh; int channelIdLow; int delay; ...
mc18g13/teensy-drone
common/test/MainMenuHandler/MainMenuHandler.h
#ifndef MAIN_MENU_HANDLER #define MAIN_MENU_HANDLER #include "MenuOptionHandler.h" #include "DynamicArray.h" #define EXIT_INDEX 0 class MainMenuHandler { public: void setup(); void start(); void addOptionHandler(MenuOptionHandler* menuOptionHandler); private: DynamicArray<MenuOptionHandler*> m_handlers; }...
mc18g13/teensy-drone
common/lib/ReceiverPulseTimer/ReceiverPulseTimer.h
<reponame>mc18g13/teensy-drone<filename>common/lib/ReceiverPulseTimer/ReceiverPulseTimer.h<gh_stars>0 #ifndef RECEIVER_PULSE_TIMER #define RECEIVER_PULSE_TIMER #include <Arduino.h> static constexpr uint32_t CPU_FREQUENCY_Hz = 600000000; static constexpr float32_t TICKS_TO_MICROS = (float32_t)1000000/CPU_FREQUENCY_Hz;...
larryli/u8g2-gb2312
src/u8g2_wqy.h
/** * https://github.com/larryli/u8g2_wqy */ #ifndef _U8G2_WQY_H #define _U8G2_WQY_H #include <stdint.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif #ifndef U8G2_USE_LARGE_FONTS #define U8G2_USE_LARGE_FONTS #endif #ifndef U8X8_FONT_SECTION #ifdef __GNUC__ # define U8X8_SECTION(name) __attribute__...
spather/no_engine_game
src/lib/include/error.h
#ifndef ERROR_H #define ERROR_H #include <string> namespace no_engine_game { namespace lib { class Error { public: Error(std::string message): message_(message) {} std::string getMessage() const { return message_; } private: std::string message_; }; }} #endif
spather/no_engine_game
src/lib/include/texture.h
#ifndef TEXTURE_H #define TEXTURE_H #include <memory> #include <string> #include <tl/expected.hpp> #include "error.h" namespace no_engine_game { namespace lib { class Texture { public: virtual ~Texture() {} virtual void bind() const = 0; // Returns the texture unit as a regular number, // starting from 0...
spather/no_engine_game
src/lib/include/shader_program.h
#ifndef SHADER_PROGRAM_H #define SHADER_PROGRAM_H #include <memory> #include <string> #include <glad/glad.h> #include <tl/expected.hpp> #include "error.h" #include "texture.h" namespace no_engine_game { namespace lib { class ShaderProgram { public: virtual ~ShaderProgram() {}; virtual void use() const = 0; ...
SasaKaranovic/USB-Power-supply-Active-Load-Tester
Firmware/i2c.c
<gh_stars>1-10 #include "main.h" void I2C1_Setup() { //Configure I2C Pins as Digital ANSELBbits.ANSB4 = DIGITAL; //Configure I2C pins as inputs TRIS_I2C_SCK = INPUT; TRIS_I2C_SDA = INPUT; //Configure MSSP for I2C mode #ifdef _PIC16F1829_H_ SSP1ADD = 0x4F; //Calculate for...
SasaKaranovic/USB-Power-supply-Active-Load-Tester
Firmware/ISRFunctions.h
<filename>Firmware/ISRFunctions.h #ifndef ISRFUNCTIONS_H #define ISRFUNCTIONS_H /** * @Description ISR Set DAC output voltage routine. Should be ONLY used in RX ISR * when appropriate command is received * @Input uint8_t *ISR_RX_BUFF - Pointer to the ISR RX Buffer array */ void ISR_SetDAC(uint8_t *ISR_RX_BUFF); ...
SasaKaranovic/USB-Power-supply-Active-Load-Tester
Firmware/mcp4726.h
#ifndef MCP4726_H #define MCP4726_H #define MCP4726_I2C_ADDRESS 0xC0 uint8_t mcp4726_SetValue(uint16_t value); uint8_t mcp4726_SetVoltage(uint16_t value, uint16_t VCC_VAL); #endif /* MCP4726_H */
SasaKaranovic/USB-Power-supply-Active-Load-Tester
Firmware/uarttools.h
#ifndef UARTTOOLS_H #define UARTTOOLS_H /** * @Description Send VCC value in mV as ASCII double over UART. * @Input uint16_t Value of VCC in 1mV * @Output Sends ASCII value over UART * @Notice This function requires to read VCC value and pass it to this function because we have to change FVR * to sense if VCC is...
SasaKaranovic/USB-Power-supply-Active-Load-Tester
Firmware/uarttools.c
#include "main.h" void UART_SendVCC(uint16_t value) { UART_Write("VCC:"); UART_SendDouble(value); UART_Write("V\r\n"); } void UART_Send_PSU_Voltage() { uint16_t ADC_Value = 0; ADC_Value = ADC_ReadChannel(ADCPSUVOLTAGESENSE); ADC_Value = ADC_Value * 40; //Compensate for the 1/10 voltage di...
SasaKaranovic/USB-Power-supply-Active-Load-Tester
Firmware/mcp4726.c
#include "main.h" /** * Prototype: uint8_t mcp4726_SetValue(uint16_t value) * Input: value : 12bit DAC value (0-4095) * Output: result : I2C1 Status code */ uint8_t mcp4726_SetValue(uint16_t value) { if(value > 4095) { UART_Debug("DAC Value out of range!\r\n"); return 0; } ...
SasaKaranovic/USB-Power-supply-Active-Load-Tester
Firmware/adc.c
#include "main.h" void ADC_Config() { #ifdef _PIC16F1829_H_ //Configure Fixed voltage reference FVRCONbits.FVREN = 1; //1 = Fixed Voltage Reference is enabled while(!FVRCONbits.FVRRDY); //1 = Fixed Voltage Reference output is ready for use //FVRCONbits.TSEN = 1; ...