summaryrefslogtreecommitdiff
path: root/stmhal/adc.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-26 22:46:03 +0000
committerDamien George <damien.p.george@gmail.com>2014-03-26 22:46:03 +0000
commiteed6f26bed82969e3c9954159b17fe2733f4cb42 (patch)
tree204b135703111e810149f8f9fd0c786cc57c45ab /stmhal/adc.c
parentf61a072f68c59a7acf560e2ead948fb7658c523d (diff)
stmhal: Use rt_check_nargs to check number of arguments.
Diffstat (limited to 'stmhal/adc.c')
-rw-r--r--stmhal/adc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/stmhal/adc.c b/stmhal/adc.c
index f05e7823d..d28392c89 100644
--- a/stmhal/adc.c
+++ b/stmhal/adc.c
@@ -8,6 +8,7 @@
#include "qstr.h"
#include "obj.h"
#include "map.h"
+#include "runtime.h"
#include "adc.h"
#include "pin.h"
#include "build/pins.h"
@@ -118,9 +119,7 @@ STATIC void adc_print(void (*print)(void *env, const char *fmt, ...), void *env,
STATIC mp_obj_t adc_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
// check number of arguments
- if (!(n_args == 1 && n_kw == 0)) {
- nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "ADC accepts 1 argument"));
- }
+ rt_check_nargs(n_args, 1, 1, n_kw, false);
// 1st argument is the pin name
mp_obj_t pin_obj = args[0];