Skip to content

Commit 9fc5bb3

Browse files
committed
update
1 parent da9704c commit 9fc5bb3

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ A mockMCU hardware that uses ArduinoCore-API.
66
# Clone ArduinoCore api
77

88
```
9+
910
git clone https://github.com/arduino/ArduinoCore-api ArduinoCore-api
11+
1012
git clone https://github.com/guswib/ArduinoCore-mockMCU ArduinoCore-mockMCU
1113
1214

cores/arduino/UART.h

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <inttypes.h>
2727
#include "api/HardwareSerial.h"
2828
#include "pins_arduino.h"
29+
2930
#include "StreamMock.h"
3031

3132

cores/arduino/api2

-1
This file was deleted.

libraries/Wire/Wire.cpp

+14-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ extern "C" {
3131
#include "Wire.h"
3232
#include <api/Print.h>
3333

34+
#include "StreamMock.h"
35+
36+
3437

3538
#define DEFAULT_FREQUENCY 100000
3639

@@ -53,6 +56,7 @@ void (*TwoWire::user_onReceive)(int);
5356

5457
TwoWire::TwoWire()
5558
{
59+
5660
}
5761

5862
// Public Methods //////////////////////////////////////////////////////////////
@@ -65,7 +69,8 @@ void TwoWire::begin(void)
6569
txBufferIndex = 0;
6670
txBufferLength = 0;
6771

68-
//TWI_MasterInit(DEFAULT_FREQUENCY);
72+
//TWI_MasterInit(DEFAULT_FREQUENCY);
73+
Serial.println("Wire activated");
6974
}
7075

7176
void TwoWire::begin(uint8_t address)
@@ -80,7 +85,8 @@ void TwoWire::begin(uint8_t address)
8085

8186
//TWI_attachSlaveTxEvent(onRequestService, txBuffer); // default callback must exist
8287
//TWI_attachSlaveRxEvent(onReceiveService, rxBuffer, BUFFER_LENGTH); // default callback must exist
83-
88+
Serial.println("Wire activated");
89+
8490
}
8591

8692
void TwoWire::begin(int address)
@@ -130,6 +136,8 @@ size_t TwoWire::requestFrom(int address, int quantity, int sendStop)
130136

131137
void TwoWire::beginTransmission(uint8_t address)
132138
{
139+
Serial.println("Wire-Tx: ");
140+
133141
// indicate that we are transmitting
134142
transmitting = 1;
135143
// set address of targeted slave
@@ -168,7 +176,8 @@ uint8_t TwoWire::endTransmission(bool sendStop)
168176

169177
// indicate that we are done transmitting
170178
transmitting = 0;
171-
179+
Serial.println("\nWire-End-Tx: ");
180+
172181
return status;
173182
}
174183

@@ -197,7 +206,8 @@ size_t TwoWire::write(uint8_t data)
197206

198207
/* Update buffer length */
199208
txBufferLength = txBufferIndex;
200-
209+
Serial.print(data);
210+
Serial.print(" ");
201211
return 1;
202212
}
203213

test/CMakeLists.txt

+10-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@ cmake_minimum_required(VERSION 3.25)
99
project(example_test)
1010
include (CTest)
1111
##########################################################################
12-
message("\n\nArduino_API at: " ${PROJECT_SOURCE_DIR})
12+
13+
cmake_path(GET PROJECT_SOURCE_DIR PARENT_PATH PRJ_ROOT)
14+
15+
message("\n\PROJECT ROOT at: " ${PRJ_ROOT})
1316
include_directories(./include)
1417
message("hej")
18+
1519
set(arduinoCore ${PROJECT_SOURCE_DIR}/../cores/arduino )
20+
cmake_path(APPEND arduinoCore "${PRJ_ROOT}" "cores/arduino")
21+
1622
include_directories(${arduinoCore}) #Path tho arduino-core
23+
cmake_path(APPEND arduinoCore_API "${PRJ_ROOT}" "cores/arduino/api")
24+
25+
#set(arduinoCore_API ${PROJECT_SOURCE_DIR}/../cores/arduino/api )
1726

18-
set(arduinoCore_API ${PROJECT_SOURCE_DIR}/../cores/arduino/api )
1927
if(NOT IS_DIRECTORY ${arduinoCore_API})
2028
#set(arduinoCore_API ${PROJECT_SOURCE_DIR}/../ArduinoCore-API/api )
2129
#include_directories(../ArduinoCore-API/api)

0 commit comments

Comments
 (0)