Skip to content

Commit 8b54e58

Browse files
Merge branch 'dev'
Signed-off-by: Francois Berder <[email protected]>
2 parents 68a7e4a + 193176d commit 8b54e58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2633
-490
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 2.8.8)
22

33
project(LetMeCreate)
44

55
option(BUILD_EXAMPLES "Build examples" OFF)
6+
option(BUILD_TESTS "Build tests" OFF)
67

78
set(letmecreate_VERSION_MAJOR 0)
89
set(letmecreate_VERSION_MINOR 1)
910

1011
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -ggdb3")
1112
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
12-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples/bin)
1313

1414
include_directories(include)
1515
file(GLOB core_srcs src/core/*.c)
@@ -24,3 +24,7 @@ install(TARGETS letmecreate_click LIBRARY DESTINATION lib)
2424
if(BUILD_EXAMPLES)
2525
add_subdirectory(examples)
2626
endif(BUILD_EXAMPLES)
27+
28+
if(BUILD_TESTS)
29+
add_subdirectory(tests)
30+
endif(BUILD_TESTS)

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ MikroClick board supported:
2323
- 8x8R (Led Matrix)
2424

2525
Examples are installed in /usr/bin/letmecreate_examples.
26+
Tests are installed in /usr/bin/letmecreate_tests.
2627

2728
## Integration in Openwrt
2829

examples/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples/bin)
2+
13
add_executable(letmecreate_test_proximity proximity/main.c)
24
target_link_libraries(letmecreate_test_proximity letmecreate_click letmecreate_core)
35
install(TARGETS letmecreate_test_proximity RUNTIME DESTINATION bin)

examples/joystick/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#define OFFSET 98
1010
#define MAXIMUM (OFFSET * 2)
1111

12-
/* We have 7 LEDs + the heartbeat LED which we skip */
13-
#define LED_CNT 7
1412

1513
int get_led_mask(float perc)
1614
{

examples/led_matrix/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ int main(void)
2323
spi_init();
2424
spi_select_bus(MIKROBUS_1);
2525
led_matrix_click_enable();
26+
led_matrix_click_set_intensity(3);
2627
for (cols = 0; cols < 8; ++cols) {
2728
uint8_t lines;
2829
for (lines = 0; lines < 8; ++lines) {

include/click/air_quality.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
* @param callback Function to call if air quality is bad (must not be null)
2222
* @return callback ID (positive integer) if successful, -1 otherwise.
2323
*/
24-
int air_quality_click_set_callback(const uint8_t mikrobus_index, void(*callback)(uint8_t));
24+
int air_quality_click_set_callback(uint8_t mikrobus_index, void(*callback)(uint8_t));
2525

2626
#endif

include/click/common.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @param[in] value New value of the register
1919
* @return 0 if successful, otherwise it returns -1.
2020
*/
21-
int i2c_write_register(const uint16_t address, const uint8_t reg_address, const uint8_t value);
21+
int i2c_write_register(uint16_t address, uint8_t reg_address, uint8_t value);
2222

2323
/**
2424
* @brief Read a one-byte register from a slave over I²C.
@@ -28,7 +28,7 @@ int i2c_write_register(const uint16_t address, const uint8_t reg_address, const
2828
* @param[out] data Pointer to a 8-bit variable to store the value of the register read from the slave
2929
* @return 0 if successful, otherwise it returns -1.
3030
*/
31-
int i2c_read_register(const uint16_t address, const uint8_t reg_address, uint8_t *data);
31+
int i2c_read_register(uint16_t address, uint8_t reg_address, uint8_t *data);
3232

3333
/**
3434
* @brief Read a 16bit register from a slave over I²C.
@@ -39,7 +39,7 @@ int i2c_read_register(const uint16_t address, const uint8_t reg_address, uint8_t
3939
* @param[out] data Pointer to a 16-bit variable to store the value of the register read from the slave
4040
* @return 0 if successful, otherwise it returns -1.
4141
*/
42-
int i2c_read_16b_register(const uint16_t address, const uint8_t reg_low_address, const uint8_t reg_high_address, uint16_t *data);
42+
int i2c_read_16b_register(uint16_t address, uint8_t reg_low_address, uint8_t reg_high_address, uint16_t *data);
4343

4444
/**
4545
* @brief Write one byte to a register over SPI.
@@ -48,6 +48,6 @@ int i2c_read_16b_register(const uint16_t address, const uint8_t reg_low_address,
4848
* @param[in] data New value of the register
4949
* @return 0 if successful, -1 otherwise
5050
*/
51-
int spi_write_register(const uint8_t reg_address, const uint8_t data);
51+
int spi_write_register(uint8_t reg_address, uint8_t data);
5252

5353
#endif

include/click/led_matrix.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int led_matrix_click_enable(void);
2525
* @param[in] intensity in range 0-15
2626
* @return 0 if successful, -1 otherwise
2727
*/
28-
int led_matrix_click_set_intensity(const uint8_t intensity);
28+
int led_matrix_click_set_intensity(uint8_t intensity);
2929

3030
/**
3131
* @brief Switch on/off all LED's of one column.
@@ -34,7 +34,16 @@ int led_matrix_click_set_intensity(const uint8_t intensity);
3434
* @param[in] data bit string to switch on/off LED's in this column
3535
* @return 0 if successful, -1 otherwise
3636
*/
37-
int led_matrix_click_set_column(const uint8_t column_index, const uint8_t data);
37+
int led_matrix_click_set_column(uint8_t column_index, uint8_t data);
38+
39+
40+
/**
41+
* @brief Displays a two digit number.
42+
*
43+
* @param[in] number a number between 0 and 99 which will be displayed
44+
* @return 0 if successful, -1 otherwise
45+
*/
46+
int led_matrix_click_display_number(uint8_t number);
3847

3948
/**
4049
* @brief Switch on/off all LED's.

include/click/motion.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @param[in] mikrobus_index Index of the mikrobus used by the click board (see #MIKROBUS_INDEX)
1818
* @return 0 if successful, -1 otherwise
1919
*/
20-
int motion_click_enable(const uint8_t mikrobus_index);
20+
int motion_click_enable(uint8_t mikrobus_index);
2121

2222
/**
2323
* @brief Attach a callback if movement is detected.
@@ -28,14 +28,14 @@ int motion_click_enable(const uint8_t mikrobus_index);
2828
* @param[in] callback Function to call if movement is detected
2929
* @return ID of the callback. Use #gpio_monitor_remove_callback to detach your callback.
3030
*/
31-
int motion_click_attach_callback(const uint8_t mikrobus_index, void(*callback)(uint8_t));
31+
int motion_click_attach_callback(uint8_t mikrobus_index, void(*callback)(uint8_t));
3232

3333
/**
3434
* @brief Disable the Motion Click.
3535
*
3636
* @param[in] mikrobus_index Index of the mikrobus used by the click board (see #MIKROBUS_INDEX)
3737
* @return 0 if successful, -1 otherwise
3838
*/
39-
int motion_click_disable(const uint8_t mikrobus_index);
39+
int motion_click_disable(uint8_t mikrobus_index);
4040

4141
#endif

include/click/relay2.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@
1616
* @param[in] mikrobus_index Index of the mikrobus (see #MIKROBUS_INDEX)
1717
* @return 0 if successful, -1 otherwise
1818
*/
19-
int relay2_click_enable_relay_1(const uint8_t mikrobus_index);
19+
int relay2_click_enable_relay_1(uint8_t mikrobus_index);
2020

2121
/**
2222
* @brief Disable relay 1 on Relay2 Click.
2323
*
2424
* @param[in] mikrobus_index Index of the mikrobus (see #MIKROBUS_INDEX)
2525
* @return 0 if successful, -1 otherwise
2626
*/
27-
int relay2_click_disable_relay_1(const uint8_t mikrobus_index);
27+
int relay2_click_disable_relay_1(uint8_t mikrobus_index);
2828

2929
/**
3030
* @brief Enable relay 2 on Relay2 Click.
3131
*
3232
* @param[in] mikrobus_index Index of the mikrobus (see #MIKROBUS_INDEX)
3333
* @return 0 if successful, -1 otherwise
3434
*/
35-
int relay2_click_enable_relay_2(const uint8_t mikrobus_index);
35+
int relay2_click_enable_relay_2(uint8_t mikrobus_index);
3636

3737
/**
3838
* @brief Disable relay 2 on Relay2 Click.
3939
*
4040
* @param[in] mikrobus_index Index of the mikrobus (see #MIKROBUS_INDEX)
4141
* @return 0 if successful, -1 otherwise
4242
*/
43-
int relay2_click_disable_relay_2(const uint8_t mikrobus_index);
43+
int relay2_click_disable_relay_2(uint8_t mikrobus_index);
4444

4545
#endif

0 commit comments

Comments
 (0)