Skip to content

Commit

Permalink
Fix build for zig cc
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Jun 3, 2022
1 parent dc7892d commit 8da7e4d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 0 additions & 1 deletion include/sx126x.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ extern "C"

#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include "radio.h"

// GPIO and SPI definitions for BL602
Expand Down
6 changes: 5 additions & 1 deletion src/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
*
* \author Gregory Cristian ( Semtech )
*/
#include <math.h>
#if defined(__NuttX__) && defined(__clang__) // Workaround for NuttX with zig cc
#include <arch/types.h>
#include "../../nuttx/include/limits.h"
#endif // defined(__NuttX__) && defined(__clang__)

#include <string.h>
#include <assert.h>
#include <stdio.h>
Expand Down
13 changes: 13 additions & 0 deletions src/sx126x-nuttx.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// LoRa SX1262 Board Functions for NuttX
#ifdef __NuttX__ // This file is for NuttX only

#if defined(__NuttX__) && defined(__clang__) // Workaround for NuttX with zig cc
#include <arch/types.h>
#include "../../nuttx/include/limits.h"
#endif // defined(__NuttX__) && defined(__clang__)

#include <debug.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -112,6 +118,13 @@ static int init_spi(void);
/// which initialises the GPIO Pins and SPI Port at startup.
void SX126xIoInit( void )
{
#ifdef __clang__
#warning Compiled with zig cc
puts("SX126xIoInit: Compiled with zig cc");
#else
#warning Compiled with gcc
puts("SX126xIoInit: Compiled with gcc");
#endif // __clang__
_info("SX126xIoInit\n");

// Init the Event Queue if not initialised.
Expand Down
5 changes: 5 additions & 0 deletions src/sx126x.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
*
* \author Gregory Cristian ( Semtech )
*/
#if defined(__NuttX__) && defined(__clang__) // Workaround for NuttX with zig cc
#include <arch/types.h>
#include "../../nuttx/include/limits.h"
#endif // defined(__NuttX__) && defined(__clang__)

#include <stdio.h>
#include <string.h>
#include "../include/sx126x-utilities.h"
Expand Down

0 comments on commit 8da7e4d

Please sign in to comment.