aboutsummaryrefslogtreecommitdiff
path: root/stmhal/pin.h
diff options
context:
space:
mode:
authorDave Hylands2014-03-24 10:49:23 -0700
committerDave Hylands2014-03-24 11:16:35 -0700
commit1403298a653fdb1ed3604bab71ce17200e5017f7 (patch)
tree77ce4ff7acd51385b0baadae98035dda89989198 /stmhal/pin.h
parent6609d636d042fb02bdd07ea578cc3dbf6a311273 (diff)
stmhal - fixed up adc stuff
Added support for the ADC channels and mappings to make_pins.py I'm not sure if the hal properly deals with the channel 16/18 differences between the 40x and 42x. It seems to deal with it partially. This particular aspect will need testing on a 42x or 43x.
Diffstat (limited to 'stmhal/pin.h')
-rw-r--r--stmhal/pin.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/stmhal/pin.h b/stmhal/pin.h
index d5d769058..2aa50655b 100644
--- a/stmhal/pin.h
+++ b/stmhal/pin.h
@@ -50,6 +50,12 @@ enum {
AF_PIN_TYPE_SPI_NSS,
};
+enum {
+ PIN_ADC1 = (1 << 0),
+ PIN_ADC2 = (1 << 1),
+ PIN_ADC3 = (1 << 2),
+};
+
typedef struct {
mp_obj_base_t base;
uint8_t idx;
@@ -70,9 +76,11 @@ typedef struct {
typedef struct {
mp_obj_base_t base;
const char *name;
- uint16_t port : 4;
- uint16_t pin : 4;
- uint16_t num_af : 4;
+ uint16_t port : 4;
+ uint16_t pin : 4;
+ uint16_t num_af : 4;
+ uint16_t adc_channel : 4;
+ uint16_t adc_num : 3; // 1 bit per ADC
uint16_t pin_mask;
GPIO_TypeDef *gpio;
const pin_af_obj_t *af;