Swapped MLT and HLT SSR pins to match he real hardware. More doxygen changes.

Mon, 29 Oct 2018 19:37:14 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 29 Oct 2018 19:37:14 +0100
changeset 30
3cc32f97410c
parent 29
45647136ec95
child 31
11983772e6d2

Swapped MLT and HLT SSR pins to match he real hardware. More doxygen changes.

components/vnc_server/vnc-server.c file | annotate | diff | comparison | revisions
components/vnc_server/vnc-server.h file | annotate | diff | comparison | revisions
components/websocket/include/websocket.h file | annotate | diff | comparison | revisions
components/websocket/include/websocket_server.h file | annotate | diff | comparison | revisions
sdkconfig file | annotate | diff | comparison | revisions
--- a/components/vnc_server/vnc-server.c	Mon Oct 29 12:16:37 2018 +0100
+++ b/components/vnc_server/vnc-server.c	Mon Oct 29 19:37:14 2018 +0100
@@ -33,46 +33,46 @@
 
 static const char *TAG = "vnc-server";
 
-#define BACKLOG             5       /* Number of pending connections queue will hold */
-#define MESSAGE_BUFFER_SIZE 60	/* Was 50, but I have seen 52 bytes length */
-#define TILE_SIZE           16
-#define TRUE_COLOUR_FLAG    1       /* True colour is set */
-#define BIG_ENDIAN_FLAG     1       /* Always send colour data big endian */
+#define BACKLOG             5				///< Number of pending connections queue will hold 
+#define MESSAGE_BUFFER_SIZE 60				///< Was 50, but I have seen 52 bytes length
+#define TILE_SIZE           16				///< Tile dimension
+#define TRUE_COLOUR_FLAG    1				///< True colour is set
+#define BIG_ENDIAN_FLAG     1				///< Always send colour data big endian
 
 /* Default display parameters */
-#define BITS_PER_PIXEL      8      /* Bits per pixel */
-#define PIXEL_DEPTH         8      /* Usefull bits per pixel */
-#define RED_MAX             7
-#define GREEN_MAX           7
-#define BLUE_MAX            3
-#define RED_SHIFT           5
-#define GREEN_SHIFT         2
-#define BLUE_SHIFT          0
+#define BITS_PER_PIXEL      8				///< Bits per pixel
+#define PIXEL_DEPTH         8				///< Usefull bits per pixel
+#define RED_MAX             7				///< Red maximum
+#define GREEN_MAX           7				///< Green maximum
+#define BLUE_MAX            3				///< Blue maximum, together 8 bits.
+#define RED_SHIFT           5				///< Red shift in color byte
+#define GREEN_SHIFT         2				///< Green shift in color byte
+#define BLUE_SHIFT          0				///< Blue shift in color byte
 
 
 /* Initial default RGB332 */
-uint8_t			Bits_Per_Pixel = 8;
+uint8_t			Bits_Per_Pixel = 8;		///< Current number of bits per pixel
 
-uint16_t		Red_Max     = RED_MAX;
-uint16_t		Green_Max   = GREEN_MAX;
-uint16_t		Blue_Max    = BLUE_MAX;
-uint8_t			Red_Shift   = RED_SHIFT;
-uint8_t			Green_Shift = GREEN_SHIFT;
-uint8_t			Blue_Shift  = BLUE_SHIFT;
-bool			AltPixels   = false;
+uint16_t		Red_Max     = RED_MAX;		///< Current Red maxmimum
+uint16_t		Green_Max   = GREEN_MAX;	///< Current Green maximum
+uint16_t		Blue_Max    = BLUE_MAX;		///< Current Blue maximum
+uint8_t			Red_Shift   = RED_SHIFT;	///< Current Red bits shift
+uint8_t			Green_Shift = GREEN_SHIFT;	///< Current Green bits shift
+uint8_t			Blue_Shift  = BLUE_SHIFT;	///< Current Blue bits shift
+bool			AltPixels   = false;		///< Alternate the pixels
 
 /* Client to Server message types */
-#define SET_PIXEL_FORMAT         0
-#define FIX_COLOUR_MAP_ENTRIES   1
-#define SET_ENCODINGS            2
-#define FRAME_BUFFER_UPDATE_REQ  3
-#define KEY_EVENT                4
-#define POINTER_EVENT            5
-#define CLIENT_CUT_TEXT          6
+#define SET_PIXEL_FORMAT         0			///< Set pixel format
+#define FIX_COLOUR_MAP_ENTRIES   1			///< Fix color map entries (not used)
+#define SET_ENCODINGS            2			///< Set encodings
+#define FRAME_BUFFER_UPDATE_REQ  3			///< Request frame buffer update
+#define KEY_EVENT                4			///< Keyboard event (not used)
+#define POINTER_EVENT            5			///< Pointer event, translated to touch events
+#define CLIENT_CUT_TEXT          6			///< Text editing, not used.
 
 /* Macros to split colour to bytes */
-#define COLOUR2BYTE1(col) ((col>>8)&0xFF)
-#define COLOUR2BYTE0(col) (col&0xFF)
+#define COLOUR2BYTE1(col) ((col>>8)&0xFF)		///< High part
+#define COLOUR2BYTE0(col) (col&0xFF)			///< Low part
 
 
 /* Thread function prototypes */
@@ -94,23 +94,27 @@
 };
 
 
-uint8_t			VNC_pointer_button = 0;
-uint16_t		VNC_pointer_x = 0;
-uint16_t		VNC_pointer_y = 0;
+uint8_t			VNC_pointer_button = 0;		///< Button mask for the mouse pointer
+uint16_t		VNC_pointer_x = 0;		///< Mouse position X
+uint16_t		VNC_pointer_y = 0;		///< Mouse position Y
 
 
 /* Define size of each thread's stack */
-#define MIN_STACK_SIZE	3072
+#define MIN_STACK_SIZE	3072				///< Minimal task stack size
 
 
-/* Messages */
-char			server_ProtocolVersion[] = "RFB 003.003\n";
-char			bad_protocol[] = "Unsupported ProtocolVersion";
-char			server_busy[] = "Server is Busy";
-char			sound_bell[] = "\2";
-char			desktop_name[] = "MBSE BrewBoard";	// Hardcoded, don't change or the VNC webclient breaks.
+/**
+ * @brief  Messages
+ */
+static char		server_ProtocolVersion[] = "RFB 003.003\n";
+static char		bad_protocol[] = "Unsupported ProtocolVersion";
+static char		server_busy[] = "Server is Busy";
+static char		sound_bell[] = "\2";
+static char		desktop_name[] = "MBSE BrewBoard";	// Hardcoded, don't change or the VNC webclient breaks.
 
-/* Frame Buffer */
+/**
+ * @brief  Frame Buffer
+ */
 vnc_color_t		frame_buffer[CONFIG_VNC_SERVER_FRAME_HEIGHT+1][CONFIG_VNC_SERVER_FRAME_WIDTH+1];
 
 /* Calculate the number of tiles in the X and Y directions */
@@ -118,37 +122,36 @@
 #define NUM_TILES_Y_AXIS (CONFIG_VNC_SERVER_FRAME_HEIGHT/TILE_SIZE + 1)
 #define LAST_TILE_HEIGHT (CONFIG_VNC_SERVER_FRAME_HEIGHT % TILE_SIZE)
 #else
-#define NUM_TILES_Y_AXIS (CONFIG_VNC_SERVER_FRAME_HEIGHT/TILE_SIZE)
-#define LAST_TILE_HEIGHT TILE_SIZE
+#define NUM_TILES_Y_AXIS (CONFIG_VNC_SERVER_FRAME_HEIGHT/TILE_SIZE)	///< Nr of tiles on the Y axis.
+#define LAST_TILE_HEIGHT TILE_SIZE					///< Height of the last tile.
 #endif
 
 #if (CONFIG_VNC_SERVER_FRAME_WIDTH % TILE_SIZE) != 0
 #define NUM_TILES_X_AXIS (CONFIG_VNC_SERVER_FRAME_WIDTH/TILE_SIZE + 1)
 #define LAST_TILE_WIDTH (CONFIG_VNC_SERVER_FRAME_WIDTH % TILE_SIZE)
 #else
-#define NUM_TILES_X_AXIS (CONFIG_VNC_SERVER_FRAME_WIDTH/TILE_SIZE)
-#define LAST_TILE_WIDTH TILE_SIZE
+#define NUM_TILES_X_AXIS (CONFIG_VNC_SERVER_FRAME_WIDTH/TILE_SIZE)	///< Nr of tiles on the X axis.
+#define LAST_TILE_WIDTH TILE_SIZE					///< Width of the last tile.
 #endif
 
-/* Array for marking tiles that have been updated */
+/**
+ * @brief  Array for marking tiles that have been updated
+ */
 int			tile_updated[NUM_TILES_Y_AXIS+1][NUM_TILES_X_AXIS+1];
 
-/* Conditional variable to signal that a client is connected and initialised */
-EventGroupHandle_t	xEventGroupVNC;
-const int 		VNC_CLIENT_UPDATE_REQ = BIT0;
-int			vnc_client_sock = -1;
-bool			vnc_client_connected = false;
-
-/* Variable for sounding the client's bell */
-int			SoundBellCount;
-
-/* Variables for the Websocket client */
-bool			VNC_WS_run = false;
-int			VNC_WS_num = -1;
+EventGroupHandle_t	xEventGroupVNC;			///< Variable to signal that a client is connected and initialised
+const int 		VNC_CLIENT_UPDATE_REQ = BIT0;	///< Client update request event
+int			vnc_client_sock = -1;		///< Client network socket
+bool			vnc_client_connected = false;	///< Client connected?
+int			SoundBellCount;			///< Count the client's bell
+bool			VNC_WS_run = false;		///< Websocket running
+int			VNC_WS_num = -1;		///< Websocket connection number
 
 
 
-/* Variable to hold the frame format details */
+/**
+ * @brief Variable to hold the frame format details
+ */
 vnc_frame_format_t	frame_format = {CONFIG_VNC_SERVER_FRAME_WIDTH, CONFIG_VNC_SERVER_FRAME_HEIGHT, frame_buffer,
                                    1,			// RGB332 server native.
                                    0,			// RGB555
@@ -177,7 +180,9 @@
 #endif
 
 
-/* Structure to hold the encoding type details */
+/**
+ * @brief Structure to hold the encoding type details
+ */
 volatile struct encoding_type_struct
 {
     uint8_t		raw;
--- a/components/vnc_server/vnc-server.h	Mon Oct 29 12:16:37 2018 +0100
+++ b/components/vnc_server/vnc-server.h	Mon Oct 29 19:37:14 2018 +0100
@@ -93,7 +93,7 @@
  * @param x1 Start horizontal position.
  * @param x2 End of the horizontal position.
  * @param y The vertical position of the line.
- * @param colour The RGB color of the line.
+ * @param color The RGB color of the line.
  */
 void VncDrawHorzLine(uint16_t x1, uint16_t x2, uint16_t y, vnc_color_t color);
 
@@ -122,7 +122,9 @@
 void VncSoundBell(void);
 
 
-/* Macro to convert from RGB to colour values */
+/**
+ * @brief Macro to convert from RGB to colour values
+ */
 #define VNC_RGB2COL(r,g,b) (vnc_color_t)(((((uint8_t)r)&0xE0) >> 0) | ((((uint8_t)g)&0xE0) >> 3) | ((((uint8_t)b)&0xC0) >> 6))
 
 
--- a/components/websocket/include/websocket.h	Mon Oct 29 12:16:37 2018 +0100
+++ b/components/websocket/include/websocket.h	Mon Oct 29 19:37:14 2018 +0100
@@ -112,7 +112,7 @@
 void ws_disconnect_client(ws_client_t* client);
 
 /**
- * @briek Test if the client is connected.
+ * @brief Test if the client is connected.
  *        status updates after send/read/connect/disconnect.
  * @param client The ws_client_t structure with the client information.
  * @return True if connected, false if not.
--- a/components/websocket/include/websocket_server.h	Mon Oct 29 12:16:37 2018 +0100
+++ b/components/websocket/include/websocket_server.h	Mon Oct 29 19:37:14 2018 +0100
@@ -13,14 +13,14 @@
 
 #include "websocket.h"
 
-#define WEBSOCKET_SERVER_MAX_CLIENTS CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS
-#define WEBSOCKET_SERVER_QUEUE_SIZE CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE
-#define WEBSOCKET_SERVER_QUEUE_TIMEOUT CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT
-#define WEBSOCKET_SERVER_TASK_STACK_DEPTH CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH
-#define WEBSOCKET_SERVER_TASK_PRIORITY CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY
-#define WEBSOCKET_SERVER_PINNED CONFIG_WEBSOCKET_SERVER_PINNED
+#define WEBSOCKET_SERVER_MAX_CLIENTS CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS		///< Maximum allowed clients
+#define WEBSOCKET_SERVER_QUEUE_SIZE CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE			///< Webserver requests queue size
+#define WEBSOCKET_SERVER_QUEUE_TIMEOUT CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT		///< Queue timeout
+#define WEBSOCKET_SERVER_TASK_STACK_DEPTH CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH	///< Task stack size
+#define WEBSOCKET_SERVER_TASK_PRIORITY CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY		///< Task priority
+#define WEBSOCKET_SERVER_PINNED CONFIG_WEBSOCKET_SERVER_PINNED				///< Pinned to a CPU
 #if WEBSOCKET_SERVER_PINNED
-#define WEBSOCKET_SERVER_PINNED_CORE CONFIG_WEBSOCKET_SERVER_PINNED_CORE
+#define WEBSOCKET_SERVER_PINNED_CORE CONFIG_WEBSOCKET_SERVER_PINNED_CORE		///< If pinned, which CPU
 #endif
 
 /**
@@ -104,8 +104,8 @@
  * @brief Send text to client with the set number.
  * @param num The client connection number.
  * @param msg The message to send.
- * @param The length of the message to send.
- * @retrun 1 if message send.
+ * @param len The length of the message to send.
+ * @return 1 if message send.
  */
 int ws_server_send_text_client(int num,char* msg,uint64_t len);
 int ws_server_send_text_client_from_callback(int num,char* msg,uint64_t len);
@@ -114,7 +114,7 @@
  * @brief Sends text to all clients with the set url.
  * @param url The clients url.
  * @param msg The message to send.
- * @param The length of the message to send.
+ * @param len The length of the message to send.
  * @return The number of clients the message was send to.
  */
 int ws_server_send_text_clients(char* url,char* msg,uint64_t len);
@@ -123,7 +123,7 @@
 /**
  * @brief Sends text to all clients.
  * @param msg The message to send.
- * @param The length of the message to send.
+ * @param len The length of the message to send.
  * @return The number of clients the message was send to.
  */
 int ws_server_send_text_all(char* msg,uint64_t len);
@@ -133,8 +133,8 @@
  * @brief Send binary message to client with the set number.
  * @param num The client connection number.
  * @param msg The message to send.
- * @param The length of the message to send.
- * @retrun 1 if message send.
+ * @param len The length of the message to send.
+ * @return 1 if message send.
  */
 int ws_server_send_bin_client(int num,char* msg,uint64_t len);
 int ws_server_send_bin_client_from_callback(int num,char* msg,uint64_t len);
@@ -143,7 +143,7 @@
  * @brief Sends binary message to all clients with the set url.
  * @param url The clients url.
  * @param msg The message to send.
- * @param The length of the message to send.
+ * @param len The length of the message to send.
  * @return The number of clients the message was send to.
  */
 int ws_server_send_bin_clients(char* url,char* msg,uint64_t len);
@@ -151,13 +151,17 @@
 /**
  * @brief Sends binary message to all clients.
  * @param msg The message to send.
- * @param The length of the message to send.
+ * @param len The length of the message to send.
  * @return The number of clients the message was send to.
  */
 int ws_server_send_bin_all(char* msg,uint64_t len);
 
-
-int ws_server_ping(int num); // sends a ping to client num
+/**
+ * @brief Websocket ping (not working yet)
+ * @param num The connection number
+ * @return 1 if succeeded.
+ */
+int ws_server_ping(int num);
 
 #endif
 
--- a/sdkconfig	Mon Oct 29 12:16:37 2018 +0100
+++ b/sdkconfig	Mon Oct 29 19:37:14 2018 +0100
@@ -81,10 +81,12 @@
 #
 # BrewBoard Configuration
 #
-CONFIG_TEMP_SENSORS_ONEWIRE=
-CONFIG_TEMP_SENSORS_SIMULATOR=y
-CONFIG_SSR_MLT_GPIO=33
-CONFIG_SSR_HLT_GPIO=32
+CONFIG_TEMP_SENSORS_ONEWIRE=y
+CONFIG_TEMP_SENSORS_SIMULATOR=
+CONFIG_ONE_WIRE_MLT=27
+CONFIG_ONE_WIRE_HLT=26
+CONFIG_SSR_MLT_GPIO=32
+CONFIG_SSR_HLT_GPIO=33
 CONFIG_SSR_PUMP_GPIO=12
 CONFIG_BUZZER_GPIO=25
 

mercurial