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: AT24C1024 Amp AverageAnalogIn BaseMachineUIController Envelope ExioBufferdController FilterController MCP23S17 OscController PinDetect RotaryEncoder Sequence SequencerDisplay mbed-rtos mbed st7567LCD
Fork of BaseMachine by
Diff: main.cpp
- Revision:
- 10:0b7f4eb37197
- Parent:
- 8:4e38bb44c72e
- Child:
- 11:eb9e72bf529c
--- a/main.cpp Mon Nov 21 05:13:03 2016 +0000
+++ b/main.cpp Fri Nov 25 09:08:14 2016 +0000
@@ -10,6 +10,7 @@
#include "mbed.h"
#include "rtos.h"
+#include "AT24C1024.h"
#define UART_TRACE (0)
#include "BaseMachineCommon.h"
@@ -20,6 +21,7 @@
#include "SpiFilterController.h"
#define SPI1_RATE (1000000)
+#define I2C1_RATE (100000)
const int samplingPeriod = 1; // ms
const int bpm = 120;
@@ -33,6 +35,9 @@
//SPI1 (PinName mosi, PinName miso, PinName sclk, PinName ssel=NC)
SPI SpiMaster(PA_7, PA_6, PA_5);
+I2C I2cMaster(PB_9, PB_8); // SDA, SCL
+AT24C1024 At24c1024(I2cMaster); // Atmel 1Mbit EE-PROM
+
Sequence sequences[SEQUENCE_N];
SpiSequenceSender SequenceSender(&SpiMaster, D9, sequences, SEQUENCE_N, samplingPeriod, bpm);
@@ -156,6 +161,15 @@
SequenceSender.attachUpdate(&updateTicks);
SequenceSender.setWaveShape(waveShape);
+ // Byte Read/Write
+ //
+ uint8_t dt = 0xaa;
+ printf("Byte Write: %02x\r\n", dt);
+ At24c1024.write(0, dt); // write addr=0 data=dt
+ wait_ms(5);
+ dt = At24c1024.read(0); // read addr=0
+ printf("Byte Read: %02x\r\n", dt);
+
//--------------------------------------------------------------------
// Main loop
//
