File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,28 @@ void arduino::ZephyrI2C::begin(uint8_t slaveAddr) {
21
21
22
22
void arduino::ZephyrI2C::end () {}
23
23
24
- void arduino::ZephyrI2C::setClock (uint32_t freq) {}
24
+ void arduino::ZephyrI2C::setClock (uint32_t freq) {
25
+ uint8_t speed = I2C_SPEED_STANDARD;
26
+ if (freq > 0x06u ) {
27
+ if (freq == 100000 ) {
28
+ speed = I2C_SPEED_STANDARD;
29
+ } else if (freq == 400000 ) {
30
+ speed = I2C_SPEED_FAST;
31
+ } else if (freq == 1000000 ) {
32
+ speed = I2C_SPEED_FAST_PLUS;
33
+ } else {
34
+ speed = I2C_SPEED_STANDARD;
35
+ }
36
+ } else {
37
+ speed = (uint8_t ) freq;
38
+ }
39
+ uint32_t i2c_cfg = I2C_MODE_CONTROLLER |
40
+ I2C_SPEED_SET (speed);
41
+
42
+ if (i2c_configure (i2c_dev, i2c_cfg)) {
43
+ // Serial.println("Failed to configure i2c interface.");
44
+ }
45
+ }
25
46
26
47
void arduino::ZephyrI2C::beginTransmission (uint8_t address) { // TODO for ADS1115
27
48
_address = address;
Original file line number Diff line number Diff line change @@ -151,4 +151,5 @@ FORCE_EXPORT_SYM(__aeabi_uidivmod);
151
151
FORCE_EXPORT_SYM (__aeabi_dcmpeq );
152
152
FORCE_EXPORT_SYM (__aeabi_d2iz );
153
153
FORCE_EXPORT_SYM (__aeabi_f2d );
154
- FORCE_EXPORT_SYM (__aeabi_idivmod );
154
+ FORCE_EXPORT_SYM (__aeabi_idivmod );
155
+ FORCE_EXPORT_SYM (__aeabi_ldivmod );
You can’t perform that action at this time.
0 commit comments