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: mbed
Fork of Lab_6_WaG by
main.cpp
- Committer:
- spm71
- Date:
- 2018-03-22
- Revision:
- 25:896dbc85907e
- Parent:
- 23:3da1d39c1ae9
- Child:
- 28:a07b27cc6d13
File content as of revision 25:896dbc85907e:
/******************************************************************************
* EECS 397
*
* Assignment Name: Lab 5: WaG
*
* Authors: Sam Morrison and Phong Nguyen
* File name: main.cpp
* Purpose: Configures the dispaly for 4-digit display or motor control
*
* Created: 03/01/2018
* Last Modified: 03/08/2018
*
******************************************************************************/
#include "mbed.h"
#include "io_pins.h"
#include "display.h"
#include "spi.h"
#include "stepper.h"
#include "utility.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
SPI wag_spi(MOSI, MISO, SCLK);
Serial pc(USBTX, USBRX);
DigitalIn jog_cw(UI_JOG_RIGHT_BUTTON);
DigitalIn jog_ccw(UI_JOG_LEFT_BUTTON);
DigitalIn my_button(USER_BUTTON);
DigitalIn start_button(UI_START_BUTTON);
DigitalIn cal_button(UI_CAL_BUTTON);
DigitalIn station_select(UI_STATION_SELECT);
struct spi_cfg as1107{
SPI_AS1107_ID,
DSP_AS1107_NCS,
SPI_NO_ID,
AS1107_SPI_FREQ,
AS1107_SPI_NO_BITS,
};
int main(void) {
initial_setup(as1107);
char bcd[4];
char input;
int display_number;
//set all digits to zero
spi_send(as1107 0x0100);
spi_send(as1107 0x0200);
spi_send(as1107 0x0300);
spi_send(as1107 0x0400);
jog_cw.mode(PullUp);
jog_ccw.mode(PullUp);
while(1) {
if (jog_ccw == 0) {
stp_step(STP_CCW);
}
if (jog_cw == 0) {
stp_step(STP_CW);
}
}
}
