end day 2
This commit is contained in:
parent
5f1000c453
commit
2568a7b601
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
|
@ -3,6 +3,10 @@
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"time.h": "c",
|
"time.h": "c",
|
||||||
"b2hd.h": "c",
|
"b2hd.h": "c",
|
||||||
"main.h": "c"
|
"main.h": "c",
|
||||||
|
"stdio.h": "c",
|
||||||
|
"string.h": "c",
|
||||||
|
"initialparameters.h": "c",
|
||||||
|
"filegestion.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,12 +1,7 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
TARGET = data
|
TARGET = data
|
||||||
|
|
||||||
all: b2hd.c getArray.c power.c newFileData.c copyFile.c
|
all:
|
||||||
$(CC) b2hd.c -o b2hd
|
$(CC) b2hd.c getArray.c fileGestion.c power.c main.c -o main
|
||||||
$(CC) getArray.c -o getArray
|
|
||||||
$(CC) power.c -o power
|
|
||||||
$(CC) newFileData.c -o newFileData
|
|
||||||
$(CC) copyFile.c -o copyFile
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o
|
rm *.txt *.o
|
890011
C-Script/arrayDec.txt
890011
C-Script/arrayDec.txt
File diff suppressed because it is too large
Load diff
BIN
C-Script/b2hd
BIN
C-Script/b2hd
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
#include "main.h"
|
#include "b2hd.h"
|
||||||
|
|
||||||
int b2hd ()
|
void b2hd()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int indice[6];
|
int indice[6];
|
||||||
|
@ -17,7 +17,7 @@ int b2hd ()
|
||||||
if (strncmp(buff, "#################\n", (size_t)18) == 0) {
|
if (strncmp(buff, "#################\n", (size_t)18) == 0) {
|
||||||
if (!(fread(&buff2, 18, 1, stdin))) {
|
if (!(fread(&buff2, 18, 1, stdin))) {
|
||||||
fprintf(stderr, "Erreur lesture après ###...#");
|
fprintf(stderr, "Erreur lesture après ###...#");
|
||||||
return(1);
|
break;
|
||||||
} else {
|
} else {
|
||||||
/*buff2[17] = '\0';*/
|
/*buff2[17] = '\0';*/
|
||||||
strncpy(buff, &buff[18], 8);
|
strncpy(buff, &buff[18], 8);
|
||||||
|
@ -40,6 +40,3 @@ int b2hd ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int main(int argc , char** argv){
|
|
||||||
b2hd();
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t octet1;
|
uint8_t octet1;
|
||||||
|
@ -17,5 +18,3 @@ int64_t millis()
|
||||||
timespec_get(&now, TIME_UTC);
|
timespec_get(&now, TIME_UTC);
|
||||||
return ((int64_t) now.tv_sec) * 1000 + ((int64_t) now.tv_nsec) / 1000000;
|
return ((int64_t) now.tv_sec) * 1000 + ((int64_t) now.tv_nsec) / 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nRow = 10000;
|
|
Binary file not shown.
|
@ -1,13 +0,0 @@
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
void copyFile(){
|
|
||||||
char buffer[256];
|
|
||||||
while(1){
|
|
||||||
if(!fgets(buffer , sizeof buffer , stdin)) break;
|
|
||||||
fprintf(stdout, "%s" , buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc , char** argv){
|
|
||||||
copyFile();
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "main.h"
|
#include "fileGestion.h"
|
||||||
|
|
||||||
void newFile(){
|
void newFile(int nRow){
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
for(int i = 0; i < nRow; i++){
|
for(int i = 0; i < nRow; i++){
|
||||||
fgets(buffer , sizeof buffer , stdin);
|
fgets(buffer , sizeof buffer , stdin);
|
||||||
|
@ -12,6 +12,10 @@ void newFile(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc , char** argv){
|
void copyFile(int nRow){
|
||||||
newFile();
|
char buffer[256];
|
||||||
|
while(1){
|
||||||
|
if(!fgets(buffer , sizeof buffer , stdin)) break;
|
||||||
|
fprintf(stdout, "%s" , buffer);
|
||||||
}
|
}
|
||||||
|
}
|
4
C-Script/fileGestion.h
Normal file
4
C-Script/fileGestion.h
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
#include "main.h"
|
#include "getArray.h"
|
||||||
|
|
||||||
int getArray(){
|
int getArray(int nRow){
|
||||||
|
|
||||||
int nCol = 9; // imposé par le nombre de sortie du capteur Vegetal Signal
|
int nCol = 9; // imposé par le nombre de sortie du capteur Vegetal Signal
|
||||||
int tab[nRow][nCol]; // création de la matrice contenant les valeurs , nRow définit dans les paramètre de la fonction
|
int tab[nRow][nCol]; // création de la matrice contenant les valeurs , nRow définit dans les paramètre de la fonction
|
||||||
|
@ -23,7 +23,3 @@ int getArray(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc , char** argv){
|
|
||||||
getArray();
|
|
||||||
}
|
|
||||||
|
|
6
C-Script/getArray.h
Normal file
6
C-Script/getArray.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int getArray(int nRow);
|
2
C-Script/initialParameters.h
Normal file
2
C-Script/initialParameters.h
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
int nRow = 100000;
|
||||||
|
int freqEch = 250;
|
BIN
C-Script/main
Executable file
BIN
C-Script/main
Executable file
Binary file not shown.
3
C-Script/main.c
Normal file
3
C-Script/main.c
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
int main(int argc , char** agrv){
|
||||||
|
|
||||||
|
}
|
890011
C-Script/newFile.txt
890011
C-Script/newFile.txt
File diff suppressed because it is too large
Load diff
Binary file not shown.
BIN
C-Script/power
BIN
C-Script/power
Binary file not shown.
|
@ -1,23 +1,19 @@
|
||||||
#include "main.h"
|
#include "power.h"
|
||||||
|
#include "initialParameters.h"
|
||||||
|
|
||||||
int power(int tab){
|
float power(int tab[nRow][8]){
|
||||||
int freq = 250; //imposé par le capteur Vegetal Signal
|
float periode = 1 /freqEch;
|
||||||
float periode = 1 / freq;
|
float power[8];
|
||||||
int power[8] = {0,0,0,0,0,0,0,0};
|
|
||||||
for(int i = 0; i < 8; i++){
|
for(int i = 0; i < 8; i++){
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int res = 0;
|
float res = 0;
|
||||||
while(1){
|
while(1){
|
||||||
if(tab[j+1][i]==NULL) break;
|
if(tab[j+1][i]==) break;
|
||||||
float aire = ( pow(tab[j][i],2) + pow(tab[j+1][i],2) ) / 2 * periode;
|
float aire = ( pow(tab[j][i],2) + pow(tab[j+1][i],2) ) / 2 * periode;
|
||||||
res += aire;
|
res += aire;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
power[i] = res;
|
power[i] = res;
|
||||||
}
|
}
|
||||||
return power;
|
return *power;
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc , char** argv){
|
|
||||||
power();
|
|
||||||
}
|
}
|
1
C-Script/power.h
Normal file
1
C-Script/power.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <math.h>
|
890011
C-Script/testNewFile.txt
890011
C-Script/testNewFile.txt
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue