|
| 1 | +Switch |
| 2 | +====== |
| 3 | + |
| 4 | +1. `switch_add_callback(0xF, myfunc)` return -1 |
| 5 | +2. `switch_init()` return 0 |
| 6 | +3. `switch_init()` return 0 (check if multiple functions return 0) |
| 7 | +4. `switch_add_callback(0x0, myfunc)` return -1 |
| 8 | +5. `switch_add_callback(0xF, NULL)` return -1 |
| 9 | +6. `switch_remove_callback(-1)` return -1 |
| 10 | +7. For event in [0x1,0x2,0x4,0x8] |
| 11 | + `switch_add_callback(event,myfunc)` return id |
| 12 | + Press/Release switch 1, read 1 |
| 13 | + Press/Release switch 2, read nothing |
| 14 | + `switch_remove_callback(id)` return 0 |
| 15 | + `switch_remove_callback(id)` return -1 |
| 16 | +8. `switch_release()` return 0 |
| 17 | +9. `switch_init()` return 0 |
| 18 | +10. `switch_release()` return 0 and switch_release return 0 |
| 19 | + |
| 20 | +ADC |
| 21 | +=== |
| 22 | + |
| 23 | +1. wire MIKROBUS_1_ADC to GND and measure 0 |
| 24 | +2. wire MIKROBUS_1_ADC to 3.3V and measure 675 |
| 25 | +3. wire MIKROBUS_1_ADC to 5V and measure 1023 |
| 26 | +4. wire MIKROBUS_2_ADC to GND and measure 0 |
| 27 | +5. wire MIKROBUS_2_ADC to 3.3V and measure 675 |
| 28 | +6. wire MIKROBUS_2_ADC to 5V and measure 1023 |
| 29 | +7. `adc_get_measure(4, mymeasure)` return -1 |
| 30 | +8. `adc_get_measure(MIKROBUS_1, NULL)` return -1 |
| 31 | + |
| 32 | +UART |
| 33 | +==== |
| 34 | + |
| 35 | +Prerequisite: Loopback MIKROBUS_1 and MIKROBUS_2 TX/RX |
| 36 | + |
| 37 | +1. `uart_send` mikrobus 1 return -1 |
| 38 | + `uart receive` mikrobus 1 return -1 |
| 39 | +2. `uart_init()` return 0 and get_bd = bd1 |
| 40 | +3. `uart_init()` return 0 and get_bd = bd1 |
| 41 | +4. `uart_send(NULL, 1)` return -1 |
| 42 | +5. `uart_send(buffer, 0)` return 0 |
| 43 | +6. `uart_receive(NULL, 1)` return -1 |
| 44 | +7. `uart_receive(buffer, 0)` return 0 |
| 45 | +8. `uart_set_baudrate(115200)` return -1 |
| 46 | +9. `uart_release()` return 0 |
| 47 | +10. `uart_release()` return 0 |
| 48 | +11. `uart_select_bus(3)` return -1; |
| 49 | +12. for bd in UART_BAUDRATE |
| 50 | + `uart_init(bd)` return 0 and get_bd = bd |
| 51 | + send data from mikrobus 1 to 2 |
| 52 | + send data from mikrobus 2 to 1 |
| 53 | + `uart_release()` return 0 |
| 54 | + |
| 55 | +Led |
| 56 | +=== |
| 57 | + |
| 58 | +1. `led_switch_on(ALL_LEDS)` and `led_switch_off(ALL_LEDS)` return -1 |
| 59 | +2. `led_set(ALL_LEDS,0xAA)` return -1 |
| 60 | +3. `let_set_delay(ALL_LEDS,500,500)` return -1 |
| 61 | +4. `led_release()` return 0 |
| 62 | +5. `led_init()` return 0 and leds are off and in on_off_mode |
| 63 | +6. `led_init()` return 0 and leds are off and in on_off_mode |
| 64 | +7. `led_release()` return 0 and leds are off |
| 65 | +8. `led_release()` return 0 and leds are off |
| 66 | +9. `led_init()` return 0 `led_switch_on` each led return 0 must see all leds going progressively on |
| 67 | +10. `led_switch_off` each led return 0 must see all leds going progressively off |
| 68 | +11. `led_set(0xAA)` return 0 and see all leds according to pattern |
| 69 | +12. `led_set(0x55)` return 0 and see all leds according to pattern |
| 70 | +13. `led_set_delay(ALL_LEDS, 500, 500) return -1 |
| 71 | +14. `led_configure_timer_mode(0xFF)` return 0 and all leds are off and get_mode are TIMER_MODE |
| 72 | +15. `led_get_mode(0x3, mode)` return -1 |
| 73 | +16. `led_get_mode(0x1, NULL)` return -1 |
| 74 | +17. `led_set_delay(0xFF, 500, 500)` return 0 and check that leds blink at 1Hz |
| 75 | +18. `led_set_delay(0xFF, 100, 1000)` return 0 and check that leds blink faster |
| 76 | +19. `led_switch_on/off(ALL_LEDS)` return -1 |
| 77 | +20. `led_set(ALL_LEDS,0xFF)` return -1 |
| 78 | +21. `led_configure_on_off_mode(ALL_LEDS)` return 0 and all leds are off |
| 79 | +22. `led_switch_on(ALL_LEDS)` return 0 and all leds on |
| 80 | +23. `led_release()` return 0 and all leds are off |
| 81 | + |
| 82 | +PWM |
| 83 | +=== |
| 84 | + |
| 85 | +1. `pwm_init(3)` return -1 |
| 86 | +2. `pwm_release(3)` return -1 |
| 87 | + pwm_get_duty_cyle(MIKROBUS_1) return -1 |
| 88 | + pwm_get/set return -1 |
| 89 | +3. `pwm_init(MIKROBUS_1)` return 0 and `pwm_init(MIKROBUS_2)` return 0 `pwm_get_duty_cycle()` = 50 and `pwm_get_frequency()` = 2kHz |
| 90 | +4. `pwm_init(MIKROBUS_1)` return 0 and `pwm_init(MIKROBUS_2)` return 0 `pwm_get_duty_cycle()` = 50 and `pwm_get_frequency()` = 2kHz |
| 91 | +7. `pwm_get_duty_cycle(null)` return -1 |
| 92 | +8. `pwm_get_frequency(null)` return -1 |
| 93 | +9. `pwm_get_period(null)` return -1 |
| 94 | +5. `pwm_release(MIKROBUS_1)` return 0 and `pwm_release(MIKROBUS_2)` return 0 |
| 95 | +6. `pwm_release(MIKROBUS_1)` return 0 and `pwm_release(MIKROBUS_2)` return 0 |
| 96 | + |
| 97 | +10. `pwm_set_period(1kHz)` == `pwm_get_period` = 1/`pwm_get_frequency()` |
| 98 | +11. If multimeter |
| 99 | + `pwm_init(MIKROBUS_1)` |
| 100 | + `pwm_set_frequency(3kHz)` |
| 101 | + `pwm_set_duty(50)` |
| 102 | + `pwm_enable(MIKROBUS_1)` |
| 103 | + ask |
| 104 | + `pwm_set_frequency(1kHz)` |
| 105 | + ask |
| 106 | + `pwm_disable(MIKROBUS_1)` |
| 107 | + ask |
| 108 | + `pwm_release(MIKROBUS_1)` |
| 109 | + |
| 110 | +GPIO |
| 111 | +==== |
| 112 | + |
| 113 | +21=MIKROBUS_1_INT |
| 114 | +1. `gpio_set_direction(100, output) and return -1 |
| 115 | +2. `gpio_get_direction(100, dir) and return -1 |
| 116 | +3. `gpio_get_value(100, 0) and return -1 |
| 117 | +4. `gpio_set_value(100, value) and return -1 |
| 118 | +5. `gpio_init(100) and return -1 |
| 119 | +6. `gpio_release(100) and return -1 |
| 120 | +7. `gpio_init(21) return 0 |
| 121 | +8. `gpio_set_direction(21, input) and `gpio_get_value(21)` = 0 |
| 122 | +9. ask user to connect to gnd and `gpio_get_value(21)` = 0 |
| 123 | +10. ask user to connect to 3v3 and `gpio_get_value(21)` = 1 |
| 124 | +11. ask user to connect led and `gpio_set_direction(21, output)` return 0 and `gpio_set_value(21, 1)` return 0 and ask user if led is on |
| 125 | +12. `gpio_set_value(21, 0)` return 0 and ask user if led is off |
| 126 | +13. `gpio_release(21)` |
| 127 | + |
| 128 | +GPIO MONITOR |
| 129 | +============ |
| 130 | + |
| 131 | +1. `gpio_monitor_add_callback(21, edge, mycallback)` return -1 |
| 132 | +2. `gpio_monitor_init()` return 0 |
| 133 | +3. id = `gpio_monitor_add_callback(21, edge, mycallback)` return 0 |
| 134 | + connect to gnd and detect falling event |
| 135 | + connect to 3v3 and detect raising event |
| 136 | +4. `gpio_monitor_remove_callback(4)` return -1 |
| 137 | +5. `gpio_monitor_remove_callback(id)` return 0 |
| 138 | +6. `gpio_monitor_remove_callback(id)` return -1 |
| 139 | +7. `gpio_monitor_release()` return 0 |
| 140 | + |
| 141 | +I2C |
| 142 | +=== |
| 143 | + |
| 144 | +1. i2c_write() return -1 |
| 145 | +2. i2c_read() return -1 |
| 146 | +3. i2c_init() return 0 and get_current_bus() == MIKROBUS_1 |
| 147 | +4. i2c_select_bus(4) and get_current_bus() == MIKROBUS_1 |
| 148 | +5. i2c_write(NULL, 1) return -1 |
| 149 | +6. i2c_read(NULL, 1) return -1 |
| 150 | +7. i2c_write(buffer, 0) return 0 |
| 151 | +8. i2c_read(buffer, 0) return 0 |
| 152 | +9. Plug Proximity Click in mikrobus 1 |
| 153 | + read Product ID |
| 154 | +10. Plug Proximity Click in mikrobus 2 |
| 155 | + i2c_select_bus(MIKROBUS_2) and get_current_bus() == MIKROBUS_2 |
| 156 | + read Product ID |
| 157 | +11. i2c_release() return 0 |
| 158 | + |
| 159 | +SPI |
| 160 | +=== |
| 161 | + |
| 162 | +1. spi_set_mode() return -1 |
| 163 | +2. spi_set_speed() return -1 |
| 164 | +3. spi_transfer() return -1 |
| 165 | +4. spi_init() return 0 |
| 166 | +5. spi_transfer(NULL, NULL, 0) return 0 |
| 167 | +6. spi_transfer(NULL, NULL, 1) return -1 |
| 168 | +7. Plug Accel Click in mikrobus 1 |
| 169 | + read product ID |
| 170 | +8. Plug Accel Click in mikrobus 1 |
| 171 | + read product ID |
| 172 | +9. spi_release() return 0 |
0 commit comments