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.
Dependencies: EsmacatShield X_NUCLEO_IHM01A1
Revision 41:74e394ae8b5f, committed 2020-02-12
- Comitter:
- pratima_hb
- Date:
- Wed Feb 12 22:08:37 2020 +0000
- Parent:
- 39:1270497828ca
- Commit message:
- cosmetic changes
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Feb 06 22:44:58 2020 +0000
+++ b/main.cpp Wed Feb 12 22:08:37 2020 +0000
@@ -165,32 +165,24 @@
int main()
{
- /*----- Initialization of EASE -----*/
-
- /*----- Initialization. -----*/
-
- /* Initializing SPI bus. */
+ /* Initializing SPI bus for Motor */
DevSPI dev_spi(D11, D12, D13);// SPI device for the motor
dev_spi.setup(8, 3, 3E6); // Set-up SPI device for the motor
-
+/* EASE slave object creation and Initializing SPI bus for EASE */
EsmacatShield slave(spi, selectPin); //Define Chip Selector Pin
slave.setup_spi(); //Setup SPI for EASE
-
/* Initializing Motor Control Component. */
motor = new L6474(D2, D8, D7, D3, D10, dev_spi);//PWM pin is set to D3 as D9 is used by EASE
if (motor->init(&init) != COMPONENT_OK) {
exit(EXIT_FAILURE);
}
-
+
/* Attaching and enabling interrupt handlers. */
motor->attach_flag_irq(&flag_irq_handler);
motor->enable_flag_irq();
-
-
-
-
+
while(1)
{
// This part of the code sets up the Mode 1 for SPI to be used for
@@ -206,8 +198,7 @@
wait_us(1000);
/* Printing to the console. */
printf("--> Moving to position : %d\r\n", ease_read[0]);
-
-
+
// This part of the code sets up the Mode 1 for SPI to be used for
// communication with EASE. This is needed because SPI for EASE operates
// in Mode 1 which is different than what the motor shield SPI operates in.
@@ -215,8 +206,7 @@
wait_us(200);
// command the motor to go to a set postion
- motor->go_to(ease_read[0]);
-
+ motor->go_to(ease_read[0]);
/* Getting current position. */
int position = motor->get_position();