Skip to content

Commit 0cf5dc4

Browse files
committed
Correct warnings when using volatile for buffers in interrupts and add implementation of the extern SequansController variable
1 parent 177244b commit 0cf5dc4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/sequans_controller.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ static void (*ring_line_callback)(void);
123123
static bool critical_section_enabled = false;
124124

125125
// Singleton. Defined for use of rest of library
126+
SequansControllerClass SequansController = SequansControllerClass::instance();
126127

127128
/** @brief Flow control update for the UART interface with the LTE modules
128129
*
@@ -215,8 +216,8 @@ ISR(USART1_RXC_vect) {
215216
if (urc_lookup_table_length[i] ==
216217
urc_identifier_buffer_length) {
217218

218-
if (memcmp(urc_identifier_buffer,
219-
urc_lookup_table[i],
219+
if (memcmp((const void *)urc_identifier_buffer,
220+
(const void *)urc_lookup_table[i],
220221
urc_lookup_table_length[i]) == 0) {
221222

222223
urc_index = i;
@@ -254,7 +255,7 @@ ISR(USART1_RXC_vect) {
254255
rx_num_elements -= urc_data_buffer_length;
255256
}
256257

257-
urc_current_callback(urc_data_buffer);
258+
urc_current_callback((char *)urc_data_buffer);
258259
urc_current_callback = NULL;
259260
}
260261

@@ -637,7 +638,7 @@ bool SequansControllerClass::registerCallback(const char *urc_identifier,
637638
uint8_t urc_identifier_length = strlen(urc_identifier);
638639
for (uint8_t i = 0; i < MAX_URC_CALLBACKS; i++) {
639640
if (urc_lookup_table_length[i] == urc_identifier_length &&
640-
strcmp(urc_identifier, urc_lookup_table[i]) == 0) {
641+
strcmp(urc_identifier, (const char *)urc_lookup_table[i]) == 0) {
641642
urc_callbacks[i] = urc_callback;
642643
urc_lookup_table_clear_data[i] = clear_data;
643644
return true;
@@ -647,7 +648,7 @@ bool SequansControllerClass::registerCallback(const char *urc_identifier,
647648
// Look for empty spot
648649
for (uint8_t i = 0; i < MAX_URC_CALLBACKS; i++) {
649650
if (urc_lookup_table_length[i] == 0) {
650-
strcpy(urc_lookup_table[i], urc_identifier);
651+
strcpy((char *)urc_lookup_table[i], urc_identifier);
651652
urc_lookup_table_length[i] = strlen(urc_identifier);
652653
urc_callbacks[i] = urc_callback;
653654
urc_lookup_table_clear_data[i] = clear_data;
@@ -661,8 +662,8 @@ bool SequansControllerClass::registerCallback(const char *urc_identifier,
661662
void SequansControllerClass::unregisterCallback(const char *urc_identifier) {
662663
const uint8_t urc_identifier_length = strlen(urc_identifier);
663664
for (uint8_t i = 0; i < MAX_URC_CALLBACKS; i++) {
664-
if (memcmp(urc_identifier,
665-
urc_lookup_table[i],
665+
if (memcmp((const void *)urc_identifier,
666+
(const void *)urc_lookup_table[i],
666667
urc_identifier_length) == 0) {
667668
// No need to fill the look up table identifier table, as we
668669
// override it if a new registration is issued, but the length is

0 commit comments

Comments
 (0)