ichinoseki_Bteam_2019 / Mycan

Dependents:   2019_SwitchNode_AR ArmNode 2919_LineSensor 2019_MD ... more

Committer:
Kirua
Date:
Wed Jul 04 07:49:29 2018 +0000
Revision:
1:e632e292a8c2
Parent:
0:ce8efac4c651
Child:
3:055c2d38132f
????????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kirua 0:ce8efac4c651 1 #ifndef MYCAN_H
Kirua 0:ce8efac4c651 2 #define MYCAN_H
Kirua 0:ce8efac4c651 3
Kirua 0:ce8efac4c651 4 #include "mbed.h"
Kirua 0:ce8efac4c651 5
Kirua 0:ce8efac4c651 6 class Mycan
Kirua 0:ce8efac4c651 7 {
Kirua 0:ce8efac4c651 8 public:
Kirua 0:ce8efac4c651 9 Mycan(PinName _pin_rd, PinName _pin_td);//※最小IDを.cppの”min_id”で1にセットしている, ”read_val[→ここ][]”の数はIDの個数(結局IDは1~10の設定になっている)
Kirua 0:ce8efac4c651 10
Kirua 0:ce8efac4c651 11 void set (unsigned int _id, int _num, short int _data);//Messageの設定をする, numは1~7とする
Kirua 0:ce8efac4c651 12
Kirua 0:ce8efac4c651 13 void send ();//書き込み
Kirua 0:ce8efac4c651 14
Kirua 0:ce8efac4c651 15 void read ();//読み込み
Kirua 0:ce8efac4c651 16
Kirua 0:ce8efac4c651 17 float get(unsigned int _id, int _num);//readした値を持ってくる, IDやnumはコンストラクタと一緒
Kirua 0:ce8efac4c651 18
Kirua 0:ce8efac4c651 19 private:
Kirua 0:ce8efac4c651 20 CAN can;
Kirua 0:ce8efac4c651 21 unsigned int rd_id, td_id;
Kirua 0:ce8efac4c651 22 int rd_num, td_num;
Kirua 0:ce8efac4c651 23 unsigned int min_id;
Kirua 0:ce8efac4c651 24 short int data;
Kirua 0:ce8efac4c651 25 static short int write_val[8];
Kirua 0:ce8efac4c651 26 static short int read_val[10][8];
Kirua 1:e632e292a8c2 27 void _expressAbsoluteValue();
Kirua 1:e632e292a8c2 28 void _expressSignVal(unsigned int);
Kirua 0:ce8efac4c651 29
Kirua 0:ce8efac4c651 30 typedef struct
Kirua 0:ce8efac4c651 31 {
Kirua 0:ce8efac4c651 32 char writeVal_0;
Kirua 0:ce8efac4c651 33 char writeVal_1;
Kirua 0:ce8efac4c651 34 char writeVal_2;
Kirua 0:ce8efac4c651 35 char writeVal_3;
Kirua 0:ce8efac4c651 36 char writeVal_4;
Kirua 0:ce8efac4c651 37 char writeVal_5;
Kirua 0:ce8efac4c651 38 char writeVal_6;
Kirua 0:ce8efac4c651 39 char writeVal_7;
Kirua 0:ce8efac4c651 40 }write_can;
Kirua 0:ce8efac4c651 41
Kirua 0:ce8efac4c651 42 write_can td_data;
Kirua 0:ce8efac4c651 43
Kirua 0:ce8efac4c651 44 typedef struct
Kirua 0:ce8efac4c651 45 {
Kirua 0:ce8efac4c651 46 char readVal_0;
Kirua 0:ce8efac4c651 47 char readVal_1;
Kirua 0:ce8efac4c651 48 char readVal_2;
Kirua 0:ce8efac4c651 49 char readVal_3;
Kirua 0:ce8efac4c651 50 char readVal_4;
Kirua 0:ce8efac4c651 51 char readVal_5;
Kirua 0:ce8efac4c651 52 char readVal_6;
Kirua 0:ce8efac4c651 53 char readVal_7;
Kirua 0:ce8efac4c651 54 }read_can;
Kirua 0:ce8efac4c651 55
Kirua 0:ce8efac4c651 56 read_can rd_data;
Kirua 0:ce8efac4c651 57 };
Kirua 0:ce8efac4c651 58 #endif