What's the equivalence of name type u1_t and u4_t

Good day all,

I configured a node witht he library LMIC. At some point I have to define my application

  static const PROGMEM u1_t NWKSKEY[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  static const u1_t PROGMEM APPSKEY[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  static const u4_t DEVADDR = 0x0000000; // <-- Change this address for every node!

Those variable are u1_t and u4_t.

But what’s u1_t and u4_t?

My nodes works well, but I would like to change a litle bit the way to read those values…
I created my own library and from that library I would like to use those value…

In my file.h,I created some struct

struct Config_radio {
    u1_t nwkskey[16];
    u1_t appskey[16];
    u4_t devaddr;
  };

But when I compile, I got this error message

error: ‘u1_t’ does not name a type
u1_t appskey[16];

Which sound normal, because my LMIC library is not imported in my library file.
I believe those type are created in the LMIC library.

Then I have two question.
How can I create a type (u1_t and u4_t) in my own library?
Or which equivalence can I use.

My goal is when my node is turn on for the first time, it creae a JSON file

{
	"nwkskey": "",
	"appskey": "",
	"devaddr": ""
}

My library is going to create that json file with the above lines. The node stop and wait for an action from the user.

The user, remove the SD card, insert the 3 values: When the node is switched on (the seond time), the node is going to read, the values from the json file, and then save it in the EEPROM: The config file is then deleted

Each time the node is switched on, the node is checking for a configuration file. If it exists, it replace the value in the EEPROM. If it does not exist, the node is going to read the EEPROM and if the node does not find a value from the EEPROM, it create and empty json file for the user.

Now my worries is how to use a variable u1_t without having the need to import the LMIC library in my own library.

I wonder if u1_t is like a int.
Can it be int?

struct Config_radio {
    int16_t nwkskey[16];
    int16_t appskey[16];
    int devaddr;
  }; 

NB: For now, I am working with ABP and I plan to switch to OTAA. But the problem is the same, I will have to read the same type of value for the Application

Thank a lot

Given the size of the elements in the array (0x00, so two digit hex number) I would think it is obvious u1_t is 0-255 so unsigned char.
And u4_t looks like it could be an unsigned 4 byte data type, which that is depends on your controller, for most controllers it will be an unsigned long.

1 Like
5 Likes