summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/math.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-18 23:28:56 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-18 23:28:56 +0100
commit38ae014e4258811d1612f9e140a35f8f9aa0ddb8 (patch)
tree2894967f48f3744515ad134f362337a3e2f64d82 /stmhal/math.c
parent71e9bfa20dd02457e73c2bec85102b6faf527a33 (diff)
downloadmicropython-38ae014e4258811d1612f9e140a35f8f9aa0ddb8.tar.gz
micropython-38ae014e4258811d1612f9e140a35f8f9aa0ddb8.zip
stmhal: Update ADC, DAC and I2C objects to use new buffer protocol.
Main reason for expanding buffer protocol API was to support writes to a buffer in ADC module (see read_timed). With this change you can now create an array of arbitrary type and ADC.read_timed will store into that array in the correct format (byte, int, float). I wonder though if all these changes were really worth it to support just this function. Hopefully this enhanced buffer protocol API (with typecode specified) will be used elsewhere.
Diffstat (limited to 'stmhal/math.c')
-rw-r--r--stmhal/math.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/stmhal/math.c b/stmhal/math.c
index 75a5aeb2ee..5fb9c4ba16 100644
--- a/stmhal/math.c
+++ b/stmhal/math.c
@@ -20,6 +20,10 @@ typedef union {
};
} double_s_t;
+double __attribute__((pcs("aapcs"))) __aeabi_i2d(int32_t x) {
+ return (float)x;
+}
+
double __attribute__((pcs("aapcs"))) __aeabi_f2d(float x) {
float_s_t fx={0};
double_s_t dx={0};