diff --git a/data/registers/adc_v0.yaml b/data/registers/adc_v0.yaml index 136bc6c..e920271 100644 --- a/data/registers/adc_v0.yaml +++ b/data/registers/adc_v0.yaml @@ -1,5 +1,5 @@ block/ADC: - description: Analog to digital converter. + description: Analog to digital converter for V003. No TKEY items: - name: STATR description: status register. @@ -124,6 +124,7 @@ fieldset/CTLR1: description: ADC Calibration voltage selection. bit_offset: 25 bit_size: 2 + enum: CALVOL fieldset/CTLR2: description: control register 2. fields: @@ -397,3 +398,14 @@ enum/JEXTSEL: - name: JSWSTART description: Software start. value: 0b111 +enum/CALVOL: + bit_size: 2 + description: Calibration voltage + variants: + - name: CaliVoltage2_4AVDD + descrption: 2/4 AVDD + value: 0b01 + - name: CaliVoltage3_4AVDD + descrption: 3/4 AVDD + value: 0b10 + diff --git a/data/registers/adc_v1.yaml b/data/registers/adc_v1.yaml index a8b8c58..837c410 100644 --- a/data/registers/adc_v1.yaml +++ b/data/registers/adc_v1.yaml @@ -1,5 +1,6 @@ +# TKEY module is totally different from others block/ADC: - description: Analog to digital converter. + description: Analog to digital converter of V103 items: - name: STATR description: status register. @@ -65,6 +66,22 @@ block/ADC: byte_offset: 76 access: Read fieldset: RDATAR +block/TKEY: + extends: ADC + description: Touch key + items: + - name: CTLR + description: TKEY_V control register + byte_offset: 0x0C + fieldset: TK_CTLR + - name: CHANNEL + description: Touch key channel selection register + byte_offset: 0x34 + fieldset: TK_CHANNEL + - name: SDR + description: Status and data register + byte_offset: 0x4C + fieldset: TK_SDR fieldset/CTLR1: description: control register 1. fields: @@ -120,6 +137,10 @@ fieldset/CTLR1: description: Analog watchdog enable on regular channels. bit_offset: 23 bit_size: 1 + - name: TKENABLE + description: Touch key module enable + bit_offset: 24 + bit_size: 1 fieldset/CTLR2: description: control register 2. fields: @@ -312,6 +333,49 @@ fieldset/WDLTR: description: Analog watchdog lower threshold. bit_offset: 0 bit_size: 12 +# TKEY part +fieldset/TK_CTLR: + description: Touch key control register + fields: + - name: TKENABLE + description: Touch key module enable + bit_offset: 24 + bit_size: 1 + - name: TKIEN + description: Touch key interrupt enable + bit_offset: 25 + bit_size: 1 + - name: TKCPS + description: Touch key counter period selection + bit_offset: 26 + bit_size: 1 + enum: TKCPS + - name: TKIF + description: Touch key conversion finished flag + bit_offset: 27 + bit_size: 1 + - name: CCSEL + description: Touch key counter time base + bit_offset: 28 + bit_size: 3 + enum: CCSEL +fieldset/TK_CHANNEL: + description: Touch key channel selection register + fields: + - name: CHSEL + bit_offset: 0 + bit_size: 5 +fieldset/TK_SDR: + description: Touch key status and data register + fields: + - name: TKDR + description: Touch key data + bit_offset: 0 + bit_size: 14 + - name: TKSTA + description: Touch key working status, 1 for converting, 0 for pausing(TKDR can be read) + bit_offset: 15 + bit_size: 1 enum/SAMPLE_TIME: bit_size: 3 description: Sample time selection @@ -369,7 +433,6 @@ enum/EXTSEL: - name: SWSTART description: Software start. value: 0b111 - enum/JEXTSEL: bit_size: 3 description: External event select for injected group. @@ -398,3 +461,27 @@ enum/JEXTSEL: - name: JSWSTART description: Software start. value: 0b111 +enum/CCSEL: + bit_size: 3 + description: Counter clock selection + variants: + - name: CLOCK_8MHZ + value: 0b000 + - name: CLOCK_12MHZ + value: 0b001 + - name: CLOCK_24MHZ + value: 0b010 + - name: CLOCK_36MHZ + value: 0b011 + - name: CLOCK_48MHZ + value: 0b100 + - name: CLOCK_56MHZ + value: 0b101 +enum/TKCPS: + bit_size: 1 + description: Touch key counting period selection + variants: + - name: PERIOD_1MS + value: 1 + - name: PERIOD_500US + value: 0 diff --git a/data/registers/adc_v3.yaml b/data/registers/adc_v3.yaml index e1a93c9..b151ddd 100644 --- a/data/registers/adc_v3.yaml +++ b/data/registers/adc_v3.yaml @@ -125,6 +125,15 @@ fieldset/CTLR1: bit_offset: 23 bit_size: 1 # 24, 25 for TKEY + - name: TKENABLE + description: Touch key module enable + bit_offset: 24 + bit_size: 1 + - name: TKITUNE + description: Touch key current tune + bit_offset: 25 + bit_size: 1 + enum: TKITUNE - name: BUFEN description: ADC BUFFER enable bit_offset: 26 @@ -134,6 +143,26 @@ fieldset/CTLR1: bit_offset: 27 bit_size: 2 enum: PGA +block/TKEY: + extends: ADC + description: Touch key + items: + # CHARGE1 mapped to SAMPTR1 + # CHARGE2 mapped to SAMPTR2 + # DR mapped to RDATAR + - name: CHGOFFSET + description: Charge time offset register (map of ADC_IDATAR1) + byte_offset: 0x3C + # change to u8 + bit_size: 8 + - name: ACT_DCG + description: Activate and discharge time register (map of ADC_RDATAR) + byte_offset: 0x4C + bit_size: 8 + - name: DR + description: Data register + byte_offset: 0x4C + bit_size: 16 fieldset/CTLR2: description: control register 2. fields: @@ -433,3 +462,13 @@ enum/SAMPLE_TIME: - name: Cycles239_5 description: 239.5 cycles value: 7 +enum/TKITUNE: + bit_size: 1 + description: Touch key current tune + variants: + - name: Full + description: 35uA + value: 0 + - name: Half + description: Decrease to half + value: 1 diff --git a/data/registers/adc_x0.yaml b/data/registers/adc_x0.yaml index dab6b0a..b85791b 100644 --- a/data/registers/adc_x0.yaml +++ b/data/registers/adc_x0.yaml @@ -1,4 +1,3 @@ -# NOTE: This is not generated due to original SVD mixes ADC and TKEY registers block/ADC: description: Analog to digital converter. items: @@ -69,6 +68,26 @@ block/ADC: description: ADC control register 3. byte_offset: 80 fieldset: CTLR3 +block/TKEY: + extends: ADC + description: Touch key + items: + # CHARGE1 mapped to SAMPTR1 + # CHARGE2 mapped to SAMPTR2 + # DR mapped to RDATAR + - name: CHGOFFSET + description: Charge time offset register (map of ADC_IDATAR1) + byte_offset: 0x3C + # change to u8 + bit_size: 8 + - name: ACT_DCG + description: Activate and discharge time register (map of ADC_RDATAR) + byte_offset: 0x4C + bit_size: 8 + - name: DR + description: Data register + byte_offset: 0x4C + bit_size: 16 fieldset/CTLR1: description: control register 1. fields: @@ -120,6 +139,10 @@ fieldset/CTLR1: description: Analog watchdog enable on regular channels. bit_offset: 23 bit_size: 1 + - name: TKENABLE + description: Touch key module enable + bit_offset: 24 + bit_size: 1 fieldset/CTLR2: description: control register 2. fields: