2017_Bteam_jushinkun_kai
Dependencies: gamma_controller mbed serial_2017
Revision 0:cf9afbdbedd8, committed 2017-06-27
- Comitter:
- Komazawa_sun
- Date:
- Tue Jun 27 07:56:51 2017 +0000
- Commit message:
- 2017_Bteam_jushinkun
Changed in this revision
diff -r 000000000000 -r cf9afbdbedd8 gamma_controller.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gamma_controller.lib Tue Jun 27 07:56:51 2017 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/Komazawa_sun/code/gamma_controller/#c1bfd7b7e4b9
diff -r 000000000000 -r cf9afbdbedd8 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 27 07:56:51 2017 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" +#include "gamma_ctrl.h" +#define I2C_SDA dp5 +#define I2C_SCL dp27 + +DigitalOut read_success_led(LED1); +DigitalOut read_error_led(LED2); +I2CSlave transmit(I2C_SDA,I2C_SCL); +gamma_ctrl twe(115200); +void status_led(); +void i2c_send(); + +int main() +{ + transmit.address(GAMMA_ADDRESS); + while(1) + { + twe.get_data(); + status_led(); + i2c_send(); + /*printf("status:%d",twe.error_status); + printf(",rx:%d,ry:%d,r,%d%d%d%d",twe.pack.data.rx,twe.pack.data.ry, + twe.pack.data.r_sw1,twe.pack.data.r_sw2, + twe.pack.data.r_sw3,twe.pack.data.r_sw4); + printf("\r\n");*/ + wait(0.1); //wait変えないで + } +} + +void status_led() +{ + if(twe.error_status == 0) + { + read_error_led = 0; + read_success_led = 1; + } + else + { + read_error_led = 1; + read_success_led = 0; + } +} + +void i2c_send() +{ + if(transmit.receive() == I2CSlave::ReadAddressed){ + transmit.write(twe.pack.all_data,GAMMA_DATA_SIZE - 1); + } +} \ No newline at end of file
diff -r 000000000000 -r cf9afbdbedd8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jun 27 07:56:51 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/0f02307a0877 \ No newline at end of file
diff -r 000000000000 -r cf9afbdbedd8 serial_2017.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serial_2017.lib Tue Jun 27 07:56:51 2017 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/Komazawa_sun/code/serial_2017/#4be3cd232468