tdc218 - (I took the liberty of replacing [code] and [/code] with back quotes to preserve your code layout)
I have not checked the initialisation of Maple, but the temperature sensor must be switched on, so it may be channel 16, but it isn't switched on.
Further, the process described in RM0008 (section 11.10 "Temperature sensor") says:
Reading the temperature
To use the sensor:
1. Select the ADCx_IN16 input channel.
2. Select a sample time of 17.1 μs
3. Set the TSVREFE bit in the ADC control register 2 (ADC_CR2) to wake up the temperature sensor from power down mode.
4. Start the ADC conversion by setting the ADON bit (or by external trigger).
5. Read the resulting VSENSE data in the ADC data register
6. Obtain the temperature using the following formula:
Temperature (in °C) = {(V25 - VSENSE) / Avg_Slope} + 25.
Where,
V25 = VSENSE value for 25° C and
Avg_Slope = Average Slope for curve between Temperature vs. VSENSE (given in mV/° C or μV/ °C).
Refer to the Electrical characteristics section for the actual values of V25 and Avg_Slope.
Looking at the STM32F103xB datasheet, section 5.3.19 "Temperature sensor characteristics", the slope is positive, so the value will increase with increasing temperature, and not decrease as you have explained.
Also, the code you posted doesn't increase the sample time to 17.1us, which might also effect the results.
I think that means:
ADC1->regs->SMPR1 = (0b111 << (3*6)); // set channel 16 sample time to 239.5 cycles
239.5 cycles of the ADC clock (72MHz/6=12MHz) is over 17.1us (about 20us), but no smaller sample time exceeds 17.1us.
(The default sample time for all the ADC channels is initialised to 55.5 ADC cycles, about 4.6us, which section 11.10 says is too low)
So I think the channel number should be 16, the temperature sensor switched on, and the sample delay increased to 17.1us delay.
(full disclosure: I am not a member of LeafLabs staff.)