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.
main.cpp
- Committer:
- antonmadto
- Date:
- 2021-04-09
- Revision:
- 1:bfc4fc3bd803
- Parent:
- 0:d47d291acdf4
File content as of revision 1:bfc4fc3bd803:
#include "mbed.h"
#include "USBSerial.h"
#include "ad7606.h"
#define MISO PB_4
#define SCLK PB_3
#define CS PA_8
#define CONVST PB_1
#define BUSY PB_6
#define RESET PB_7
// Create a BufferedSerial object with a default baud rate.
static BufferedSerial pc(USBTX, USBRX);
AD7606 ad7606(MISO, SCLK, CS, CONVST, BUSY, RESET, 10500000);
double aValues[8] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
int16_t rawValues[8] = {0, 0, 0, 0, 0, 0, 0, 0};
Ticker tick1;
volatile bool timerInterrupt = false;
void timInterrupt_ISR() {
timerInterrupt = true;
}
int main() {
pc.set_baud(115200);
printf("Hello, World!\r\n");
ad7606.setDR(10.0f);
// tick1.attach(timInterrupt_ISR, 0.1F);
while(1) {
// if (timerInterrupt) {
ad7606.readRAW(rawValues);
// printf("%d, %d, %d, %d, %d, %d, %d, %d\r\n", rawValues[0], rawValues[1], rawValues[2], rawValues[3], rawValues[4], rawValues[5], rawValues[6], rawValues[7]);
printf("%d\r\n", rawValues[0]);
// ad7606.readAnalog(aValues);
// printf("%d \r\n", rawValues[0], aValues[0]);
wait_us(10000);
// pc.write(aValues[0], 2);
// timerInterrupt = false;
// }
}
}