Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c0ec94f

Browse files
author
Owen L - SFE
committedJan 9, 2020
Merge branch 'master' into core-ble
2 parents 1cbe4cb + af4a0e3 commit c0ec94f

13 files changed

+209
-157
lines changed
 

‎libraries/Wire/keywords.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ requestFrom KEYWORD2
1717
onReceive KEYWORD2
1818
onRequest KEYWORD2
1919
setClock KEYWORD2
20+
setPullups KEYWORD2
21+
2022

2123
#######################################
2224
# Instances (KEYWORD2)

‎libraries/Wire/src/Wire.cpp

Lines changed: 134 additions & 94 deletions
Large diffs are not rendered by default.

‎libraries/Wire/src/Wire.h

Lines changed: 59 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,77 +30,81 @@ SOFTWARE.
3030

3131
#define AP3_WIRE_RX_BUFFER_LEN 256
3232
#define AP3_WIRE_TX_BUFFER_LEN 256
33-
#define AP3_WIRE_LINEAR_BUFFER_LEN (AP3_WIRE_RX_BUFFER_LEN+AP3_WIRE_TX_BUFFER_LEN)
33+
#define AP3_WIRE_LINEAR_BUFFER_LEN (AP3_WIRE_RX_BUFFER_LEN + AP3_WIRE_TX_BUFFER_LEN)
3434

35-
// WIRE_HAS_END means Wire has end()
35+
// WIRE_HAS_END means Wire has end()
3636
#define WIRE_HAS_END 1
3737

38-
class TwoWire : public Stream, public IOMaster {
39-
public:
40-
TwoWire(uint8_t iom_instance);
41-
void begin();
42-
void begin(uint8_t, bool enableGeneralCall = false);
43-
void end();
44-
void setClock(uint32_t);
45-
46-
void beginTransmission(uint8_t address);
47-
uint8_t endTransmission(bool stopBit = true);
48-
49-
uint8_t requestFrom(uint8_t address, size_t quantity, bool stopBit = true);
50-
51-
size_t write(uint8_t data);
52-
size_t write(const uint8_t * data, size_t quantity);
53-
54-
virtual int available(void);
55-
virtual int read(void);
56-
virtual int peek(void);
57-
virtual void flush(void);
58-
void onReceive(void(*)(int));
59-
void onRequest(void(*)(void));
60-
61-
inline size_t write(unsigned long n) { return write((uint8_t)n); }
62-
inline size_t write(long n) { return write((uint8_t)n); }
63-
inline size_t write(unsigned int n) { return write((uint8_t)n); }
64-
inline size_t write(int n) { return write((uint8_t)n); }
65-
using Print::write;
66-
67-
void onService(void);
68-
69-
private:
70-
ap3_gpio_pin_t _padSDA;
71-
ap3_gpio_pin_t _padSCL;
72-
73-
bool _transmissionBegun;
74-
uint8_t _transmissionAddress;
75-
76-
77-
RingBufferN<AP3_WIRE_RX_BUFFER_LEN> _rxBuffer;// RX Buffer
78-
RingBufferN<AP3_WIRE_TX_BUFFER_LEN> _txBuffer;// TX buffer
79-
uint8_t _linearBugger[AP3_WIRE_LINEAR_BUFFER_LEN]; // ToDo: choose a more efficient way to handle this
80-
uint8_t txAddress;
81-
82-
// Callback user functions
83-
void (*_onRequestCallback)(void);
84-
void (*_onReceiveCallback)(int);
38+
class TwoWire : public Stream, public IOMaster
39+
{
40+
public:
41+
TwoWire(uint8_t iom_instance);
42+
void begin();
43+
void begin(uint8_t, bool enableGeneralCall = false);
44+
void end();
45+
void setClock(uint32_t);
46+
void setPullups(uint32_t);
47+
48+
void beginTransmission(uint8_t address);
49+
uint8_t endTransmission(bool stopBit = true);
50+
51+
uint8_t requestFrom(uint8_t address, size_t quantity, bool stopBit = true);
52+
53+
size_t write(uint8_t data);
54+
size_t write(const uint8_t *data, size_t quantity);
55+
56+
virtual int available(void);
57+
virtual int read(void);
58+
virtual int peek(void);
59+
virtual void flush(void);
60+
void onReceive(void (*)(int));
61+
void onRequest(void (*)(void));
62+
63+
inline size_t write(unsigned long n) { return write((uint8_t)n); }
64+
inline size_t write(long n) { return write((uint8_t)n); }
65+
inline size_t write(unsigned int n) { return write((uint8_t)n); }
66+
inline size_t write(int n) { return write((uint8_t)n); }
67+
using Print::write;
68+
69+
void onService(void);
70+
71+
private:
72+
am_hal_iom_transfer_t iomTransfer = {0};
73+
ap3_gpio_pin_t _padSDA;
74+
ap3_gpio_pin_t _padSCL;
75+
76+
bool _transmissionBegun;
77+
uint8_t _transmissionAddress;
78+
am_hal_gpio_pullup_e _pullups;
79+
uint32_t _clockSpeed;
80+
81+
RingBufferN<AP3_WIRE_RX_BUFFER_LEN> _rxBuffer; // RX Buffer
82+
RingBufferN<AP3_WIRE_TX_BUFFER_LEN> _txBuffer; // TX buffer
83+
uint8_t _linearBugger[AP3_WIRE_LINEAR_BUFFER_LEN]; // ToDo: choose a more efficient way to handle this
84+
uint8_t txAddress;
85+
86+
// Callback user functions
87+
void (*_onRequestCallback)(void);
88+
void (*_onReceiveCallback)(int);
8589
};
8690

8791
#if WIRE_INTERFACES_COUNT > 0
88-
extern TwoWire Wire;
92+
extern TwoWire Wire;
8993
#endif
9094
#if WIRE_INTERFACES_COUNT > 1
91-
extern TwoWire Wire1;
95+
extern TwoWire Wire1;
9296
#endif
9397
#if WIRE_INTERFACES_COUNT > 2
94-
extern TwoWire Wire2;
98+
extern TwoWire Wire2;
9599
#endif
96100
#if WIRE_INTERFACES_COUNT > 3
97-
extern TwoWire Wire3;
101+
extern TwoWire Wire3;
98102
#endif
99103
#if WIRE_INTERFACES_COUNT > 4
100-
extern TwoWire Wire4;
104+
extern TwoWire Wire4;
101105
#endif
102106
#if WIRE_INTERFACES_COUNT > 5
103-
extern TwoWire Wire5;
107+
extern TwoWire Wire5;
104108
#endif
105109

106110
#endif // _AP3_WIRE_H_

‎package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "framework-arduinoapollo3",
3+
"description": "Arduino Wiring-based Framework (Apollo3 Core)",
4+
"version": "1.0.23",
5+
"url": "https://github.com/sparkfun/Arduino_Apollo3"
6+
}

‎variants/edge/include/hm01b0/HM01B0.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16-
#include "himax_driver_HM01B0.h"
16+
#include "HM01B0.h"
1717

18-
#include "himax_driver_HM01B0_Walking1s_01.h"
18+
#include "HM01B0_Walking1s_01.h"
1919
#include "am_bsp.h"
2020
#include "am_mcu_apollo.h"
2121
#include "am_util.h"

‎variants/edge/include/hm01b0/himax_driver_HM01B0_RAW8_QVGA_8bits_lsb_5fps.h renamed to ‎variants/edge/include/hm01b0/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_RAW8_QVGA_8BITS_LSB_5FPS_H_
1717
#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_RAW8_QVGA_8BITS_LSB_5FPS_H_
1818

19-
#include "himax_driver_HM01B0.h"
19+
#include "HM01B0.h"
2020

2121
const hm_script_t sHM01B0InitScript[] = {
2222
// ;*************************************************************************

‎variants/edge/include/hm01b0/himax_driver_HM01B0_Walking1s_01.h renamed to ‎variants/edge/include/hm01b0/HM01B0_Walking1s_01.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_WALKING1S_01_H_
1717
#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_WALKING1S_01_H_
1818

19-
#include "himax_driver_HM01B0.h"
19+
#include "HM01B0.h"
2020

2121
const hm_script_t sHM01b0TestModeScript_Walking1s[] = {
2222
{

‎variants/edge/include/hm01b0/HM01B0_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16-
#include "himax_driver_HM01B0_debug.h"
16+
#include "HM01B0_debug.h"
1717
#include "am_util.h" // NOLINT
1818

1919
void hm01b0_framebuffer_dump(uint8_t* frame, uint32_t length) {

‎variants/edge/include/hm01b0/himax_driver_HM01B0_debug.h renamed to ‎variants/edge/include/hm01b0/HM01B0_debug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020
extern "C" {
2121
#endif
2222

23-
#include "himax_driver_HM01B0.h"
23+
#include "HM01B0.h"
2424

2525
//*****************************************************************************
2626
//

‎variants/edge/include/hm01b0/HM01B0_optimized.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16-
#include "himax_driver_HM01B0.h"
16+
#include "HM01B0.h"
1717
#include "am_bsp.h" //NOLINT
1818
#include "am_mcu_apollo.h" //NOLINT
1919
#include "hm01b0_platform.h" // TARGET specific implementation

‎variants/edge/include/hm01b0/himax_driver_HM01B0_optimized.h renamed to ‎variants/edge/include/hm01b0/HM01B0_optimized.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020
extern "C" {
2121
#endif
2222

23-
#include "himax_driver_HM01B0.h"
23+
#include "HM01B0.h"
2424

2525
//*****************************************************************************
2626
//

0 commit comments

Comments
 (0)
Please sign in to comment.