• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SpiNNakerManchester / SpiNNMan / 6574804013

19 Oct 2023 12:47PM UTC coverage: 51.937% (+1.2%) from 50.777%
6574804013

Pull #327

github

Christian-B
typing changes
Pull Request #327: Type Annotations and Checking

105 of 1288 branches covered (0.0%)

Branch coverage included in aggregate %.

2375 of 2375 new or added lines in 180 files covered. (100.0%)

4775 of 8108 relevant lines covered (58.89%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.55
/spinnman/extended/bmp_set_led.py
1
# Copyright (c) 2015 The University of Manchester
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#     https://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14

15
from typing import Iterable, Union
1✔
16
from spinn_utilities.overrides import overrides
1✔
17
from spinnman.messages.scp import SCPRequestHeader
1✔
18
from spinnman.messages.scp.abstract_messages import (
1✔
19
    AbstractSCPRequest, BMPRequest)
20
from spinnman.messages.scp.enums import SCPCommand
1✔
21
from spinnman.messages.scp.impl.check_ok_response import CheckOKResponse
1✔
22
from spinnman.messages.scp.enums.led_action import LEDAction
1✔
23

24

25
class BMPSetLed(BMPRequest):
1✔
26
    """
27
    Set the LED(s) of a board to either on, off or toggling.
28

29
    This class is currently deprecated and untested as there is no
30
    known use except for Transceiver.set_led which is itself deprecated.
31
    """
32
    __slots__ = ()
1✔
33

34
    def __init__(self, led: Union[int, Iterable[int]], action: LEDAction,
1✔
35
                 boards: Union[int, Iterable[int]]):
36
        """
37
        :param led: Number of the LED or an iterable of LEDs to set the
38
            state of (0-7)
39
        :type led: int or list(int)
40
        :param LEDAction action:
41
            State to set the LED to, either on, off or toggle
42
        :param boards: Specifies the board to control the LEDs of. This may
43
            also be an iterable of multiple boards (in the same frame).
44
        :type boards: int or list(int)
45
        """
46
        # set up the led entry for arg1
47
        if isinstance(led, int):
×
48
            arg1 = action.value << (led * 2)
×
49
        else:
50
            arg1 = sum(action.value << (a_led * 2) for a_led in led)
×
51

52
        # Bitmask of boards to control
53
        arg2 = self.get_board_mask(boards)
×
54

55
        # initialise the request now
56
        super().__init__(
×
57
            boards,
58
            SCPRequestHeader(command=SCPCommand.CMD_LED),
59
            argument_1=arg1, argument_2=arg2)
60

61
    @overrides(AbstractSCPRequest.get_scp_response)
1✔
62
    def get_scp_response(self) -> CheckOKResponse:
1✔
63
        return CheckOKResponse("Set the LEDs of a board", "CMD_LED")
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc