Commit 2224b21c authored by kamako's avatar kamako
Browse files

Readded temperature transmission

parent 3186b3a7
......@@ -5,7 +5,7 @@
#include "drivers/mss_timer/mss_timer.h"
const int timerPeriod=1000000*1000/2;
uint tempC=0;
void Timer1_IRQHandler( void ){
move_forward(100);
*((uint32_t*) 0x40050014) = 0xffff9a65;
......@@ -24,7 +24,22 @@ void Timer1_IRQHandler( void ){
MSS_TIM1_clear_irq();
}
void Timer2_IRQHandler( void ){
double percent = (double)Steps_taken/Required_steps;
percent *= 100;
uint8_t tx_buf[2];
sprintf(tx_buf, "%i", (uint8_t)percent);
tx_buf[1]=tempC;
MSS_UART_polled_tx( &g_mss_uart1, tx_buf, sizeof(tx_buf) );
MSS_TIM2_clear_irq();
}
void reportTemp() {
MSS_TIM2_init(MSS_TIMER_PERIODIC_MODE);
MSS_TIM2_load_immediate(100000000);
MSS_TIM2_start();
MSS_TIM2_enable_irq();
}
void move() {
MSS_TIM1_init(MSS_TIMER_PERIODIC_MODE);
MSS_TIM1_load_immediate(timerPeriod);
......@@ -53,8 +68,10 @@ int voltageToReading(double voltage){
int main()
{
waitT();
MSS_UART_init(&g_mss_uart0, MSS_UART_9600_BAUD,
MSS_UART_init(&g_mss_uart1, MSS_UART_115200_BAUD,
MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT);
reportTemp();
waitT();
NVIC_EnableIRQ(GPIO0_IRQn);
MSS_GPIO_config( MSS_GPIO_0, MSS_GPIO_INPUT_MODE | MSS_GPIO_IRQ_EDGE_POSITIVE );
MSS_GPIO_enable_irq( MSS_GPIO_0 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment