2017_hongo_bteam_jushinkun_gamma

Dependencies:   gamma_controller_ mbed serial_2017_

Files at this revision

API Documentation at this revision

Comitter:
Komazawa_sun
Date:
Thu Aug 17 06:39:02 2017 +0000
Commit message:
2017_hongo_bteam_jushinkun_gamma

Changed in this revision

gamma_controller.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
serial_2017.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r c12ce6882f7a gamma_controller.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gamma_controller.lib	Thu Aug 17 06:39:02 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/Komazawa_sun/code/gamma_controller_/#c9adbf27bd9b
diff -r 000000000000 -r c12ce6882f7a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Aug 17 06:39:02 2017 +0000
@@ -0,0 +1,52 @@
+#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変えないで
+        wait(0.03);
+    }
+}
+
+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){
+        //read_error_led = 1;
+        transmit.write(twe.pack.all_data,GAMMA_DATA_SIZE);
+    }//else
+        //read_error_led = 0;
+}
\ No newline at end of file
diff -r 000000000000 -r c12ce6882f7a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Aug 17 06:39:02 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 c12ce6882f7a serial_2017.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serial_2017.lib	Thu Aug 17 06:39:02 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/Komazawa_sun/code/serial_2017_/#86be154bce86