Skip to content

Commit 45c6cdf

Browse files
author
smtc-bot
committed
Release v1.0.0
0 parents  commit 45c6cdf

File tree

371 files changed

+732335
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

371 files changed

+732335
-0
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# LR1121 modem-e examples changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [v1.0.0] - 2024-09-19
8+
9+
First release

Drivers/BSP/Components/Leds/leds.c

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
/**
2+
* @file leds.c
3+
*
4+
* @brief Leds driver implementation.
5+
*
6+
* Revised BSD License
7+
* Copyright Semtech Corporation 2020. All rights reserved.
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
* * Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
* * Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
* * Neither the name of the Semtech corporation nor the
17+
* names of its contributors may be used to endorse or promote products
18+
* derived from this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
* ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY
24+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
/*
33+
* -----------------------------------------------------------------------------
34+
* --- DEPENDENCIES ------------------------------------------------------------
35+
*/
36+
37+
#include "smtc_hal.h"
38+
#include "leds.h"
39+
40+
/*
41+
* -----------------------------------------------------------------------------
42+
* --- PRIVATE MACROS-----------------------------------------------------------
43+
*/
44+
45+
/*
46+
* -----------------------------------------------------------------------------
47+
* --- PRIVATE CONSTANTS -------------------------------------------------------
48+
*/
49+
50+
/*
51+
* -----------------------------------------------------------------------------
52+
* --- PRIVATE TYPES -----------------------------------------------------------
53+
*/
54+
55+
/*
56+
* -----------------------------------------------------------------------------
57+
* --- PRIVATE VARIABLES -------------------------------------------------------
58+
*/
59+
60+
/*
61+
* -----------------------------------------------------------------------------
62+
* --- PRIVATE FUNCTIONS DECLARATION -------------------------------------------
63+
*/
64+
65+
/*
66+
* -----------------------------------------------------------------------------
67+
* --- PUBLIC FUNCTIONS DEFINITION ---------------------------------------------
68+
*/
69+
70+
void leds_init( void )
71+
{
72+
hal_gpio_init_out( LED_TX, 0 );
73+
hal_gpio_init_out( LED_RX, 0 );
74+
hal_gpio_init_out( LED_SCAN, 0 );
75+
}
76+
77+
void leds_deinit( void )
78+
{
79+
hal_gpio_deinit( LED_TX );
80+
hal_gpio_deinit( LED_RX );
81+
hal_gpio_deinit( LED_SCAN );
82+
}
83+
84+
void leds_on( uint8_t leds )
85+
{
86+
if( leds & LED_TX_MASK )
87+
{
88+
/* LED TX */
89+
hal_gpio_set_value( LED_TX, GPIO_PIN_SET );
90+
}
91+
if( leds & LED_RX_MASK )
92+
{
93+
/* LED RX */
94+
hal_gpio_set_value( LED_RX, GPIO_PIN_SET );
95+
}
96+
if( leds & LED_SCAN_MASK )
97+
{
98+
/* LED SCAN */
99+
hal_gpio_set_value( LED_SCAN, GPIO_PIN_SET );
100+
}
101+
}
102+
103+
void leds_off( uint8_t leds )
104+
{
105+
if( leds & LED_TX_MASK )
106+
{
107+
/* LED TX */
108+
hal_gpio_set_value( LED_TX, GPIO_PIN_RESET );
109+
}
110+
if( leds & LED_RX_MASK )
111+
{
112+
/* LED RX */
113+
hal_gpio_set_value( LED_RX, GPIO_PIN_RESET );
114+
}
115+
if( leds & LED_SCAN_MASK )
116+
{
117+
/* LED SCAN */
118+
hal_gpio_set_value( LED_SCAN, GPIO_PIN_RESET );
119+
}
120+
}
121+
122+
void leds_toggle( uint8_t leds )
123+
{
124+
if( leds & LED_TX_MASK )
125+
{
126+
/* LED TX */
127+
hal_gpio_toggle( LED_TX );
128+
}
129+
if( leds & LED_RX_MASK )
130+
{
131+
/* LED RX */
132+
hal_gpio_toggle( LED_RX );
133+
}
134+
if( leds & LED_SCAN_MASK )
135+
{
136+
/* LED SCAN */
137+
hal_gpio_toggle( LED_SCAN );
138+
}
139+
}
140+
141+
void leds_blink( uint8_t leds, uint32_t delay, uint8_t nb_blink, bool reset_leds )
142+
{
143+
uint8_t i = 0;
144+
145+
if( reset_leds == true )
146+
{
147+
leds_off( LED_ALL_MASK );
148+
}
149+
150+
while( i < nb_blink )
151+
{
152+
i++;
153+
leds_on( leds );
154+
HAL_Delay( delay / 2 );
155+
leds_off( leds );
156+
HAL_Delay( delay / 2 );
157+
}
158+
}
159+
160+
/*
161+
* -----------------------------------------------------------------------------
162+
* --- PRIVATE FUNCTIONS DEFINITION --------------------------------------------
163+
*/
164+
165+
/* --- EOF ------------------------------------------------------------------ */

Drivers/BSP/Components/Leds/leds.h

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/**
2+
* @file leds.h
3+
*
4+
* @brief Leds driver definition.
5+
*
6+
* Revised BSD License
7+
* Copyright Semtech Corporation 2020. All rights reserved.
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
* * Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
* * Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
* * Neither the name of the Semtech corporation nor the
17+
* names of its contributors may be used to endorse or promote products
18+
* derived from this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
* ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY
24+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
#ifndef LEDS_H
33+
#define LEDS_H
34+
35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
39+
/*
40+
* -----------------------------------------------------------------------------
41+
* --- DEPENDENCIES ------------------------------------------------------------
42+
*/
43+
44+
#include <stdint.h>
45+
#include <stdbool.h>
46+
47+
/*
48+
* -----------------------------------------------------------------------------
49+
* --- PUBLIC MACROS -----------------------------------------------------------
50+
*/
51+
52+
/*
53+
* -----------------------------------------------------------------------------
54+
* --- PUBLIC CONSTANTS --------------------------------------------------------
55+
*/
56+
57+
typedef enum
58+
{
59+
LR1121_EVK_LED_TX,
60+
LR1121_EVK_LED_RX,
61+
LR1121_EVK_LED_SCAN,
62+
LR1121_EVK_LED_COUNT
63+
} lr1121_evk_led_t;
64+
65+
/**
66+
* @brief LED TX MASK
67+
*/
68+
#define LED_TX_MASK ( 1 << LR1121_EVK_LED_TX )
69+
70+
/**
71+
* @brief LED RX MASK
72+
*/
73+
#define LED_RX_MASK ( 1 << LR1121_EVK_LED_RX )
74+
75+
/**
76+
* @brief LED SCAN MASK
77+
*/
78+
#define LED_SCAN_MASK ( 1 << LR1121_EVK_LED_SCAN )
79+
80+
/**
81+
* @brief LED ALL MASK
82+
*/
83+
#define LED_ALL_MASK ( LED_TX_MASK | LED_RX_MASK | LED_SCAN_MASK )
84+
85+
/*
86+
* -----------------------------------------------------------------------------
87+
* --- PUBLIC TYPES ------------------------------------------------------------
88+
*/
89+
90+
/*
91+
* -----------------------------------------------------------------------------
92+
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
93+
*/
94+
95+
/**
96+
* @brief Init Leds
97+
*/
98+
void leds_init( void );
99+
100+
/**
101+
* @brief Deinit Leds
102+
*/
103+
void leds_deinit( void );
104+
/**
105+
* @brief Select and turn on Leds
106+
*
107+
* @param [in] leds Leds MASK to turn on leds
108+
*/
109+
void leds_on( uint8_t leds );
110+
111+
/**
112+
* @brief Select and turn off Leds
113+
*
114+
* @param [in] leds Leds MASK to turn off leds
115+
*/
116+
void leds_off( uint8_t leds );
117+
118+
/**
119+
* @brief Select and toggle Leds
120+
*
121+
* @param [in] leds Leds MASK to turn off leds
122+
*/
123+
void leds_toggle( uint8_t leds );
124+
125+
/**
126+
* @brief Select and toggle Leds
127+
*
128+
* @param [in] leds Leds MASK to turn off leds
129+
* @param [in] delay Blink delay
130+
* @param [in] nb_blink Number of blink
131+
* @param [in] reset_leds Reset leds at the beginning
132+
*/
133+
void leds_blink( uint8_t leds, uint32_t delay, uint8_t nb_blink, bool reset_leds );
134+
135+
#ifdef __cplusplus
136+
}
137+
#endif
138+
139+
#endif // LEDS_H

0 commit comments

Comments
 (0)