Code Monkey home page Code Monkey logo

codal-core's People

Contributors

c272 avatar deanm1278 avatar finneyj avatar irarykim avatar jamesadevine avatar johnn333 avatar johnvidler avatar joshuaahill avatar martinwork avatar microbit-carlos avatar mmoskal avatar nedseb avatar olihulland avatar pelikhan avatar raphaelgault avatar skx avatar tballmsft avatar xmeow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codal-core's Issues

Integer overflow with setFrequency's period

Using our playTone(frequency, ms) method, if you type in a value for the interval that is above 3000 ms, the behaviour on the physical device starts being weird.

Repro in makecode:

loops.forever(() => {
    music.playTone(262, 5000)
    music.playTone(Note.A, 1000)
})

The above code doesn't play the initial tone for 5 seconds, but for a time much shorter.
If you try to play a tone for around 3000, it will play it forever.

It seems this is because we're expecting the user to type in a value in ms, and then codal converts that to microseconds and later nano seconds, causing an integer overflow, with such low values for the time we want to play a tone.

Host switching is too slow

Assume 1 host and 1 virtual connected, everything good. Then the host goes away and a new host comes on the bus. This should kind of be immediate but it does not appear to work.

Resource manager

We need a better "dynamic" orchestration of sercoms. We had an issue of I2C clashing with neopixel SPIs.
@mmoskal

Status LED support in JACDAC

Just like the RJ45 ports, we could support an optional jacdac LED to display the status of the bus on the device.

Potentially uninitialized varible

The compiler complains:

../libraries/codal-core/source/drivers/HIDKeyboard.cpp: In member function 'int codal::USBHIDKeyboard::keyDown(uint8_t, uint8_t)':
../libraries/codal-core/source/drivers/HIDKeyboard.cpp:219:66: warning: 'newIndex' may be used uninitialized in this function [-Wmaybe-uninitialized]
                 keyStateConsumer[newIndex] = HID_KEYBOARD_KEY_OFF; //we could not make the change

Driver never disconnects

I have a log broadcast drivers. I can see all the drivers connecting successfully but they never go out of the "connected" mode after unplugging the jacks.

Python 2 vs Python 3

The joys of mixing versions of Windows. Is CODAL on python2 or 3? Is there a way to specify which version to use?

JacDacMessage enumeration types should match

When creating jacdac messages, occasionally you will have scenarios where the value of a jacdac message on one device will not have the same jacdac message value on another device. This will affect how the listener will work on either side.

For example:

Device 1 can have

enum JacDacMessage {
message1,
SHAKE1,
SHAKE2,
SHAKE3
}

and Device 2 can have

enum JacDacMessage {
SHAKE1,
}

CapTouch calibration not working for battery powered devices

Calibration of cap touch is qute tricky. Using aluminium foil + battery, it basically does not work "out of box". I had to write this calibration sequence below with small threshold bounds to get it working. Did you observe the same behaviors?

input.pinA3.onEvent(ButtonEvent.Down, function () {
    light.showRing(
        `blue blue blue blue blue blue blue blue blue blue`
    )
})
input.pinA5.onEvent(ButtonEvent.Down, function () {
    light.showRing(
        "red red red red red red red red red red"
    )
})
let pA3 = input.pinA3.value();
let pA5 = input.pinA5.value();
for (let i = 0; i < 10; ++i) {
    pA5 = pA5 * 0.9 + input.pinA5.value() * 0.1;
    pA3 = pA3 * 0.9 + input.pinA3.value() * 0.1;
}
input.pinA5.setThreshold(pA5 * 1.1 + 50)
input.pinA3.setThreshold(pA3 * 1.1 + 50)

Model a device

JACDAC should no longer send control packets for each driver, but rather provide a composition of drivers for a device. I propose the following revision to a ControlPacket:

struct DriverInfo
    {
        uint8_t length;
        uint8_t address;        // the address assigned by the logic driver
        uint16_t flags;         // various flags, upper eight bits are reserved for control usage, lower 8 remain free for driver use.
        uint32_t driver_class;  // the class of the driver
        uint8_t payload[]; // optional additional data
    } __attribute((__packed__));
struct ControlPacket
    {
        uint8_t packet_type;    // indicates the type of the packet, normally just HELLO
        uint32_t serial_number; // the "unique" serial number of the device.
        uint8_t data[]; // you would place driver info here for a HELLO_PACKET
    } __attribute((__packed__));

To justify this design change let me perform some back of the envelope calculations. Pretend we have variable sized packets, and we have 3 drivers running on a single device:

  • currently each driver transmits a control packet every 500 ms
  • control packets are currently 12 bytes, and if you add 4 for the JDPkt header, is 16 bytes.
  • each control packet contains a serial number.

This means that 48 bytes are transmitted every 500 ms or 96 bytes every second, and 4 of those bytes are wasted sending duplicate serial_number information. At each baud you can compute the percentage of the bus spent on control packets for those three drivers:

  • 0.07% at 1mb
  • 0.15% at 500kb
  • 0.3% at 250kb
  • 0.6% at 125kb

Using the new way of transmitting control packets:

  • control packets are sent every 500ms, one per device.
  • the control packet for 3 drivers, including the JDPkt header is now 36 bytes.

At each baud the picture looks like this:

  • 0.04% at 1mb
  • 0.1% at 500kb
  • 0.16% at 250kb
  • 0.32% at 125kb

This also means that the bus will perform better at scale as the number of control packets sent is now proportional to the devices on the bus and not the number of drivers.

These numbers do not include the time taken for bus arbitration, but by reducing the number of packets sent, we also reduce the time spent on bus arbitration.

@pelikhan @tballmsft @sehodges @mmoskal @finneyj thoughts?

Seeing some oddly close serial numbers

When connecting multiple devices, I am seeing more serial numbers than devices.
To repro: connect multiple jacdac devices running a log broadcast service and list the serial numbers from the driver list.

potential debug crash

current might be null

JD_DMESG("ITER a %d, s %d, c %d, t %c%c%c", current->device.address, current->device.serial_number, current->device.driver_class, current->device.flags & JD_DEVICE_FLAGS_BROADCAST ? 'B' : ' ', current->device.flags & JD_DEVICE_FLAGS_LOCAL ? 'L' : ' ', current->device.flags & JD_DEVICE_FLAGS_REMOTE ? 'R' : ' ');

No data available code

Should accelerometer return an error code in updateSample when it has no data available? perhaps DEVICE_NO_DATA

Global events for JACDAC

We currently have events per driver in jacdac. Would be nice to have "top level" events:

  • jacdac bus connected / disconnected
  • driver changed (connected or disconnected)

codal-core not building in docker

In file included from /home/build/prjclone/libraries/codal-core/source/drivers/AsciiKeyMap.cpp:1:0:
/home/build/prjclone/libraries/codal-core/./inc/drivers/AsciiKeyMap.h:1:20: fatal error: KeyMap.h: No such file or directory
 #include "KeyMap.h"
Creating libraries folder
Cloning into: https://github.com/lancaster-university/codal-circuit-playground
Cloning into 'codal-circuit-playground'...
Checking out branch: v1.3.2
HEAD is now at e595933... Snapshot v1.3.2
�[1;35mSet target: codal-circuit-playground �[m
Using target-locked.json
�[1;34mTargeting codal-circuit-playground�[m
Installing dependencies...
Cloning into: https://github.com/lancaster-university/codal-core
Cloning into 'codal-core'...
Checking out branch: d5869d5ebe7c69754065b0c46c9db09dd96aa6fe
HEAD is now at d5869d5... Merge pull request #9 from adafruit/master
Cloning into: https://github.com/lancaster-university/mbed-classic
Cloning into 'mbed-classic'...
Checking out branch: 9100ba3f433129b176c535311afb5fad3b2f9e26
HEAD is now at 9100ba3... Use alt SERCOM for PA12 (to allow SPI on Zero-like boards)
Cloning into: https://github.com/lancaster-university/codal-samd21
Cloning into 'codal-samd21'...
Checking out branch: 87e1b872c041c9b21f575a1d6f3970c7e0a60d7c
HEAD is now at 87e1b87... Remove clock init code from USB.cpp (it's now in CPX target)
Cloning into: https://github.com/lancaster-university/codal-mbed
Cloning into 'codal-mbed'...
Checking out branch: 52b5a26ed40a6e8d33a8f06b7bec9764730045ef
HEAD is now at 52b5a26... Fix Pin reference in SPI
�[1;32mUsing library: codal-circuit-playground�[m
�[1;32mUsing library: codal-core�[m
�[1;32mUsing library: mbed-classic�[m
�[1;32mUsing library: codal-samd21�[m
�[1;32mUsing library: codal-mbed�[m
In file included from /home/build/prjclone/libraries/codal-core/source/drivers/AsciiKeyMap.cpp:1:0:
/home/build/prjclone/libraries/codal-core/./inc/drivers/AsciiKeyMap.h:1:20: fatal error: KeyMap.h: No such file or directory
 #include "KeyMap.h"
                    ^
compilation terminated.

SAMD21 USB does not enumerate on Windows

Hello!
I can no longer get Circuit Playground to enumerate on Windows 10. Works on Linux, Mac, iOS. It does work on the Makecode live site, but does not work when I compile regular codal from the current master branch.
Note that I tried reverting my recent PR #32
it still does not work

here is the code I am using:

#include "CircuitPlayground.h"
#include "USB_HID_Keys.h"
#include "HIDKeyboard.h"
CircuitPlayground cplay;
CodalUSB usb;
USBHIDKeyboard hid;
static const char *string_descriptors[] = {
    "Example Corp.", "PXT Device", "42424242",
};
void typeDot(Event)
{
    hid.type(".");
}
void typeDash(Event)
{
    hid.type("-");
}
int main()
{
    usb.stringDescriptors = string_descriptors;
    usb.add(hid);
    usb.start();
    //we need a bit of a delay for USB
    cplay.sleep(500);
    cplay.messageBus.listen(DEVICE_ID_BUTTON_A,DEVICE_BUTTON_EVT_CLICK,typeDot);
    cplay.messageBus.listen(DEVICE_ID_BUTTON_B,DEVICE_BUTTON_EVT_CLICK,typeDash);
    release_fiber();
}

Stack corruption

@mmoskal @finneyj

I think we have a case of stack corruption with the most recent changes to the fiber scheduler, specifically when launching fibers from within a 2 deep fiber context:

#1  <signal handler called>
#2  0x00000000 in ?? ()
#3  0x0000483e in codal::JDControlService::timerCallback (this=0x200005d4 <cplay+1164>)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/JACDAC/control/JDControlService.cpp:168
#4  0x0000416e in codal::MemberFunctionCallback::methodCall<codal::JDControlService> (
    object=<optimized out>, method=<optimized out>, e=...)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/./inc/core/MemberFunctionCallback.h:111
---Type <return> to continue, or q <return> to quit---
#5  0x00006bc2 in codal::MemberFunctionCallback::fire (this=this@entry=0x20000fd4, e=...)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/MemberFunctionCallback.cpp:48
#6  0x00006590 in async_callback (param=0x20000fa8)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:119
#7  0x00005b6c in codal::invoke (entry_fn=entry_fn@entry=0x64f5 <async_callback(void*)>, 
    param=param@entry=0x20000fa8)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/CodalFiber.cpp:621
#8  0x0000683e in codal::MessageBus::process (this=this@entry=0x200001b8 <cplay+112>, evt=..., 
    urgent=urgent@entry=false)
---Type <return> to continue, or q <return> to quit---
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:379
#9  0x000068e6 in codal::MessageBus::idle (this=0x200001b8 <cplay+112>)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:288
#10 0x00006362 in codal::MemberFunctionCallback::methodCall<codal::MessageBus> (object=<optimized out>, 
    method=<optimized out>, e=...)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/./inc/core/MemberFunctionCallback.h:111
#11 0x00006bc2 in codal::MemberFunctionCallback::fire (this=this@entry=0x20000dfc, e=...)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/MemberFunctionCallback.cpp:48
---Type <return> to continue, or q <return> to quit---
#12 0x00006590 in async_callback (param=0x20000dd0)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:119
#13 0x00006834 in codal::MessageBus::process (this=this@entry=0x200001b8 <cplay+112>, evt=..., 
    urgent=urgent@entry=true)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:377
#14 0x00006854 in codal::MessageBus::queueEvent (this=0x200001b8 <cplay+112>, evt=...)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:164
#15 0x000068c2 in codal::MessageBus::send (this=<optimized out>, evt=...)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/Mess---Type <return> to continue, or q <return> to quit---
ageBus.cpp:331
#16 0x00006936 in codal::Event::fire (this=0x20007fd4, this@entry=0x200001b8 <cplay+112>)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/types/Event.cpp:126
#17 codal::Event::Event (this=this@entry=0x20007fd4, mode=codal::CREATE_AND_FIRE, value=<optimized out>, 
    source=<optimized out>)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/types/Event.cpp:70
#18 0x0000695c in codal::Event::Event (this=0x20007fd4, source=<optimized out>, value=<optimized out>, 
    mode=<optimized out>)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/types/Event.cpp:69
---Type <return> to continue, or q <return> to quit---
#19 0x0000586a in codal::idle ()
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/CodalFiber.cpp:966
#20 0x00005be2 in codal::idle_task ()
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/CodalFiber.cpp:989
#21 0x00005bd8 in codal::launch_new_fiber_param (ep=<optimized out>, cp=<optimized out>, 
    pm=<optimized out>)
    at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/CodalFiber.cpp:673

The xpsr, lr, psp values point to stack corruption according to my workings:

(gdb) print/x $xpsr
$6 = 0x1000003
(gdb) print $lr
$7 = (void (*)()) 0xfffffff9
(gdb) print $psp
$8 = (void *) 0xd464db9c
(gdb) print/x $control
$9 = 0x0

My simple, reproducible test is the following C++:

#include "CircuitPlayground.h"
#include "JDTestService.h"
#include "CodalDmesg.h"

CircuitPlayground cplay;
JDTestService test("T", HostService);

void send_event()
{
    while(1)
    {
        cplay.sleep(20);
        Event(0xBEEF,0xBEEF);
    }
}

int main()
{
    cplay.jacdac.start();

    int state = 0;
    while(1)
    {
        cplay.io.led.setDigitalValue(state);
        fiber_sleep(500);
        state = !state;
    }
}

With the CodalConfig option DEVICE_FIBER_USER_DATA enabled, the program hardfaults after two LED blinks, with it disabled the LED blinks continuously.

Of course it's more likely I'm doing something weird in my JACDAC code, but from my inspections the device hard faults on a function call suggesting something more sinister.

Tons of warnings in AsciiKeyMap

[1/181] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/AsciiKeyMap.cpp.obj
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
 };
 ^
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]

JACDAC V0 TODO

  • Control Packet refactor
    • devices should broadcast their drivers every 500 ms
    • as before, control packets should be routed by the logic driver to correct drivers
  • Dynamic packet sizes
    • device should receive a JDPkt header which will contain the size and the checksum
    • device should then prepare to receive the remained of the packet
  • Dynamic baud rate
    • the pulse should dictate the baud rate for communication 10 us is 1mbaud. (i.e. 10 bits at whatever baud)
    • a device should reconfigure the baud rate upon receiving the pulse and prepare to receive the packet
    • control packets should be sent at the lowest baud rate on the bus
  • Error detection and recovery
    • JACDAC should have a dedicated timer for detecting error conditions
    • As before, bus errors are not permissible in JACDAC
    • Packet timeouts should be tighter as specified on JACDAC.org
    • minimum byte gap should be observed.
    • difference between lo pulse and transmitting baud rate should not be tolerated.

PinName vs PinNumber

I'm working on a fork of the target codal-stm32 to support the STM32L475. I'm trying to implements Serial class and I stuck on some apparently simple problem but from now I don't understand if the distinction between PinName and PinNumber.

In the constructor of the class Serial, the type of the parameters is PinName :
https://github.com/lancaster-university/codal-core/blob/master/inc/driver-models/Serial.h#L113

But in the abstraction of pins, the type PinNumber is used :
https://github.com/lancaster-university/codal-core/blob/master/inc/driver-models/Pin.h#L115

To add to my confusion, the abstraction for the I2C uses the Pin class which seems more natural :
https://github.com/lancaster-university/codal-core/blob/master/inc/driver-models/I2C.h#L43

Should not we refactor the serial class to gain homogeneity? I guess with MBed the problem does not arise but in my case my goal is precisely not to depend on Mbed ^^

If I prepare a PR with the refactoring introducing Pin in place of PinName, is there any chance that it will be integrated?

Add status code in jacdac control packet

For diagnosis purposes, jacdac control packets could also have a status code, similar to automation codes. This would allow a driver to expose a lightweight status.

Ok, battery low, malfunction, etc... highest code wins and gets transmitted

Accelerometer::updateSample should be defined on the base class

We call this method to launch the accelerometer - it should be defined on the base class.

        /**
          * Reads the acceleration data from the accelerometer, and stores it in our buffer.
          * This only happens if the accelerometer indicates that it has new data via int1.
          *
          * On first use, this member function will attempt to add this component to the
          * list of fiber components in order to constantly update the values stored
          * by this object.
          *
          * This technique is called lazy instantiation, and it means that we do not
          * obtain the overhead from non-chalantly adding this component to fiber components.
          *
          * @return DEVICE_OK on success, DEVICE_I2C_ERROR if the read request fails.
          */
        int updateSample();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.