repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
gadam2018/RPi3-PREEMPT_RT | slave modules/periodic/userspace/gpiop_slave.c | // ****************************************************************
// SLAVE PERIODIC TASK MODULE FOR USER SPACE MEASUREMENTS
// COMPILE: gcc gpiop_slave.c -o gpiop_slave -lrt or gcc -Wall -w gpiop1.c -std=gnu99 -lrt
// RUN: sudo chrt -f 99 ./gpiop_slave <number-of-loops> <semi-period in nsecs>// with realime pri... |
gadam2018/RPi3-PREEMPT_RT | master modules/response_task/user&kernelspace/gpio_master.c | <reponame>gadam2018/RPi3-PREEMPT_RT<filename>master modules/response_task/user&kernelspace/gpio_master.c
// ****************************************************************
// MASTER RESPONSE TASK MODULE FOR USER & KERNEL SPACE MEASUREMENTS
//COMPILE: gcc gpio_master.c -o gpio_master -lm -lrt -lpthread // link to math... |
gadam2018/RPi3-PREEMPT_RT | slave modules/response/userspace/gpio_slave.c | <gh_stars>1-10
// ****************************************************************
// SLAVE RESPONSE TASK MODULE FOR USER SPACE MEASUREMENTS
// COMPILE: gcc gpio_slave.c -o gpio_slave -lrt -lpthread or gcc -Wall -w gpio1.c -std=gnu99 -lrt
// RUN: sudo ./gpio_slave <number-of-loops> // x 2 => runs, with FIFO & p... |
HarrisLee/UDPBroadcast | UDPSocket/UDPSocket/ViewController.h | <reponame>HarrisLee/UDPBroadcast
//
// ViewController.h
// UDPSocket
//
// Created by JianRongCao on 15/12/17.
// Copyright © 2015年 JianRongCao. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
mmosaics/RSA | src/BigInteger.h | <filename>src/BigInteger.h
//
// Created by OneCarrot on 2019-04-14.
//
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
class BigInteger {
private:
vector<char> _data;
string value;
string name;
int compare(const BigInteger &li); //比较函数,大于返回1,等于0,小于-1
... |
mmosaics/RSA | src/RSA.h | //
// Created by OneCarrot on 2019-04-18.
//
#include "BigInteger.h"
class RSA {
private:
BigInteger p;
BigInteger q;
BigInteger n;
BigInteger e;
BigInteger d;
void generateKeyFile(string filepath, BigInteger para);
public:
static BigInteger repeatMod(BigInteger base, BigInteger n, Bi... |
sech9446/vgram | vgram_gin.c | <reponame>sech9446/vgram<filename>vgram_gin.c
/*-------------------------------------------------------------------------
*
* vgram_gin.c
* Routines for GIN indexing of V-grams extracted from strings.
*
* Copyright (c) 2011-2017, <NAME>
*
* IDENTIFICATION
* contrib/vgram/vgram_gin.c
*
*--------------------... |
sech9446/vgram | vgram_like.c | /*-------------------------------------------------------------------------
*
* vgram_like.c
* Routines for using index over V-grams to accelerate like/ilike
* queries.
*
* Copyright (c) 2011-2017, <NAME>
*
* IDENTIFICATION
* contrib/vgram/vgram_like.c
*
*-------------------------------------------------... |
sech9446/vgram | vgram.h | /*-------------------------------------------------------------------------
*
* vgram.h
* Header for vgram module.
*
* Copyright (c) 2011-2017, <NAME>
*
* IDENTIFICATION
* contrib/vgram/vgram.h
*
*-------------------------------------------------------------------------
*/
#ifndef _V_GRAM_H_
#define _V_GR... |
tigerdeeda/Removing-Shadows-from-Images-of-Documents-by-Steve-Bako | DocumentShadowRemoval/ShadowRemover.h | #include <stdio.h>
#include <iostream>
#include <omp.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/ml/ml.hpp>
#include <opencv2/photo/photo.hpp>
#include <cmath>
#include <random>
using namespace cv;
using namespace cv::m... |
elisescu/jq | jv_parse.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "jv.h"
#include "jv_dtoa.h"
#include "jv_unicode.h"
#include "jv_alloc.h"
#include "jv_dtoa.h"
typedef const char* presult;
#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
#ifdef __GNUC__
#define pfunc ... |
elisescu/jq | util.h | #ifndef UTIL_H
#define UTIL_H
#include "jv.h"
jv expand_path(jv);
jv get_home(void);
jv jq_realpath(jv);
const void *_jq_memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen);
#ifndef MIN
#define MIN(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b ... |
elisescu/jq | main.c | #include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <libgen.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "compile.h"
#include "jv.h"
#include "jq.h"
#include "jv_alloc.h"
#include "version.h"
int jq_testsuite(int argc, char* argv[]);
static const char* prog... |
elisescu/jq | exec_stack.h | <reponame>elisescu/jq
#ifndef EXEC_STACK_H
#define EXEC_STACK_H
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "jv_alloc.h"
struct determine_alignment {
char x;
union { int i; double d; uint64_t u64; size_t sz; void* ptr; } u;
};
enum {ALIGNMENT = offsetof(struct determine... |
elisescu/jq | builtin.c | <reponame>elisescu/jq
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <oniguruma.h>
#include <stdlib.h>
#include <string.h>
#include "builtin.h"
#include "compile.h"
#include "jq_parser.h"
#include "bytecode.h"
#include "linker.h"
#include "locfile.h"
#include "jv_unicode.h"
static jv type_error(jv... |
elisescu/jq | jq.h | <reponame>elisescu/jq
#ifndef _JQ_H_
#define _JQ_H_
#include <stdio.h>
#include <jv.h>
enum {JQ_DEBUG_TRACE = 1};
typedef struct jq_state jq_state;
typedef void (*jq_err_cb)(void *, jv);
jq_state *jq_init(void);
void jq_set_error_cb(jq_state *, jq_err_cb, void *);
void jq_get_error_cb(jq_state *, jq_err_cb *, void ... |
elisescu/jq | util.c | <reponame>elisescu/jq
#ifdef HAVE_MEMMEM
#define _GNU_SOURCE
#include <string.h>
#endif
#include <assert.h>
#ifndef WIN32
#include <pwd.h>
#endif
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include "util.h"
#include "jv.h"
jv expand_path(jv path) {
assert(jv_get_kind(path) == JV_KIND_STRING);
c... |
dkumazaw/yarcc | tests/ctests/init.c | <filename>tests/ctests/init.c
// Initialization
/* TODO global*/
/* local */
int simple() { int a = 4; return a; }
int simple2() { short b = 3; return b; }
int simple3() { char c = 23; return c; }
int ptr() { int a=19; int *b = &a; return *b; }
int scalar_excessive() { int a = {11, 22, 33}; return a; }
int array_exa... |
dkumazaw/yarcc | tests/ctests/comment.c | // Just testing comments
// (Not allowed in C89 to be precise)
int main() {
return 4;
}
|
dkumazaw/yarcc | tests/ctests/switch_cases.c | // Test switch's basic functionalities
int switch_nobreak() {
int i = 4;
int b = 0;
switch (i) {
b += 10; // Should be ignored
case 1:
b += 1;
case 2:
b += 2;
case 3:
b += 3;
case 4:
b += 4;
case 5:
... |
dkumazaw/yarcc | tests/ctests/enum.c |
enum simple { HOGE, FUGA };
int test_simple() {
enum simple s;
s = FUGA;
return s; // Expect: 1
}
int test_local() {
enum local { FOO, BAR, BAZ };
enum local a = BAZ;
return a; // Expect: 2
}
int test_various_decls() {
enum local1;
enum local1 { foo, bar, baz };
enum local1 l1;
... |
dkumazaw/yarcc | examples/singlenum.c | // Find which element occurs only once.
// Taken from https://leetcode.com/problems/single-number-ii/
int findnum (int *p, int len) {
int once = 0;
int twice = 0;
int i;
// Note: cannot use declaration as initialization in C89
for (i = 0; i < len; i++) {
once = ~twice & (once ^ *(p + i));
... |
dkumazaw/yarcc | tests/ctests/array.c | <reponame>dkumazaw/yarcc
/* Array */
int test_simple() {
int a[10];
return 1;
}
int test_simple2() {
int arr[12];
arr[1] = 4;
return arr[1]; // Expect: 4
}
int test_simple3() {
int arr[10];
int b;
b = 3;
arr[4 * b -10] = 21;
return arr[4 - 2]; // Expect: 21
}
int test... |
dkumazaw/yarcc | tests/ctests/continue.c | <filename>tests/ctests/continue.c
// Test cases for continue
int cont_dowhile() {
int i = 0;
int b = 0;
do {
i++;
if (i %2 == 0) continue;
b += 3;
} while (i < 20);
return b; // Expect: 30
}
int cont_for() {
int i = 0;
int b = 0;
for (; i < 20; i++) {
if... |
dkumazaw/yarcc | tests/ctests/literal.c | <filename>tests/ctests/literal.c
// Test cases for string literals
char *bp1;
char *bp2;
int simple1() {
char *p1 = "Hello world";
char *p2 = "Hello world2";
return p1[3] == p2[3];
}
int simple2() {
bp1 = bp2 = "foo";
char *lp = "foo";
return (bp1[1] == bp2[1]) && (bp1[1] == lp[1]);
}
... |
dkumazaw/yarcc | tests/ctests/type_qual.c | // Type qualifiers
int test_simple() {
const int a = 1;
volatile int b = 2;
const volatile int c = 3;
return a + b + c;
}
int test_ptr() {
int a, *b;
b = &a;
int * const volatile * const c = &b;
a = 5;
return **c; // Expect: 5
}
int main() {
if (test_simple() != 6) return 1;
... |
dkumazaw/yarcc | tests/ctests/struct.c | <filename>tests/ctests/struct.c<gh_stars>0
// Test struct
struct simple {
int a;
char b;
};
int test_simple() {
struct simple s;
s.a = 4;
s.b = 2;
return s.a + s.b; // Expect: 6
}
int test_local() {
struct local { long a; char b; short c; } l;
l.a = 25;
l.b = 21;
l.c = 1;
... |
dkumazaw/yarcc | tests/ctests/func.c | <reponame>dkumazaw/yarcc<filename>tests/ctests/func.c
// Various forms of function definitions and declarations
/* Useless declarations are permitted. */
int;
long;
/* Prototypes */
int test_useless();
int foo(int a, long b);
int (*bar())(int a, long b);
int (*(*baz(int hoge))())(int a, long b);
/* Definitions */
in... |
dkumazaw/yarcc | tests/ctests/break.c | <filename>tests/ctests/break.c
// Test cases for break
/* Break out of dowhile loop */
int break_dowhile() {
int i = 0;
do {
i += 2;
if (i == 24) break;
} while (i < 30);
return i; // Expect: 24
}
/* Break out of for loop */
int break_for() {
int i = 0;
for (; i < 10; i++) {
... |
E-SoulDataGroup/snzip | snzip.c | /* -*- indent-tabs-mode: nil -*-
*
* Copyright 2011-2016 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list... |
E-SoulDataGroup/snzip | framing2-format.c | <filename>framing2-format.c
/* -*- indent-tabs-mode: nil -*-
*
* Copyright 2012-2013 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above... |
E-SoulDataGroup/snzip | snzip-format.c | /* -*- indent-tabs-mode: nil -*-
*
* Copyright 2011-2012 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list... |
E-SoulDataGroup/snzip | iwa-format.c | <reponame>E-SoulDataGroup/snzip
/* -*- indent-tabs-mode: nil -*-
*
* Copyright 2016 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above ... |
E-SoulDataGroup/snzip | hadoop-snappy-format.c | /* -*- indent-tabs-mode: nil -*-
*
* Copyright 2016 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
... |
E-SoulDataGroup/snzip | crc32.h | <gh_stars>100-1000
#ifndef CRC32_H
#define CRC32_H 1
#include <stdint.h>
#define MASK_DELTA 0xa282ead8
uint32_t calculate_crc32c(uint32_t crc32c, const unsigned char *buffer,
unsigned int length);
uint32_t calculate_crc32c_sse4_2(uint32_t crc32c, const unsigned char *buffer,
unsigned int length);
static i... |
E-SoulDataGroup/snzip | comment-43-format.c | <filename>comment-43-format.c
/* -*- indent-tabs-mode: nil -*-
*
* Copyright 2011-2015 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the abo... |
E-SoulDataGroup/snzip | snappy-in-java-format.c | /* -*- indent-tabs-mode: nil -*-
*
* Copyright 2011-2015 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list... |
E-SoulDataGroup/snzip | snzip.h | <filename>snzip.h
/* -*- indent-tabs-mode: nil -*-
*
* Copyright 2011-2016 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright... |
E-SoulDataGroup/snzip | crc32_sse4_2.c | <gh_stars>100-1000
/*
* Use SSE4.2 to calculate crc32c.
*
* Copyright 2015 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyrigh... |
EffectiveLikeABoss/LoggingLibraryExample | LoggingLibraryExample/LLHeader.h | //
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
// In jurisdi... |
InspectorConstructor/amazon-kinesis-video-streams-webrtc-sdk-c | src/source/Rtp/RtpPacket.c | <gh_stars>0
#define LOG_CLASS "RtpPacket"
#include "../Include_i.h"
STATUS createRtpPacket(UINT8 version, BOOL padding, BOOL extension, UINT8 csrcCount, BOOL marker,
UINT8 payloadType, UINT16 sequenceNumber, UINT32 timestamp, UINT32 ssrc, PUINT32 csrcArray,
UINT16 extensi... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Timer/LedDelayUsingSysTimer.c | <reponame>balaji303/STM-Boards
/*
Blink the LED using the timer
LED->PA5
PA5->GPIOA
GPIOA->AHB1 bus
*/
#include "stm32f4xx.h" // Device header
//#include "delay.h" //Own header file for delay function
int main(void){
RCC->AHB1ENR |=0x1; //GPIOA enable
GPIOA->MODE... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Resistor/PullUp.c | <filename>Nucleo/STM32/STM23F446RE/C/Resistor/PullUp.c
#include "stm32f4xx.h" // Device header
int main(void){
RCC->AHB1ENR |=0x1; //Enable GPIOA
//By default all state are input
GPIOA->MODER |=0x100000; //LED output
GPIOA->PUPDR |=0x100000; //PullUp re... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/LED/Ledblink.c | <filename>Nucleo/STM32/STM23F446RE/C/LED/Ledblink.c<gh_stars>1-10
/*
* LED is connected to D13/PA5
* Port A Pin 5
* PA5 is connected to AHB1 bus
* **Reference manual**
* Enable AHB1 by RCC register
* RCC AHB1 peripheral clock enable register (RCC_AHB1ENR)
* RCC->AHB1ENRs
* RCC AHB1 peripheral res... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/LCD_Display/LCD_4bit/mainProgram.c | <filename>Nucleo/STM32/STM23F446RE/C/LCD_Display/LCD_4bit/mainProgram.c
/*
LCD display is used in 4bit mode
PC4-PC7 -> Data line
PB5 -> RS(0x20)
PB7 -> EN(0x80)
GND -> RW
*/
#include "stm32f4xx.h" // Device header
void delay(int seconds);
void GpioInit(void);
void LcdCommand(unsigned char command);
... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/USART/UsartTxRx.c | /*
Using USART2 both Tx and Rx
Usart2->APB1 bus
usart2_rx = PA3
usart2_tx = PA2
GPIOA->AHB1 bus
*/
#include "stm32f4xx.h" // Device header
#include <stdio.h>
void Usart_Init(void);
int Usart_Write(int value);
int Usart_Read(void);
int main(void){
int age;
char name[100];
Usart_Init();
printf("Hell... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/LCD_Display/LCD_8bit/LCD.c | <filename>Nucleo/STM32/STM23F446RE/C/LCD_Display/LCD_8bit/LCD.c
//https://cortex-m.com/lcd/
//PC0 to PC7 -> D0 to D7
//PB5 -> RS
//PB6 -> R/W
//PB7 -> EN
#include "stm32f4xx.h" // Device header
//#define RS 0x20 //0b0010 0000
//#define RW 0x40 //0b0100 0000
//#define EN 0x80 //0b1000 0000
void L... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Interrupt/ButtonLedRaisingLedAlwaysOn.c | <filename>Nucleo/STM32/STM23F446RE/C/Interrupt/ButtonLedRaisingLedAlwaysOn.c
/*
D2->PC10->button
D3->PB6->LED
D13->PA5->Always Blinking
When I press the button the LED should turn ON
*/
#include "stm32f4xx.h" // Device header
int count=0;
int main(void){
__disable_irq();
RCC->AHB1ENR|= 0X7; ... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Timer/GeneralPurposeTimer.c | /*
XTal = 16MHz
Toggle LED using General Purpose Timer Register
Here we use TIMER2 which is 32bit timer attached to APB1 bus
*/
#include "stm32f4xx.h" // Device header
int main(void){
RCC->AHB1ENR |=0x1; //Enable GPIOA
GPIOA->MODER |=0x400; //Enable OUTPUT mode
RCC->APB... |
balaji303/STM-Boards | Boards/ST/NUCLEO-F446RE/RTX_Blinky/RTX_Blinky.c | /*----------------------------------------------------------------------------
* Name: Blinky.c
* Purpose: LED Flasher
*----------------------------------------------------------------------------
* This file is part of the uVision/ARM development tools.
* This software may only be used under the terms of a val... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Button/button.c | //Button based LED
//Button is connected to PC13
//PC13 -> AHB1 bus
// LED is connected to PA5
// PA5 -> AHB1 bus
//RCC_AHB1ENR is the bus enable register
// GPIOC is 2ed bit so 0x4 -button
// GPIOA is 0th bit so 0x1 -LED
// GPIOx_MODER is the mode register
// GPIOC->MODER is input so 00 at 26,27th bit
// GPIOA->MODER... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Timer/GeneralPurposeTimerForOutput.c | /*
Led Blink using General Purpose Timer Output Capture in TIM2
ARR playes a major role in delay
if ARR=1000
10 000/1000 = 10 which means LED toggles 10 times a second
(10 times for 1MHz)
*/
#include "stm32f4xx.h" // Device header
int main(void){
RCC->AHB1ENR |=0x1; //Enable GPIOA
... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Timer/DelayFunctionUsingSysTick.c | /*
Create a LED blink using Systick timer as delay function
*/
#include "stm32f4xx.h" // Device header
void systickDelay(int seconds);
int main(void){
RCC->AHB1ENR |=0x1; //GPIOA enable
GPIOA->MODER |=0X400; //Enable PA5 output mode
while(1){
systickDelay(1000);... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Interrupt/OneSwitch3TypeLed.c | <reponame>balaji303/STM-Boards
/*PA5->LED
PC13->Button
When No button pressed blinks slowly
When button is pressed once blinks at medium speed
When button is pressed while blinking in medium speed it blinks fast
*/
#include "stm32f4xx.h" // Device header
int main(void){
__disable_irq();
RCC->AHB1... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/USART/Usartv2.c | //Video-10 UART Driver using system datasheet
//Protocol selected USART2
//USART2->APB1 bus
//RCC_APB1ENR is the APB1 enable register
// Enable 1 at 17 bit for USART2
//USART2_TX-> PA2 Pin
//RCC_AHB1ENR is the AHB1 enable register
// Enable 1 at 0 bit for PA2
//GPIOx_MODER is the Mode register
// Enable 1 at 5 bit f... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/SPI/SPI_simpleWrite/mainProgram.c | <reponame>balaji303/STM-Boards
/*
This is an Overview, This program has no working module
SPI write fundation program
PA7-SPI1_MOSI
PA6-SPI1_MISO
PA5-SPI1_SCK
PA4-SPI1_NSS
*/
#include "stm32f4xx.h" // Device header
void spiWriteData(unsigned char data);
void spiInit(void);
int main(void){
spiIni... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Timer/GeneralPurposeTimerPWM.c | /*
Tigger GPIO's PWM based on timer
XTal=16MHz
prescalar value= 10 which means 16M/10= 1.6MHz of XTal
timer starts to count from CNT=0
when the counter reached ARR the counter matches and starts to count once again
The LED is turned ON for CCR1/ARR= 8889/26667 = times
Changing CCR1 value change the LED brightness
*/
#... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/ADC/TempSensor.c | #include "stm32f4xx.h" // Device header
#include <stdio.h>
int Usart2Write(int ch);
void Usart2Init(void);
int data;
double voltage;
double celsius;
int main(void){
RCC->AHB1ENR|=1; //Enable GPIOA
RCC->APB1ENR|=1; //Enable TIM2
TIM2->PSC =1200-1; ... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Timer/GeneralPurPoseTimerInputCapture.c | <gh_stars>1-10
/*
Toggle LED every 1 sec from TIM2_CH1
reading the value from PA5 to PA6 (Timer caputure)
We are measuring the toggle rate of PA5 and connecting the toggle rate to PA6
TIM2 ->APB1
TIM2_CH1->PA5
TIM3->APB1
TIM3_CH1->PA6
*/
#include "stm32f4xx.h" // Device header
int timestamp=0;
int ... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Interrupt/UsartRxInterruptLedPlay.c | /*
PA3->Usart RX
PA5->LED
Input using Termianl Tools like TeraTerm
*/
#include "stm32f4xx.h" // Device header
void Usart2Init(void);
void systickDelay(int seconds);
void LedPlay(int value);
void LedInit(void);
int main(void){
__disable_irq();
LedInit();
Usart2Init();
USART2->CR1|=0x80;
NVIC_Enabl... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/LED/BlinkUsingSetReset.c | //BSRR set and reset register
//5 set and 21 reset register
#include "stm32f4xx.h" // Device header
void delay(int seconds);
int main(void){
RCC->AHB1ENR |= 1;
GPIOA->MODER |= 0x400;
for(int i=0;i<5;i++){
GPIOA->BSRR |= 0x20; //Set register
delay(1000);
GPIOA->BS... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Interrupt/OneSwitch3TypeLedSysTickTimer.c | <filename>Nucleo/STM32/STM23F446RE/C/Interrupt/OneSwitch3TypeLedSysTickTimer.c
/*PA5->LED
PC13->Button
*/
#include "stm32f4xx.h" // Device header
void systickDelay(int seconds);
int main(void){
__disable_irq();
RCC->AHB1ENR|=0x5; //Enable GPIOA and GPIOC
GPIOA->MODER|=0x400; ... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/USART/UsartRx.c | <gh_stars>1-10
#include "stm32f4xx.h" // Device header
void delay(int sec);
void Usart_Init(void);
void Led_Init(void);
char Usart_Read(void);
void Led_play(int value);
int main(void){
char ch;
Led_Init();
Usart_Init();
while(1)
{
ch=Usart_Read();
Led_play(ch);
}
return 0;
}
void Usart_Init(voi... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/LED/2LedBlink/main.c | #include "stm32f4xx.h" // Device header
#define GREEN_LED_PIN (1U<<10)
#define RED_LED_PIN (1U<<12)
#define AHB1_BUS_ENABLE (1U)
#define GREEN_HIGH (1U<<5)
#define RED_HIGH (1U<<6)
#define LOW (0U)
void GPIO_init(void);
void Red_LED(void);
void Green_LED(void);
void delaysec(uint32_t sec);
int main... |
balaji303/STM-Boards | Boards/ST/NUCLEO-F446RE/Blinky/Blinky.c | /*----------------------------------------------------------------------------
* Name: Blinky.c
* Purpose: LED Flasher
*----------------------------------------------------------------------------
* This file is part of the uVision/ARM development tools.
* This software may only be used under the terms of a val... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/ADC/Cube-Mx/AdcTimeTriggeredConver.c | /* USER CODE BEGIN Header */
/*
1.Select ADC
2.External Trigger Conversion source-> Time2 Trigger Out Event
3.Sampling Time-> 84 Cycle
4.Enable global interrupt
5.Prescalar->4800;
6.Internal cycle-50;
7.Start Timer-> HAL_TIM_Base_Start
8.INterrupt start we ticked the checkbox for global interrupt so HAL_ADC_Start_IT
9... |
balaji303/STM-Boards | Nucleo/STM32/STM32F100C8/LEDBlink/main.c | /*
LED is connected to PC13
Port C PIN 13
PC13 is with AHB2
RCC->APB2ENR Clock enable register
GPIO Registers
GPIOx_MODER - Mode registers (2bits of data)
GPIOx_ODR - Output Data register
*/
#include "stm32f10x.h" // Device header
void LedInit(void);
void LedGlow(void);
void DelayMs(int second... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Interrupt/ButtonLedRaiseingEdge.c | <reponame>balaji303/STM-Boards
/*
Create a interrput function when button is leaving
LED toggles and count value increses
*/
#include "stm32f4xx.h" // Device header
uint8_t count=0;
int main(void){
__disable_irq();
//LED
RCC->AHB1ENR |=0x1; //Enable bus GPIOA
GPIOA->MODER |=0x... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Interrupt/SysTickInterrupt.c | #include "stm32f4xx.h" // Device header
void LedInit(void);
int main(void){
LedInit();
__disable_irq();
SysTick->LOAD=12000000;
SysTick->VAL=0;
SysTick->CTRL=7;
__enable_irq();
while(1){ }
}
void SysTick_Handler(void){
GPIOA->ODR ^=0x20; //Toggle PA5 LED
}
void LedInit(void){
RC... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Interrupt/GeneralPurposeTimerInterrupt.c | /*
16MHz clock
*/
//With TIM2
/*
#include "stm32f4xx.h" // Device header
int main(void){
__disable_irq();
RCC->AHB1ENR|=0x1; //Enable GPIOA
GPIOA->MODER|=0x400; //Enable PA5 as output
RCC->APB1ENR|=0x1; //Enable TIM2
T... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Button/buttonLedGpio.c | /*
AIM: Press user button-> LED On-> D4 HIGH
not pressed->LED Off->D4 low
User button->PC13
LED->PA5
D4->PB5
All GPIO's Connected to AHB1 bus
*/
#include "stm32f4xx.h" // Device header
void d4_init(void);
void button_init(void);
void led_init(void);
void process(void);
int main(void){
butt... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Interrupt/OneSwitch2TypeBlinkLed.c | <gh_stars>1-10
/*
PA5->LED
PC10->Button
*/
#include "stm32f4xx.h" // Device header
int main(void){
__disable_irq();
RCC->AHB1ENR|=0x5; //Enable GPIOA and GPIOC
GPIOA->MODER|=0x400; //PA5 output
RCC->APB2ENR|=0x4000; //Enable SYSCFG
SYSCFG->E... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/SPIvsI2CvsUART/Code.c | //Video-10 UART Driver using system datasheet
//Protocol selected USART2
//USART2->APB1 bus
//RCC_APB1ENR is the APB1 enable register
// Enable 1 at 17 bit for USART2
//USART2_TX-> PA2 Pin
//RCC_AHB1ENR is the AHB1 enable register
// Enable 1 at 0 bit for PA2
//GPIOx_MODER is the Mode register
// Enable 1 at 5 bit f... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/Timer/GeneralPurposeTimerFrequencyCapture.c | <filename>Nucleo/STM32/STM23F446RE/C/Timer/GeneralPurposeTimerFrequencyCapture.c<gh_stars>1-10
/*
AHB1 bus->GPIOA-> PA5->LED toggle and toggle is measured by
AHB1 bus->GPIOA->PA6 outputs the toggle period and frequency
timer starts to count from CNT=0
when the counter reached ARR the counter matches and starts to coun... |
balaji303/STM-Boards | Nucleo/STM32/STM23F446RE/C/I2C/I2C_Clk_DS1307/program.c | /*
Master Device -> STM32F446RE
Slave Device -> DS1307
Since It is a RTC, it got SEC
min, hour, day, month Year,
we are going to read the sec
and use that to toggle the LED
PIN's used
SCL-PB8
SDA-PB9
*/
#include "stm32f4xx.h" // Device header
#define SLAVEADDR 0x68
int i2cdata(char saeaddr, char m... |
nash012/SKMediator | SKMediator/SKMediator/Example/SKMediator/SKAppDelegate.h | //
// SKAppDelegate.h
// SKMediator
//
// Created by <EMAIL> on 05/05/2017.
// Copyright (c) 2017 <EMAIL>. All rights reserved.
//
@import UIKit;
@interface SKAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
dmuino/spectatord | spectator/compressed_buffer.h | #pragma once
#include "gzip.h"
#include <cassert>
#include <string_view>
#include <vector>
namespace spectator {
struct CompressedResult {
const uint8_t* data;
size_t size;
};
class CompressedBuffer {
public:
static constexpr size_t kDefaultChunkSize = 256 * 1024;
static constexpr size_t kDefaultOutSize = 2... |
dmuino/spectatord | spectator/detail/perc_policy.h | #pragma once
#include "../percentile_buckets.h"
#include "../registry.h"
#include <array>
namespace spectator::detail {
#include "percentile_bucket_tags.inc"
using counters_t =
std::array<std::shared_ptr<Counter>, PercentileBucketsLength()>;
struct lazy_policy {
static void init(Registry* /* r */, const Id& /... |
dmuino/spectatord | spectator/dist_stats.h | #pragma once
#include "id.h"
namespace spectator {
struct DistStats {
Id total;
Id totalSq;
Id max;
Id count;
DistStats(const Id& base, StrRef total_stat)
: total{base.WithStat(total_stat)},
totalSq{base.WithStat(refs().totalOfSquares())},
max{base.WithStat(refs().max())},
co... |
dmuino/spectatord | server/expiring_cache.h | <filename>server/expiring_cache.h
#pragma once
#include "absl/synchronization/mutex.h"
#include "spectator/registry.h"
#include <chrono>
#include <memory>
namespace spectatord {
namespace detail {
template <typename V>
struct cache_entry {
mutable std::chrono::steady_clock::time_point updated;
std::unique_ptr<V> ... |
dmuino/spectatord | spectator/file_watcher.h | <gh_stars>10-100
#pragma once
#include <atomic>
#include <chrono>
#include <string>
#include <unistd.h>
namespace atlas {
namespace util {
class FileWatcher {
public:
explicit FileWatcher(std::string file_name) noexcept
: file_name_(std::move(file_name)),
last_updated_(now()),
exists_(access... |
dmuino/spectatord | spectator/tags.h | <filename>spectator/tags.h
#include "string_intern.h"
#include <algorithm>
#include <array>
#include <memory>
#include <ostream>
namespace spectator {
struct Tag {
StrRef key;
StrRef value;
};
class Tags {
using value_type = Tag;
using size_type = size_t;
using const_iterator = const value_type*;
using it... |
dmuino/spectatord | spectator/string_intern.h | <gh_stars>0
#pragma once
#include <cstring>
#include <string>
namespace spectator {
class StringPool;
struct StringPoolStats {
size_t alloc_size;
size_t table_size;
uint64_t hits;
uint64_t misses;
};
class StrRef {
public:
StrRef() = default;
bool operator==(const StrRef& rhs) const { return data == r... |
dmuino/spectatord | spectator/config.h | <gh_stars>0
#pragma once
#include "absl/time/time.h"
#include <map>
#include <memory>
#include <string>
namespace spectator {
class Config {
public:
virtual ~Config() = default;
Config() = default;
Config(const Config&) = default;
Config(Config&&) = default;
Config& operator=(Config&&) = default;
Config... |
dmuino/spectatord | spectator/monotonic_counter.h | #pragma once
#include "meter.h"
#include <atomic>
namespace spectator {
class MonotonicCounter : public Meter {
public:
explicit MonotonicCounter(Id id) noexcept;
void Measure(Measurements* results) const noexcept;
void Set(double amount) noexcept;
double Delta() const noexcept;
private:
mutable std::un... |
dmuino/spectatord | spectator/test_utils.h | <gh_stars>0
#pragma once
#include "../spectator/registry.h"
#include <map>
#include <string>
#include <vector>
std::map<std::string, double> measurements_to_map(
const std::vector<spectator::Measurement>& measurements);
template <typename T>
std::vector<const T*> filter_my_meters(const std::vector<const T*> sour... |
dmuino/spectatord | spectator/gauge.h | <reponame>dmuino/spectatord
#pragma once
#include "meter.h"
#include <atomic>
namespace spectator {
class Gauge : public Meter {
public:
Gauge(Id id, absl::Duration ttl) noexcept;
void Measure(Measurements* results,
int64_t now = absl::GetCurrentTimeNanos()) const noexcept;
void Set(double val... |
dmuino/spectatord | spectator/smile.h | #pragma once
#include "compressed_buffer.h"
namespace spectator {
// this is not a general class
// this is only meant to serialize the array of measurements
// we send to the atlas-aggregator
class SmilePayload {
public:
void Init() {
buffer_.Init();
write_header();
write_start_array();
}
void Ap... |
dmuino/spectatord | server/local.h | #pragma once
namespace spectatord {
static constexpr auto kSocketNameDgram = "/run/spectatord/spectatord.unix";
} // namespace spectatord |
dmuino/spectatord | server/files.h | #pragma once
#include "logger.h"
#include <cstdio>
namespace spectatord {
class StdIoFile {
public:
explicit StdIoFile(const char* name) noexcept : fp_(std::fopen(name, "r")) {
if (fp_ == nullptr) {
Logger()->warn("Unable to open {}", name);
} else {
setbuffer(fp_, buf, sizeof buf);
}
}
... |
dmuino/spectatord | spectator/percentile_timer.h | <filename>spectator/percentile_timer.h
#pragma once
#include "detail/perc_policy.h"
#include "id.h"
#include "percentile_buckets.h"
#include "registry.h"
#include "util.h"
namespace spectator {
template <typename policy>
class percentile_timer {
public:
percentile_timer(Registry* registry, Id id, absl::Duration m... |
dmuino/spectatord | spectator/counter.h | <gh_stars>0
#pragma once
#include "meter.h"
#include <atomic>
namespace spectator {
class Counter : public Meter {
public:
explicit Counter(Id id) noexcept;
void Measure(Measurements* results) const noexcept;
void Increment() noexcept;
void Add(double delta) noexcept;
double Count() const noexcept;
priv... |
dmuino/spectatord | server/local_server.h | <gh_stars>0
#pragma once
#include "handler.h"
#include <asio.hpp>
namespace spectatord {
class LocalServer {
public:
// NOLINTNEXTLINE(google-runtime-references)
LocalServer(asio::io_context& io_context, std::string_view path,
handler_t handler);
void Start();
private:
handler_t handler_;
... |
dmuino/spectatord | server/udp_server.h | <filename>server/udp_server.h
#pragma once
#include "handler.h"
#include <asio.hpp>
namespace spectatord {
class UdpServer {
public:
// NOLINTNEXTLINE(google-runtime-references)
UdpServer(asio::io_context& io_context, int port_number,
handler_t message_handler);
void Start() { start_udp_receive();... |
dmuino/spectatord | server/proc_utils.h | <reponame>dmuino/spectatord
#pragma once
#include <cstdint>
#include <optional>
namespace spectatord {
// get the maximum buffer size available on the system
int max_buffer_size(const char* proc_file = "/proc/sys/net/core/rmem_max");
struct udp_info_t {
// total number of packets dropped between min_port and max_p... |
dmuino/spectatord | spectator/common_refs.h | <reponame>dmuino/spectatord
#pragma once
#include "string_intern.h"
namespace spectator {
class Refs final {
public:
Refs()
: name_(intern_str("name")),
count_(intern_str("count")),
gauge_(intern_str("gauge")),
totalTime_(intern_str("totalTime")),
totalAmount_(intern_str("tota... |
dmuino/spectatord | server/handler.h | <reponame>dmuino/spectatord
#pragma once
#include <functional>
#include <optional>
#include <string>
namespace spectatord {
using handler_t = std::function<std::optional<std::string>(char*)>;
} // namespace spectatord
|
dmuino/spectatord | spectator/string_pool.h | #pragma once
#include "string_intern.h"
#include "absl/synchronization/mutex.h"
#include "tsl/hopscotch_map.h"
#include "xxh3.h"
namespace spectator {
struct String {
const char* s;
size_t len;
};
struct StringHasher {
size_t operator()(const String& str) const {
return XXH3_64bits(str.s, str.len);
}
};... |
dmuino/spectatord | spectator/registry.h | #pragma once
#include "absl/synchronization/mutex.h"
#include "absl/time/time.h"
#include "config.h"
#include "counter.h"
#include "dist_summary.h"
#include "gauge.h"
#include "max_gauge.h"
#include "monotonic_counter.h"
#include "publisher.h"
#include "timer.h"
#include <condition_variable>
#include <mutex>
#include ... |
dmuino/spectatord | spectator/publisher.h | #pragma once
#include "absl/synchronization/blocking_counter.h"
#include "common_refs.h"
#include "config.h"
#include "counter.h"
#include "http_client.h"
#include "logger.h"
#include "measurement.h"
#include "smile.h"
#include <asio/post.hpp>
#include <asio/thread_pool.hpp>
#include <atomic>
#include <functional>
#i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.