Adam Mitchell

0

votes
0

answer
2

views

STM32L0 Freeze on setting NVIC/GPIO

I'm working with an STM32L073RZ CPU running MbedOS 5.11.2. Eventually I aim to get this working in a very low-power mode (STOP mode) that will be awoken with either an RTC interrupt or an interrupt from a peripheral device on pin PA_0 (WAKEUP_PIN_1). At the moment I am simply attempting to setup PA_...
Adam Mitchell
1

votes
3

answer
61

views

Using value of enum within struct

I have the following class: class MyClass { public: enum myEnum { a = 0b0, b = 0b1, }; union myUnion { uint32_t all; struct myStruct { uint32_t start : 0b1; uint32_t enumValue : myEnum::a; } bits; }; ... }; I am simply unsure how to use the value of myEnum::a within the struct. I've tried a nu...
Adam Mitchell
1

votes
1

answer
75

views

Why does my switch/case default when using enums?

I have the following switch/case statement in Arduino 1.8.7 where the variable led is an integer: switch (led) { case ALL: { /* do stuff */ break; } case LED1: { /* do stuff */ break; } case LED2: { /* do stuff */ break; } case LED3: { /* do stuff */ break; } case LED4: { /* do stuff */ break; } de...
Adam Mitchell
1

votes
1

answer
24

views

Arduino seems to crash when uint32_t > 45

I have the below program running on an Uno clone. uint32_t counter = 0; void setup() { Serial.begin(9600); while(!Serial); } void loop() { char *result = malloc(32); sprintf(result, '%024u', counter); Serial.print('{\'n\': '); Serial.print(result); Serial.println(' }'); delay(100); counter++; } Eve...
Adam Mitchell
5

votes
3

answer
167

views

Import binary package from different directory

I have the following directory structure: root /src file1.py file2.py /libs __init__.py package.so I wish to import package.so within file1.py. I've tried the following import statements to no avail: from .libs.package import func from libs.package import func from .libs import package from libs imp...
Adam Mitchell
2

votes
1

answer
810

views

javascript timestamp insert into string Variable

First off, I have no programming experience, just enough to get me in trouble. I was wondering if someone could write a line of code to add a numeric timestamp to an existing string varible on an HTML page. the variable needs to create a semi random identifier by combining a static text element (S...
Adam Mitchell
2

votes
1

answer
115

views

How to access a variable of a class created within another class, from outside either class

I have a class whose attributes I need to access. The problem comes with the fact that the instance of this class is instantiated within another class. Here is the class whose variable I wish to access (there is more to it, but this shows you how the class is created): class Button(QtGui.QPushButto...
Adam Mitchell
3

votes
1

answer
34

views

hexString.toInt(32) NumberFormatException

I have a 32-bit hex value that I wish to convert to an integer. The following methods both provide the following error given the hex string C71C5E00: java.lang.NumberFormatException: For input string: 'C71C5E00' 'C71C5E00'.toInt(32) Integer.valueOf('C71C5E00', 32) The Kotlin docs state that an Int...
Adam Mitchell
1

votes
2

answer
842

views

Comparing MFCC feature vectors with DTW

I'm looking for some advice on Dynamic Time Warping (DTW). I have a Python script and extract Mel-Frequency Cepstral Coefficient (MFCC) feature vectors from .WAV files of various lengths. The feature vectors are arrays of varying lengths that contain arrays of 12 MFCCs. For example, one .WAV file...
Adam Mitchell
1

votes
2

answer
63

views

New object from data class .copy()

I have a data class in Kotlin: data class myDataClass( var a: ArrayList = ArrayList(), var b: ArrayList = ArrayList(), var c: ArrayList = ArrayList(), ... ) private val myDataClassVal: myDataClass = myDataClass() I use this data class to store data acquired over BLE that will, when each ArrayList i...
Adam Mitchell
2

votes
2

answer
58

views

Make function block in Kotlin

I appreciate that this may have already been answered but I'm unable to find a solution that works for me. Tl;dr: How do make a function block? I have the following BLE-related code written in Kotlin for Android API 28. override fun onServicesDiscovered(gatt: BluetoothGatt?, status: Int) { for (ga...
Adam Mitchell
2

votes
1

answer
83

views

Android BLE onConnectionUpdated()

I'm currently trying to determine the current BLE connection interval within an Android app targeting API 27. All documentation that I've found (including many SO questions) has said that this is currently impossible, however, when running my application in debug mode, the following console message...
Adam Mitchell
4

votes
1

answer
118

views

Cannot override Java function in Kotlin

I am currently developing a BLE-enabled Android app targeting API 27 using Kotlin. I am attempting to override a function within android.bluetooth.BluetoothGatt. There are a number of callbacks available to be overridden to enable the handling of certain BLE events. For example, I override onConnec...
Adam Mitchell
2

votes
3

answer
46

views

uint8_t different decimal values for same binary

I have the following issue using an ARM® Cortex™-M4F CPU running mbedOS 5.9. Say I have the binary value 10101000 and that I also have the following union/struct: union InputWord_u { uint8_t all; struct BitField_s { uint8_t start : 1; // D7 uint8_t select : 3; // D6, D5, D4 uint8_t payload : 4...
Adam Mitchell
2

votes
1

answer
42

views

Properly format SQL query when insert into variable number of columns

I'm using psycopg2 to interact with a PostgreSQL database. I have a function whereby any number of columns (from a single column to all columns) in a table could be inserted into. My question is: how would one properly, dynamically, construct this query? At the moment I am using string formatting an...
Adam Mitchell
27

votes
1

answer
1.7k

views

Select2 filter values disappear when search returns no results

I am using a serverside implementation of DataTables with yadcf and select2 for added functionality. The data used to populate the table is acquired via an Ajax request to a Django view, as is the data for the select2 autocomplete functionality; but from a separate Django view. My issue is as follow...
Adam Mitchell
1

votes
0

answer
19

views

Python3.6 function not called

I'm developing a REST API in Python 3.6 using Flask-Rebar and PostgreSQL and am having trouble trying to execute some queries simultaneously using psycopg2. More specifically, I execute a query and require the id value from this query for use in the next query. The first query successfully returns t...
Adam Mitchell