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.
Dependents: serial_connected_mcu_nucleo serial_connected_mcu_nucleo
Fork of serial_connected_mcu by
Revision 4:1323ef48a984, committed 2016-07-10
- Comitter:
- inst
- Date:
- Sun Jul 10 07:10:24 2016 +0000
- Parent:
- 3:c927b60f053c
- Child:
- 5:77d6f1ddf2e4
- Child:
- 6:a0cc9c27cedf
- Commit message:
Changed in this revision
--- a/serial_connected_mcu.cpp Sun Jul 10 06:53:44 2016 +0000
+++ b/serial_connected_mcu.cpp Sun Jul 10 07:10:24 2016 +0000
@@ -1,4 +1,5 @@
#include "serial_connected_mcu.hpp"
+#include "serial_connected_mcu_slave.hpp"
#include "mbed.h"
namespace serial_connected_mcu {
@@ -33,6 +34,12 @@
}
serial_connected_mcu::serial_connected_mcu() {
+ /*
+ for (size_t i = 0; i < serial_connected_mcu::serial_connected_mcu_slave::) {
+ _slave.set();
+ }
+ */
+
for (size_t i = 0; i < SERVO_NUM; ++i) {
_servos[i] = new servo(_servo_pins[i]);
}
--- a/serial_connected_mcu.hpp Sun Jul 10 06:53:44 2016 +0000
+++ b/serial_connected_mcu.hpp Sun Jul 10 07:10:24 2016 +0000
@@ -3,6 +3,7 @@
#include "rotary_encoder_ab_phase.hpp"
#include "servo.hpp"
+#include "serial_connected_mcu_slave.hpp"
#include "mbed.h"
namespace serial_connected_mcu {
@@ -53,6 +54,8 @@
servo* _servos[SERVO_NUM];
rotary_encoder_ab_phase* _encoders[ENCODER_NUM];
AnalogIn* _analog_inputs[ANALOG_INPUT_NUM];
+
+ serial_connected_mcu_slave _slave;
};
} /* namespace serial_connected_mcu */
--- a/serial_connected_mcu_slave.cpp Sun Jul 10 06:53:44 2016 +0000
+++ b/serial_connected_mcu_slave.cpp Sun Jul 10 07:10:24 2016 +0000
@@ -30,7 +30,6 @@
void serial_connected_mcu_slave::on_received(){
char received_char = port->getc();
if (received_char == '\n'){
- //port->printf("%d,%d,%d,%d,%d,%d\n", array_of_write_data[0], array_of_write_data[1], array_of_write_data[2], array_of_write_data[3], array_of_write_data[4], array_of_write_data[5]);
for (int i = 0;;i++){
port->printf("%d", array_of_write_data[i]);
if (i == (SIZE_OF_WRITE_DATA - 1)){
--- a/serial_connected_mcu_slave.hpp Sun Jul 10 06:53:44 2016 +0000
+++ b/serial_connected_mcu_slave.hpp Sun Jul 10 07:10:24 2016 +0000
@@ -8,14 +8,14 @@
#include <sstream>
namespace serial_connected_mcu{
- enum{
+ enum read_id {
ESC1,
ESC2,
ESC3,
SIZE_OF_READ_DATA
};
- enum{
+ enum write_id {
ENCODER1,
ENCODER2,
ENCODER3,
@@ -43,4 +43,6 @@
void on_received();
void string_to_int();
};
-}
\ No newline at end of file
+}
+
+#endif
