More comments to LM35 part in cli.c and general comments to uart.c
This commit is contained in:
parent
6310b91164
commit
da447a2efa
@ -353,13 +353,14 @@ static void cmd_adc(const char* _data){
|
|||||||
if(Timer_getTick() - g_startMS >= loopInterval){
|
if(Timer_getTick() - g_startMS >= loopInterval){
|
||||||
g_startMS=Timer_getTick();
|
g_startMS=Timer_getTick();
|
||||||
|
|
||||||
// Print Potentiometer info
|
/* Print Potentiometer info */
|
||||||
sprintf(potiData, "Poti: %d", adc_get_poti());
|
sprintf(potiData, "Poti: %d", adc_get_poti());
|
||||||
//sprintf(potiData, "Poti: %f", (adc_get_poti() / 1023.0)); // uses floats - disabled for performance reasons.
|
//sprintf(potiData, "Poti: %f", (adc_get_poti() / 1023.0)); // uses floats - disabled for performance reasons.
|
||||||
print_string(potiData);
|
print_string(potiData);
|
||||||
print_string(NEXT_LINE);
|
print_string(NEXT_LINE);
|
||||||
|
|
||||||
// Print LM35 temperature
|
/* Print LM35 temperature */
|
||||||
|
/* calculate the temperature from the ADC reading */
|
||||||
lm35 = (int)(adc_get_LM35() * 5000.0 / 1024 / 10);
|
lm35 = (int)(adc_get_LM35() * 5000.0 / 1024 / 10);
|
||||||
sprintf(lm35Data, "LM35: %d\xC2\xB0 C", lm35);
|
sprintf(lm35Data, "LM35: %d\xC2\xB0 C", lm35);
|
||||||
//sprintf(lm35Data, "LM35: %f\xC2\xB0 C", (adc_get_LM35() * (5000 / 1024.0) / 10)); // uses floats - disabled for performance reasons.
|
//sprintf(lm35Data, "LM35: %f\xC2\xB0 C", (adc_get_LM35() * (5000 / 1024.0) / 10)); // uses floats - disabled for performance reasons.
|
||||||
|
@ -30,7 +30,7 @@ uart_init(void) {
|
|||||||
(1<<RXCIE0); /* enable Receive interrupts */
|
(1<<RXCIE0); /* enable Receive interrupts */
|
||||||
|
|
||||||
|
|
||||||
/* Initiate read- and write-pointers */
|
/* Initiate read- and write-pointers with 0 */
|
||||||
pTxBuffer->Readpointer = 0;
|
pTxBuffer->Readpointer = 0;
|
||||||
pTxBuffer->Writepointer = 0;
|
pTxBuffer->Writepointer = 0;
|
||||||
pRxBuffer->Readpointer = 0;
|
pRxBuffer->Readpointer = 0;
|
||||||
@ -71,7 +71,7 @@ uart_send_byte(char c) {
|
|||||||
UCSR0B |= (1<<TXCIE0);
|
UCSR0B |= (1<<TXCIE0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* when data (a data frame) is to be send */
|
/* when data (a data frame) is to be send (written to UDR0) */
|
||||||
ISR(USART0_TX_vect) {
|
ISR(USART0_TX_vect) {
|
||||||
/* check if the read and write pointer of the send buffer are not aligned
|
/* check if the read and write pointer of the send buffer are not aligned
|
||||||
if not aligned -> read the next byte and write it to UDR0 register
|
if not aligned -> read the next byte and write it to UDR0 register
|
||||||
|
Loading…
Reference in New Issue
Block a user