From cd259c6eb3344eb96bdbd86c6ed8f6f91363f65d Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sat, 12 Nov 2011 15:03:02 +0100 Subject: other/adc_temperature_sensor: Cosmetics. --- examples/stm32/f1/other/adc_temperature_sensor/README | 2 +- examples/stm32/f1/other/adc_temperature_sensor/adc.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/stm32/f1') diff --git a/examples/stm32/f1/other/adc_temperature_sensor/README b/examples/stm32/f1/other/adc_temperature_sensor/README index aa00ef0..e17f8f8 100644 --- a/examples/stm32/f1/other/adc_temperature_sensor/README +++ b/examples/stm32/f1/other/adc_temperature_sensor/README @@ -3,7 +3,7 @@ README ------------------------------------------------------------------------------ This example program sends some characters on USART1. -Afterwards it read out the internal temperature sensor of the STM32 and +Afterwards it read out the internal temperature sensor of the STM32 and sends the value read out from the ADC to the USART1. The terminal settings for the receiving device/PC are 115200 8n1. diff --git a/examples/stm32/f1/other/adc_temperature_sensor/adc.c b/examples/stm32/f1/other/adc_temperature_sensor/adc.c index a87909c..4180e4e 100644 --- a/examples/stm32/f1/other/adc_temperature_sensor/adc.c +++ b/examples/stm32/f1/other/adc_temperature_sensor/adc.c @@ -63,7 +63,7 @@ void adc_setup(void) rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN); - /* Make shure it doesn't run during config. */ + /* Make sure the ADC doesn't run during config. */ adc_off(ADC1); /* We configure everything for one single conversion. */ @@ -96,12 +96,12 @@ void my_usart_print_int(u32 usart, int value) usart_send(usart, '-'); value = value * -1; } - + while (value > 0) { buffer[nr_digits++] = "0123456789"[value % 10]; value /= 10; } - + for (i = nr_digits; i >= 0; i--) usart_send(usart, buffer[i]); } @@ -129,16 +129,16 @@ int main(void) /* Select the channel we want to convert. 16=temperature_sensor. */ channel_array[0] = 16; adc_set_regular_sequence(ADC1, 1, channel_array); - + /* * If the ADC_CR2_ON bit is already set -> setting it another time * starts the conversion. */ adc_on(ADC1); - + /* Wait for end of conversion. */ while (!(ADC_SR(ADC1) & ADC_SR_EOC)); - + temperature = ADC_DR(ADC1); /* -- cgit v1.2.3