File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 1818#include " drivers/I2C.h"
1919#include " drivers/DigitalInOut.h"
2020#include " platform/mbed_wait_api.h"
21+ #include " platform/mbed_assert.h"
2122
2223#if DEVICE_I2C
2324
@@ -58,6 +59,7 @@ I2C::~I2C()
5859void I2C::frequency (int hz)
5960{
6061 lock ();
62+ MBED_ASSERT (_hz > 0 );
6163 _hz = (uint32_t )hz;
6264
6365 // We want to update the frequency even if we are already the bus owners
Original file line number Diff line number Diff line change 1414 * See the License for the specific language governing permissions and
1515 * limitations under the License.
1616 */
17+ #include " platform/mbed_assert.h"
1718#include " drivers/I2CSlave.h"
1819
1920#if DEVICE_I2CSLAVE
@@ -33,7 +34,8 @@ I2CSlave::~I2CSlave()
3334
3435void I2CSlave::frequency (int hz)
3536{
36- i2c_frequency (&_i2c, hz);
37+ MBED_ASSERT (hz > 0 );
38+ i2c_frequency (&_i2c, (uint32_t )hz);
3739}
3840
3941void I2CSlave::timeout (uint32_t timeout)
You can’t perform that action at this time.
0 commit comments