Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ESDC2014 by
Diff: port.h
- Revision:
- 3:4306d042af6f
- Parent:
- 0:3417ca0a36c0
- Child:
- 4:a377ecb9364f
--- a/port.h Thu Jul 03 10:59:37 2014 +0000
+++ b/port.h Thu Jul 03 14:52:44 2014 +0000
@@ -34,6 +34,7 @@
MyDigitalOut IntelToMbed_LED(LED1); //uart port LED between Intel Board and Mbed
MyDigitalOut MbedToArduino_LED(LED2); //uart port LED between Mbed and Arduino
MySerial DEBUG(USBTX, USBRX); //usb serial port between computer and Mbed
+MySerial CompassData(p9, p10); ////uart port between compass and Mbed
MySerial IntelToMbed(p13, p14); //uart port between Intel Board and Mbed
MySerial MbedToArduino(p28, p27); //uart port between Mbed and Arduino
MyPwmOut lifter_pwmUp(p21);
@@ -48,8 +49,9 @@
MyDigitalOut buzzer_pin(p29);
Buzzer buzzer(&buzzer_pin);
+COMPASS compass(&CompassData);
-Communication com(&DEBUG, &IntelToMbed, &MbedToArduino);
+Communication com(&DEBUG, &IntelToMbed, &MbedToArduino, &compass);
Lifter lifter(&lifter_enable, &lifter_pwmUp, &lifter_pwmDown, &lifter_encoder_A, &lifter_encoder_B);
Camera_platform camera_platform(&camera_platform_pwmRoll, &camera_platform_pwmPitch, &camera_platform_pwmYaw);
@@ -67,6 +69,13 @@
com.putToBuffer(_x, 1); //function inside Communication::
//__enable_irq();
}
+void compassHandler()
+{
+ //__disable_irq();//disable interupt when receiving data from XBEE_UART
+ uint8_t _x = CompassData.getc();
+ compass.putToBuffer(_x); //function inside Communication::
+ //__enable_irq();
+}
void LifterPulseHandler()
{
@@ -100,6 +109,9 @@
MbedToArduino.baud(9600);
MbedToArduino.attach(&MbedToArduinoRxHandler); //serial interrupt function
+ CompassData.baud(56000);
+ CompassData.attach(&compassHandler);
+
lifter_encoder_A.fall(&LifterPulseHandler); //interrupt
camera_platform_pwmRoll.period_ms(20); //20ms periodic, 1000us to 2000us
