function declare

Jython googcheng at gmail.com
Wed Jun 26 06:41:17 UTC 2019


I have a function named  *oled_write_temp* in a.c, if i dont declare it in
a.h , then i will get the wrong supply value in the function within main
call, why?

if i  declare it in a.h, then all is right

void oled_write_temp(float set_temp, const float supply, float return_temp)
> {
>
>     int base_x = 12, base_y = 60;
>
>     char buffer[20] = {0};
>
>     *printf("supply_temp %f at %s\n", supply, __FUNCTION__);*
>
>     snprintf(buffer, 20, "SUPPLY:%.2f", supply);
>     printf("supply_temp string %s\n", buffer);
>
>     oled_clear_area(base_x, base_y + 16, 122, base_y + 32);
>     OLED_ShowString(base_x, base_y + 16, buffer, 16, 1);
>
>     memset(buffer, 0, sizeof(buffer));
>     snprintf(buffer, 20, "RETURN:%.2f", return_temp);
>     OLED_ShowString(base_x, base_y + 36, buffer, 16, 1);
>
>     memset(buffer, 0, sizeof(buffer));
>     snprintf(buffer, 20, "SET   :%.2f", set_temp);
>     OLED_ShowString(base_x, base_y + 56, buffer, 16, 1);
>
> }
>

ps: watch line  *printf("supply_temp %f at %s\n", supply, __FUNCTION__);*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20190626/fdaf46b5/attachment.html>


More information about the users mailing list