Files
@ d651f75c8fbc
Branch filter:
Location: HydroBot/protomodule-firmware/Src/main.c - annotation
d651f75c8fbc
2.0 KiB
text/plain
Added ability to read ph meter from analog input
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 d651f75c8fbc 3970a40efdc5 3970a40efdc5 3970a40efdc5 3970a40efdc5 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 a6cb9f350919 d651f75c8fbc d651f75c8fbc a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 3970a40efdc5 3970a40efdc5 a6cb9f350919 3970a40efdc5 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 3970a40efdc5 3970a40efdc5 a6cb9f350919 3970a40efdc5 a6cb9f350919 a6cb9f350919 3970a40efdc5 a6cb9f350919 3970a40efdc5 3970a40efdc5 a6cb9f350919 3970a40efdc5 a6cb9f350919 3970a40efdc5 a6cb9f350919 3970a40efdc5 | #include "stm32f0xx_hal.h"
#include "can.h"
#include "gpio.h"
#include "system.h"
#include "led.h"
#include "protocol.h"
#include "ph.h"
int main(void)
{
HAL_Init();
system_init();
gpio_init();
protocol_init(PROTOMODULE);
led_init();
led_blink(LED_STATUS, 2000);
led_blink_once(LED_CAN, 2000);
led_set(LED_ERROR, 0);
uint32_t loop_timer_1ms = 0;
uint32_t loop_timer_10ms = 0;
uint32_t loop_timer_200ms = 0;
uint32_t loop_timer_1s = 0;
uint32_t loop_timer_2s = 0;
uint32_t loop_timer_data = 0;
while (1)
{
can_receive();
if (HAL_GetTick() - loop_timer_1ms >= 1)
{
can_process_receive_buffer();
led_update_all();
loop_timer_1ms = HAL_GetTick();
}
if (HAL_GetTick() - loop_timer_10ms >= 10)
{
loop_timer_10ms = HAL_GetTick();
}
if (HAL_GetTick() - loop_timer_200ms >= 200)
{
loop_timer_200ms = HAL_GetTick();
}
if (HAL_GetTick() - loop_timer_1s >= 1000)
{
loop_timer_1s = HAL_GetTick();
}
if (HAL_GetTick() - loop_timer_2s >= 2000)
{
loop_timer_2s = HAL_GetTick();
}
if (HAL_GetTick() - loop_timer_data >= (protocol_get_settings()->val.data_rate))
{
protocol_send_data(NONE, 0, get_ph());
loop_timer_data = HAL_GetTick();
}
}
}
bool protocol_set_output(protocol_message_t* message)
{
bool result = false;
return result;
}
bool protocol_get_data(protocol_message_t* message)
{
bool result = false;
return result;
}
bool protocol_config(protocol_message_t* message)
{
bool result = false;
protocol_data_key_t data = (protocol_data_key_t)(uint16_t)message->data.float_data;
return result;
}
bool protocol_calibrate(protocol_message_t* message)
{
bool result = false;
return result;
}
|