1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
20003: coap: create typedef for CoAP methods r=benpicco a=benpicco



20028: nanocoap: fix incorrect uses of coap_get_code() r=benpicco a=benpicco



20036: boards/nucleo-l4r5zi : add PWM configuration r=benpicco a=krzysztof-cabaj

### Contribution description

This PR adds to the Nucleo-l4r5zi PWM configuration

### Testing procedure

Flash the board using `tests/periph/pwm` program. Check if you could, for example, change LED 
intensity using PWM. 

### Issues/PRs references

None.

20041: pkg/littlefs2: bump to v2.8.1 r=benpicco a=bergzand

### Contribution description

Minor version number bump.

### Testing procedure

- Check if I copied the correct commit hash.
- Run the tests.


### Issues/PRs references

None

Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: krzysztof-cabaj <kcabaj@gmail.com>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
This commit is contained in:
bors[bot] 2023-11-02 11:01:23 +00:00 committed by GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 70 additions and 18 deletions

View File

@ -18,6 +18,7 @@ config BOARD_NUCLEO_L4R5ZI
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_LPUART
select HAS_PERIPH_PWM
select HAS_PERIPH_RTC
select HAS_PERIPH_RTT
select HAS_PERIPH_SPI

View File

@ -5,6 +5,7 @@ CPU_MODEL = stm32l4r5zi
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_lpuart
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi

View File

@ -167,6 +167,50 @@ static const adc_conf_t adc_config[] = {
/** @} */
/**
* @name PWM configuration
*
* To find appriopate device and channel find in the MCU datasheet table
* concerning "Alternate function AF0 to AF7" a text similar to TIM[X]_CH[Y
],
* where:
* TIM[X] - is device,
* [Y] - describes used channel (indexed from 0), for example TIM2_CH1 is
* channel 0 in configuration structure (cc_chan - field),
* Port column in the table describes connected port.
*
* For Nucleo-L4R5ZI this information is in the datasheet, Table 16, page
* 117.
*
* @{
*/
static const pwm_conf_t pwm_config[] = {
{
.dev = TIM2,
.rcc_mask = RCC_APB1ENR1_TIM2EN,
.chan = { { .pin = GPIO_PIN(PORT_A, 0) /* CN10 D32 */, .cc_chan = 0},
{ .pin = GPIO_PIN(PORT_A, 1) /* CN10 A8 */, .cc_chan = 1},
{ .pin = GPIO_PIN(PORT_A, 2) /* CN10 D26 */, .cc_chan = 2},
{ .pin = GPIO_PIN(PORT_A, 3) /* CN9 A0 */, .cc_chan = 3} },
.af = GPIO_AF1,
.bus = APB1
},
{
.dev = TIM3,
.rcc_mask = RCC_APB1ENR1_TIM3EN,
.chan = { { .pin = GPIO_PIN(PORT_B, 4) /* CN7 D25 */, .cc_chan = 0},
{ .pin = GPIO_PIN(PORT_E, 4) /* CN9 D57 */, .cc_chan = 1},
{ .pin = GPIO_PIN(PORT_B, 0) /* CN10 D33 */, .cc_chan = 2},
{ .pin = GPIO_PIN(PORT_B, 1) /* CN10 A6 */, .cc_chan = 3} },
.af = GPIO_AF2,
.bus = APB1
},
};
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
/** @} */
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +1,7 @@
PKG_NAME=littlefs2
PKG_URL=https://github.com/littlefs-project/littlefs.git
# v2.8
PKG_VERSION=f77214d1f0a8ccd7ddc7e1204fedd25ee5a41534
# v2.8.1
PKG_VERSION=c733d9ec5776dfc949ec6dc71fa9ce3ff71de6e5
PKG_LICENSE=Apache-2.0
include $(RIOTBASE)/pkg/pkg.mk

View File

@ -163,14 +163,20 @@ extern "C" {
* @name CoAP method codes used in header
* @{
*/
#define COAP_CLASS_REQ (0)
#define COAP_METHOD_GET (1)
#define COAP_METHOD_POST (2)
#define COAP_METHOD_PUT (3)
#define COAP_METHOD_DELETE (4)
#define COAP_METHOD_FETCH (5)
#define COAP_METHOD_PATCH (6)
#define COAP_METHOD_IPATCH (7)
#define COAP_CLASS_REQ (0) /**< Code Class for Request */
/**
* @brief CoAP method codes used in request
*/
typedef enum {
COAP_METHOD_GET = 1, /**< GET request (no paylod) */
COAP_METHOD_POST = 2, /**< POST request (resource processes payload) */
COAP_METHOD_PUT = 3, /**< PUT request (update resource with payload) */
COAP_METHOD_DELETE = 4, /**< DELETE request (no payload, remove resource)*/
COAP_METHOD_FETCH = 5, /**< FETCH request (RFC 8132) */
COAP_METHOD_PATCH = 6, /**< PATCH request (RFC 8132) */
COAP_METHOD_IPATCH = 7, /**< iPATCH request (RFC 8132) */
} coap_method_t;
/** @} */
/**

View File

@ -205,7 +205,7 @@ typedef struct {
nanocoap_sock_t *sock; /**< socket used for the request */
const char *path; /**< path on the server */
uint32_t blknum; /**< current block number */
uint8_t method; /**< request method (GET, POST, PUT) */
coap_method_t method; /**< request method (GET, POST, PUT) */
uint8_t blksize; /**< CoAP blocksize exponent */
} coap_block_request_t;
@ -580,7 +580,7 @@ ssize_t nanocoap_request(coap_pkt_t *pkt, const sock_udp_ep_t *local,
static inline int nanocoap_block_request_connect_url(coap_block_request_t *ctx,
nanocoap_sock_t *sock,
const char *url,
uint8_t method,
coap_method_t method,
coap_blksize_t blksize)
{
ctx->sock = sock;

View File

@ -415,7 +415,7 @@ static ssize_t _delete_file(coap_pkt_t *pdu, uint8_t *buf, size_t len,
static ssize_t gcoap_fileserver_file_handler(coap_pkt_t *pdu, uint8_t *buf, size_t len,
struct requestdata *request)
{
switch (coap_get_code(pdu)) {
switch (coap_get_code_raw(pdu)) {
case COAP_METHOD_GET:
return _get_file(pdu, buf, len, request);
#if IS_USED(MODULE_GCOAP_FILESERVER_PUT)
@ -549,7 +549,7 @@ static ssize_t gcoap_fileserver_directory_handler(coap_pkt_t *pdu, uint8_t *buf,
struct requestdata *request,
const char *root, const char* resource_dir)
{
switch (coap_get_code(pdu)) {
switch (coap_get_code_raw(pdu)) {
case COAP_METHOD_GET:
return _get_directory(pdu, buf, len, request, root, resource_dir);
#if IS_USED(MODULE_GCOAP_FILESERVER_PUT)

View File

@ -1180,7 +1180,7 @@ static void _cache_process(gcoap_request_memo_t *memo,
#if IS_USED(MODULE_NANOCOAP_CACHE)
nanocoap_cache_entry_t *ce;
/* cache_key in memo is pre-processor guarded so we need to as well */
if ((ce = nanocoap_cache_process(memo->cache_key, coap_get_code(&req), pdu, pdu_len))) {
if ((ce = nanocoap_cache_process(memo->cache_key, coap_get_code_raw(&req), pdu, pdu_len))) {
ce->truncated = (memo->state == GCOAP_MEMO_RESP_TRUNC);
}
#else
@ -1288,7 +1288,7 @@ static bool _cache_lookup(gcoap_request_memo_t *memo,
_update_memo_cache_key(memo, cache_key);
/* cache hit, methods are equal, and cache entry is not stale */
if (*ce &&
((*ce)->request_method == coap_get_code(pdu)) &&
((*ce)->request_method == coap_get_code_raw(pdu)) &&
!nanocoap_cache_entry_is_stale(*ce, now)) {
return true;
}

View File

@ -305,7 +305,7 @@ nanocoap_cache_entry_t *nanocoap_cache_add_by_req(const coap_pkt_t *req,
nanocoap_cache_key_generate(req, cache_key);
return nanocoap_cache_add_by_key(cache_key,
coap_get_code((coap_pkt_t *)req),
coap_get_code_raw((coap_pkt_t *)req),
resp,
resp_len);
}

View File

@ -294,7 +294,7 @@ ssize_t nanocoap_sock_request_cb(nanocoap_sock_t *sock, coap_pkt_t *pkt,
_send_ack(sock, pkt);
/* fall-through */
case COAP_TYPE_ACK:
if (cb && coap_get_code(pkt) == COAP_CODE_EMPTY) {
if (cb && coap_get_code_raw(pkt) == COAP_CODE_EMPTY) {
/* empty ACK, wait for separate response */
state = STATE_RESPONSE_RCVD;
deadline = _deadline_from_interval(CONFIG_COAP_SEPARATE_RESPONSE_TIMEOUT_MS