gamma_controller
Revision 0:c1bfd7b7e4b9, committed 2017-06-27
- Comitter:
- Komazawa_sun
- Date:
- Tue Jun 27 07:54:10 2017 +0000
- Commit message:
- for gamma_controller
Changed in this revision
diff -r 000000000000 -r c1bfd7b7e4b9 gamma_ctrl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gamma_ctrl.cpp Tue Jun 27 07:54:10 2017 +0000 @@ -0,0 +1,26 @@ +#include "gamma_ctrl.h" + +gamma_ctrl::gamma_ctrl(int baudlate_g) + :ctrl_serial(baudlate_g,GAMMA_DATA_SIZE) +{ +} + +void gamma_ctrl::get_data() +{ + //printf("sub class\r\n"); + if(allready_set_data == true) + { + for(int t = 0;t < GAMMA_DATA_SIZE;t++) + { + pack.all_data[t] = ctrl_data[t]; + //printf("%x",ctrl_data[t]); + } + allready_set_data = false; + //printf("\r\n"); + } + /*else + { + for(int t = 0;t < GAMMA_DATA_SIZE;t++) + pack.all_data[t] = 0; + }*/ +} \ No newline at end of file
diff -r 000000000000 -r c1bfd7b7e4b9 gamma_ctrl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gamma_ctrl.h Tue Jun 27 07:54:10 2017 +0000 @@ -0,0 +1,47 @@ +#ifndef GAMMA_CTRL_H_ +#define GAMMA_CTRL_H_ + +#include "ctrl_serial.h" + +class gamma_ctrl : public ctrl_serial +{ + public: + gamma_ctrl(int baudrate_g); + void get_data(); + + union gamma_packet + { + char all_data[GAMMA_DATA_SIZE]; + struct + { + unsigned char start_byte:8; + signed int rx :8; + signed int ry :8; + signed int lx :8; + unsigned int r_sw1 :1; + unsigned int r_sw2 :1; + unsigned int r_sw3 :1; + unsigned int r_sw4 :1; + unsigned int r_s_sw1 :1; + unsigned int r_s_sw2 :1; + unsigned int l_sw1 :1; + unsigned int l_sw2 :1; + unsigned int l_sw3 :1; + unsigned int l_sw4 :1; + unsigned int l_s_sw1 :1; + unsigned int l_s_sw2 :1; + unsigned int mode1 :1; + unsigned int mode2 :1; + unsigned int r_srd :2; + unsigned int l_srd :2; + unsigned int no_data :6; + unsigned char phecksum:8; + unsigned char stop_byte :8; + }data; + }; + + gamma_packet pack; + +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r c1bfd7b7e4b9 gamma_defines.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gamma_defines.h Tue Jun 27 07:54:10 2017 +0000 @@ -0,0 +1,6 @@ +#ifndef GAMMA_DEFINES_H_ + +#define GAMMA_DATA_SIZE 9 +#define GAMMA_ADDRESS 0x12 + +#endif \ No newline at end of file