Skip to content

Update the AMDC article Tutorial: Timing & Sensors to clarify the location of extern unit8_t declaration #145

@noguchi-takahiro

Description

@noguchi-takahiro

Context

Related Issues / PRs:

While @hess0297 was doing the AMDC tutorial : Create a GitHub PR that implements tutorial 6 (Timing & Sensors), we encountered the build error (type not found error) in the SDK when declaring:

extern uint8_t sensor_flag;

only if we define this on the "top" of the task_controller.h file as instructed. After some investigation, it looks like we need to define extern uint8_t sensor_flag; after #include "sys/scheduler.h in the task_controller.h, i.e., the following code works:

#ifndef TASK_CONTROLLER_H
#define TASK_CONTROLLER_H

#include "sys/scheduler.h"
#include "drv/analog.h"

extern uint8_t sensor_flag;

but the following does not work:

extern uint8_t sensor_flag;

#ifndef TASK_CONTROLLER_H
#define TASK_CONTROLLER_H

#include "sys/scheduler.h"
#include "drv/analog.h"

Looks like the extern uint8_t sensor_flag; requires to include <stdint.h>, which is actually defined in

https://github.com/Severson-Group/AMDC-Firmware/blob/6eea3d6e4e5d0a44852ddd3233975ac0039c65a8/sdk/app_cpu1/common/sys/scheduler.h#L5

and therefore, extern uint8_t sensor_flag; needed to be located after the #include "sys/scheduler.h".

Approach

Update Tutorial: Timing & Sensors article to clearly specify the location that users should put, especially this section:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions