30 lines
936 B
C
30 lines
936 B
C
#include "servicepoint.h"
|
|
|
|
int main(void) {
|
|
// UdpConnection *connection = sp_udp_open_ipv4(172, 23, 42, 29, 2342);
|
|
UdpConnection *connection = sp_udp_open_ipv4(127, 0, 0, 1, 2342);
|
|
if (connection == NULL)
|
|
return -1;
|
|
|
|
Bitmap *all_on = sp_bitmap_new_max_sized();
|
|
sp_bitmap_fill(all_on, true);
|
|
TypedCommand *cmd = sp_command_bitmap(0, 0, all_on, COMPRESSION_CODE_UNCOMPRESSED);
|
|
if (cmd == NULL)
|
|
return -1;
|
|
|
|
sp_udp_send_command(connection, cmd);
|
|
|
|
BrightnessGrid *grid = sp_brightness_grid_new(TILE_WIDTH, TILE_HEIGHT);
|
|
|
|
ByteSlice slice = sp_brightness_grid_unsafe_data_ref(grid);
|
|
for (size_t index = 0; index < slice.length; index++) {
|
|
slice.start[index] = (uint8_t) (index % ((size_t) Brightness_MAX));
|
|
}
|
|
|
|
TypedCommand *command = sp_command_brightness_grid(0, 0, grid);
|
|
sp_udp_send_command(connection, command);
|
|
|
|
sp_udp_free(connection);
|
|
return 0;
|
|
}
|