File tree Expand file tree Collapse file tree
ports/nrf/common-hal/busio Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,11 +137,17 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *
137137
138138 nrfx_twim_config_t config = NRFX_TWIM_DEFAULT_CONFIG (scl -> number , sda -> number );
139139
140- // change freq. only if it's less than the default 400K
141- if (frequency < 100000 ) {
142- config .frequency = NRF_TWIM_FREQ_100K ;
143- } else if (frequency < 250000 ) {
140+ #if defined(TWIM_FREQUENCY_FREQUENCY_K1000 )
141+ if (frequency >= 1000000 ) {
142+ config .frequency = NRF_TWIM_FREQ_1000K ;
143+ } else
144+ #endif
145+ if (frequency >= 400000 ) {
146+ config .frequency = NRF_TWIM_FREQ_400K ;
147+ } else if (frequency >= 250000 ) {
144148 config .frequency = NRF_TWIM_FREQ_250K ;
149+ } else {
150+ config .frequency = NRF_TWIM_FREQ_100K ;
145151 }
146152
147153 self -> scl_pin_number = scl -> number ;
You can’t perform that action at this time.
0 commit comments