Bunch of small fixes (#154)

* use valid_params_if macro for lock assertion

* fixup param checking in pwm.h

* Fix range of fractional divider parameter check in pwm.h

Co-authored-by: Luke Wren <wren6991@gmail.com>
This commit is contained in:
Graham Sanderson
2021-02-19 08:15:29 -06:00
committed by graham sanderson
parent 0732d0c2a3
commit b53b0bac70
3 changed files with 26 additions and 17 deletions

View File

@ -10,6 +10,11 @@
#include "pico.h"
#include "hardware/sync.h"
// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_LOCK_CORE, Enable/disable assertions in the lock core, type=bool, default=1, group=pico_sync
#ifndef PARAM_ASSERTIONS_ENABLED_LOCK_CORE
#define PARAM_ASSERTIONS_ENABLED_LOCK_CORE 1
#endif
/** \file lock_core.h
* \ingroup pico_sync
*

View File

@ -7,7 +7,7 @@
#include "pico/lock_core.h"
void lock_init(lock_core_t *core, uint lock_num) {
assert(lock_num < NUM_SPIN_LOCKS);
valid_params_if(LOCK_CORE, lock_num < NUM_SPIN_LOCKS);
core->spin_lock = spin_lock_instance(lock_num);
}